Implement vanilla commands
http://minecraft.gamepedia.com/Commands#Summary_of_commands
16/58
| status | name | difficulty | comments | test |
|---|---|---|---|---|
| /achievement | ||||
| done | /ban | |||
| done | /ban-ip | |||
| /banlist | easy | |||
| /blockdata | ||||
| /clear | ||||
| /clone | ||||
| /debug | ||||
| /defaultgamemode | easy | |||
| done | /deop | done | ||
| done | /difficulty | easy | pretty close to gamemode | |
| /effect | ||||
| /enchant | ||||
| /entitydata | ||||
| /execute | ||||
| /fill | similar to /setblock, interesting | |||
| partial | /gamemode | easy | should use the names of modes instead of numbers | |
| /gamerule | ||||
| /give | ||||
| partial | /help | should have pages and all like vanilla | done | |
| done | /kick | |||
| done | /kill | done | ||
| /list | easy | |||
| /me | ||||
| done | /op | done | ||
| done | /pardon | |||
| done | /particle | done | ||
| done | /playsound | done | ||
| /publish | ||||
| /replaceitem | ||||
| /save-all | ||||
| /save-off | ||||
| /save-on | ||||
| /say | ||||
| /scoreboard | ||||
| /seed | easy | |||
| done | /setblock | done | ||
| /setidletimeout | ||||
| /setworldspawn | ||||
| /spawnpoint | ||||
| /spreadplayers | ||||
| /stats | ||||
| /stop | easy | |||
| partial | /summon | done | ||
| /tell | easy | |||
| /tellraw | ||||
| /testfor | ||||
| /testforblock | ||||
| /testforblocks | ||||
| done | /time | |||
| /title | ||||
| /toggledownfall | easy | |||
| done | /tp | done | ||
| /trigger | ||||
| partial (#240) | /weather | easy | ||
| /whitelist | ||||
| /worldborder | ||||
| done | /xp | done |
I think they should be implementing in a plugin separate from the main repo, but installed by default.
That might be a good idea indeed since, unlike other (internal) plugins, nothing depends on commands.
Hmm. From a plugin standpoint, I would expect
for (var c of player.commands) {
player.commands[c].disabled = true;
}
would be nice to put commands in api.md (or a commands.md idk). Would make it easier to know all the commands available during dev.
We need target selector too. They'll be useful for /kill and /attach
just btw /attach isn't a real command...
Also, what format do you want for target selectors? For example, do we want to allow
new TargetSelector({
selector: 'entity',
type: 'player',
position: X,
radius: 4
});
And then deal with the text processing afterwards?
Yeah I know it's not really a command, but it's useful for testing, once attaching is properly implemented, /attach can go in a plugin.
Are target selectors useful in the code ? I mostly meant we need them in command parameters (as in /kill @e)
Edit: ah but yeah we could define such a class to make it easier to process them once parsed.
Well, we've been using whitelist/blacklist for no (arrays of players). The only positive about a selector is that the "array" can change (hence the use of it in command blocks. Command blocks are set once but entities they affect can change).
ah ok, yeah that makes sense
Then again, I don't think we need it for plugins. Command blocks will be parsed each time they're run, so we just recalculate the arrays then. Whitelist/Blacklist is easier to handle.
thanks @azastrael for doing the /tp command
I think we should do a list of commands to do here with [ ] , to keep track of progress.
I put the list in the first post
Started selectors (incomplete) on /demipixel/flying-squid "selector" branch
I added "easy" labels for some commands that are pretty easy (for example because they don't require any new flying-squid feature)
I think this is a good starting point for new contributors.
I added tests for a good portion of the currently implemented commands. These commands tests are pretty easy to write and understand (see https://github.com/mhsjlw/flying-squid/blob/master/test/mineflayer.js#L93).
For new added commands, it would be nice to add such a test with it.
selectors are mostly done (by @demipixel ), now we can use them in commands :)
@rom1504 should this be in the TODO.md?
no, issues are better really. TODO.md is useful for a very general roadmap maybe (like currently)
Ok
I think /me and /say would be easy.
Also, if you're not new to the project, don't do the easy ones. Thanks.
It would be nice to add an explanation into how to add a new command in the api.md. Take an example (like https://github.com/PrismarineJS/flying-squid/blob/8c4406804e015054ccd81568652ece42fac819a1/src/lib/plugins/spawn.js#L156 ) and add comments around it to explain what is what.
done in 6040a4a12d4e15b5611bca666c1a4a38089cc709
Remove /publish command because it is available only in singleplayer