Command Framework
Commands are built using a declarative tree structure.Command Structure
pumpkin/src/command/tree/
Building Commands
Commands use a builder pattern:pumpkin/src/command/tree/builder.rs
Command Senders
Commands can be executed from multiple sources:pumpkin/src/command/mod.rs:38-62
Each sender has:
- Permission Level: 0-4 (player to console)
- Position: Optional world coordinates
- World Context: Current world reference
Permission System
Permission levels match vanilla Minecraft:pumpkin/src/command/mod.rs:125-160
Built-in Commands
Pumpkin implements 51 standard commands:Player Management
/gamemode
Change player gamemode./gamemode <mode>- Change your gamemode/gamemode <mode> <player>- Change another player’s gamemode
survival, creative, adventure, spectator
Source: pumpkin/src/command/commands/gamemode.rs
/teleport (tp)
Teleport entities to locations./tp <destination>- Teleport to entity/tp <x> <y> <z>- Teleport to coordinates/tp <targets> <destination>- Teleport others/tp <x> <y> <z> facing <facingX> <facingY> <facingZ>- With rotation
pumpkin/src/command/commands/teleport.rs
/give
Give items to players./give <player> <item>- Give 1 item/give <player> <item> <count>- Give multiple items
pumpkin/src/command/commands/give.rs:17-19
/clear
Clear player inventory. Source:pumpkin/src/command/commands/clear.rs
/experience (xp)
Manage player experience. Source:pumpkin/src/command/commands/experience.rs
/kill
Kill entities. Source:pumpkin/src/command/commands/kill.rs
World Manipulation
/setblock
Place a block at coordinates. Source:pumpkin/src/command/commands/setblock.rs
/fill
Fill a region with blocks. Source:pumpkin/src/command/commands/fill.rs
/setworldspawn
Set the world spawn point. Source:pumpkin/src/command/commands/setworldspawn.rs
/spawnpoint
Set player spawn point. Source:pumpkin/src/command/commands/spawnpoint.rs
/seed
Display world seed. Source:pumpkin/src/command/commands/seed.rs
/worldborder
Manage world border. Source:pumpkin/src/command/commands/worldborder.rs
Entity Commands
/summon
Summon an entity. Source:pumpkin/src/command/commands/summon.rs
/damage
Damage an entity. Source:pumpkin/src/command/commands/damage.rs
/enchant
Enchant player’s held item. Source:pumpkin/src/command/commands/enchant.rs
/effect
Manage status effects. Source:pumpkin/src/command/commands/effect.rs
/rotate
Rotate entities. Source:pumpkin/src/command/commands/rotate.rs
Communication
/say
Broadcast a message. Source:pumpkin/src/command/commands/say.rs
/msg (tell, w)
Send private message. Source:pumpkin/src/command/commands/msg.rs
/me
Display action message. Source:pumpkin/src/command/commands/me.rs
/tellraw
Send JSON text component. Source:pumpkin/src/command/commands/tellraw.rs
/title
Display titles and subtitles. Source:pumpkin/src/command/commands/title.rs
Server Management
/stop
Stop the server. Source:pumpkin/src/command/commands/stop.rs
/kick
Kick a player. Source:pumpkin/src/command/commands/kick.rs
/ban
Ban a player. Source:pumpkin/src/command/commands/ban.rs
/banip
Ban an IP address. Source:pumpkin/src/command/commands/banip.rs
/pardon
Unban a player. Source:pumpkin/src/command/commands/pardon.rs
/pardonip
Unban an IP address. Source:pumpkin/src/command/commands/pardonip.rs
/banlist
View ban list. Source:pumpkin/src/command/commands/banlist.rs
/whitelist
Manage whitelist. Source:pumpkin/src/command/commands/whitelist.rs
/op
Grant operator status. Source:pumpkin/src/command/commands/op.rs
/deop
Revoke operator status. Source:pumpkin/src/command/commands/deop.rs
/list
List online players. Source:pumpkin/src/command/commands/list.rs
/setidletimeout
Set AFK kick timeout. Source:pumpkin/src/command/commands/setidletimeout.rs
/transfer
Transfer player to another server. Source:pumpkin/src/command/commands/transfer.rs
Game Rules
/gamerule
Modify game rules. Source:pumpkin/src/command/commands/gamerule.rs
/difficulty
Set world difficulty. Source:pumpkin/src/command/commands/difficulty.rs
/defaultgamemode
Set default gamemode. Source:pumpkin/src/command/commands/defaultgamemode.rs
Time & Weather
/time
Manage world time. Source:pumpkin/src/command/commands/time.rs
/weather
Change weather. Source:pumpkin/src/command/commands/weather.rs
/tick
Control tick rate. Source:pumpkin/src/command/commands/tick.rs
Audio & Visual
/playsound
Play a sound. Source:pumpkin/src/command/commands/playsound.rs
/stopsound
Stop playing sounds. Source:pumpkin/src/command/commands/stopsound.rs
/particle
Spawn particle effects. Source:pumpkin/src/command/commands/particle.rs
UI Elements
/bossbar
Manage boss bars. Source:pumpkin/src/command/commands/bossbar.rs
Data Commands
/data
Manage entity/block NBT data. Source:pumpkin/src/command/commands/data.rs
Debugging
/help
Display command help. Source:pumpkin/src/command/commands/help.rs
/tps
Display server TPS (ticks per second). Source:pumpkin/src/command/commands/tps.rs
/pumpkin
Pumpkin server information. Source:pumpkin/src/command/commands/pumpkin.rs
Plugins
/plugins
List loaded plugins. Source:pumpkin/src/command/commands/plugins.rs
/plugin
Manage individual plugins. Source:pumpkin/src/command/commands/plugin.rs
Command Arguments
Rich argument types with validation:Position Arguments
- Absolute:
100 64 200 - Relative:
~5 ~-3 ~10 - Local:
^1 ^0 ^-2
pumpkin/src/command/args/
Entity Selectors
@p- Nearest player@a- All players@e- All entities@s- Self@r- Random player
@e[type=zombie,distance=..10]
Source: pumpkin/src/command/args/
Resource Arguments
pumpkin/src/command/args/resource/
Other Arguments
- GameMode: Gamemode selection
- Difficulty: Difficulty level
- Rotation: Yaw/pitch angles
- TextComponent: JSON text
- Message: Chat message
- Time: Time values (ticks/seconds/days)
- BoundedNum: Numbers with min/max
pumpkin/src/command/args/
Tab Completion
Automatic tab completion for:- Command names
- Argument values
- Player names
- Item IDs
- Entity types
- Block states
pumpkin/src/command/client_suggestions.rs
Error Handling
pumpkin/src/command/dispatcher.rs
Errors provide:
- Localized error messages
- Argument validation feedback
- Permission denied notices
Command Execution
Asynchronous command execution:pumpkin/src/command/mod.rs