This PR adds commands. I've started working on this with lieutenant, but I did't like regex because it's hard to write regexps for something like @e[advancements={"adv":{criteria:"true"}}], it required some refactoring to make compatible structure for Declare Commands packet, CommandCtx: Send + Sync wouldn't allow LifetimelessMut<Game> and has no concept of tab completion, so I decided to make my own dispatcher instead of rewriting 95% of the existing code.
Things to do:
[ ] Vanilla commands
[ ] /help (/?)
[ ] /advancement
[ ] /attribute
[x] /ban
[x] /ban-ip
[x] /banlist
[ ] /bossbar
[x] /clear
[ ] /clone
[ ] /data
[ ] /datapack
[ ] /debug
[x] /defaultgamemode
[ ] /deop
[ ] /difficulty
[ ] /effect
[ ] /enchant
[x] /execute
[ ] /experience (/xp)
[ ] /fill
[ ] /forceload
[ ] /function
[x] /gamemode
[ ] /gamerule
[ ] /give
[ ] /item
[ ] /kick
[ ] /kill
[ ] /list
[ ] /locate
[ ] /locatebiome
[ ] /loot
[x] /me
[ ] /op
[x] /pardon
[x] /pardon-ip
[ ] /particle
[ ] /perf
[ ] /playsound
[ ] /recipe
[ ] /reload
[ ] /save-all
[ ] /save-off
[ ] /save-on
[x] /say
[ ] /schedule
[ ] /scoreboard
[x] /seed
[x] /setblock
[ ] /setidletimeout
[ ] /setworldspawn
[ ] /spawnpoint
[ ] /spectate
[ ] /spreadplayers
[ ] /stop
[ ] /stopsound
[ ] /summon
[ ] /tag
[ ] /team
[ ] /teammsg (/tm)
[ ] /teleport (/tp)
[ ] /tell (/msg, /w)
[ ] /tellraw
[x] /time
[ ] /title
[ ] /trigger
[ ] /weather
[ ] /whitelist
[ ] /worldborder
[x] Tab completions
[x] Tooltips
[x] Replace position (start and end of replacement)
[ ] Arguments
[x] Integer (i32, i64)
[x] Float (f32, f64)
[ ] Ranges
[x] String
[x] Entity selectors
[x] Selector parsing (serde)
[x] Finding matching entities
[x] "tag" selector (serde)
[x] Selection by name and uuid
[ ] Custom enum argument macro
[ ] Boolean
[x] Block position
[ ] Vec3
[ ] Vec2
[x] Block State
[ ] Block Predicate
[ ] Itemstack
[x] Item Predicate
[ ] Chat color
[ ] Text Component
[x] Message (string with selectors)
[ ] Nbt
[ ] Nbt path
[ ] Objective
[ ] Objective criteria
[ ] Operation
[ ] Particle
[ ] Rotation
[ ] Angle
[ ] Scoreboard slot
[x] Swizzle
[ ] Team
[ ] Item Slot (name)
[x] Resource Location (identifier)
[ ] Mob effect
[ ] Function
[x] Entity anchor
[ ] Item enchantment
[ ] Entity summon
[ ] Dimension
[ ] Uuid
[ ] Nbt tag (partial, used in data modify command)
[ ] Nbt compound tag (full)
[x] Time
[x] Console
[ ] Plugin support (I've done the rust native API and it works, and tried to make it work with wasm32-wasi, but I'm new to FFI and wasm, so I'll definitely need some help with this)
[x] A fully functional example plugin (bungeecord-servers)
[ ] Permissions support
[x] Declare Commands packet (maybe do something better than LengthInferredVecU8?)
Things to discuss
[ ] The new command crate's name
[ ] Command macro design
[ ] Should the /help command be auto-generated?
[ ] How can we organize vanilla command implementations? All in one file, one file per command or group them somehow
Related issues
Checklist
[ ] Ran cargo fmt, cargo clippy --all-targets, cargo build --release and cargo test and fixed any generated errors!
[ ] Removed unnecessary commented out code
[ ] Used specific traces (if you trace actions please specify the cause i.e. the player)
Note: if you locally don't get any errors, but GitHub Actions fails (especially at clippy) you might want to check your rust toolchain version. You can then feel free to fix these warnings/errors in your PR.
Commands
Status
Description
This PR adds commands. I've started working on this with lieutenant, but I did't like regex because it's hard to write regexps for something like
@e[advancements={"adv":{criteria:"true"}}]
, it required some refactoring to make compatible structure for Declare Commands packet,CommandCtx: Send + Sync
wouldn't allowLifetimelessMut<Game>
and has no concept of tab completion, so I decided to make my own dispatcher instead of rewriting 95% of the existing code.Things to do:
Things to discuss
Related issues
Checklist
cargo fmt
,cargo clippy --all-targets
,cargo build --release
andcargo test
and fixed any generated errors!Note: if you locally don't get any errors, but GitHub Actions fails (especially at
clippy
) you might want to check your rust toolchain version. You can then feel free to fix these warnings/errors in your PR.