flying-squid icon indicating copy to clipboard operation
flying-squid copied to clipboard

Implement vanilla commands

Open rom1504 opened this issue 10 years ago • 24 comments

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

rom1504 avatar Nov 25 '15 18:11 rom1504

I think they should be implementing in a plugin separate from the main repo, but installed by default.

109C avatar Nov 26 '15 00:11 109C

That might be a good idea indeed since, unlike other (internal) plugins, nothing depends on commands.

rom1504 avatar Nov 26 '15 01:11 rom1504

Hmm. From a plugin standpoint, I would expect

for (var c of player.commands) {
  player.commands[c].disabled = true;
}

demipixel avatar Nov 26 '15 03:11 demipixel

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.

rom1504 avatar Nov 28 '15 00:11 rom1504

We need target selector too. They'll be useful for /kill and /attach

rom1504 avatar Nov 30 '15 10:11 rom1504

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?

demipixel avatar Nov 30 '15 17:11 demipixel

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.

rom1504 avatar Nov 30 '15 18:11 rom1504

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).

demipixel avatar Nov 30 '15 18:11 demipixel

ah ok, yeah that makes sense

rom1504 avatar Nov 30 '15 19:11 rom1504

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.

demipixel avatar Nov 30 '15 19:11 demipixel

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.

rom1504 avatar Dec 06 '15 03:12 rom1504

I put the list in the first post

rom1504 avatar Dec 06 '15 04:12 rom1504

Started selectors (incomplete) on /demipixel/flying-squid "selector" branch

demipixel avatar Dec 07 '15 09:12 demipixel

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.

rom1504 avatar Dec 07 '15 11:12 rom1504

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.

rom1504 avatar Dec 07 '15 11:12 rom1504

selectors are mostly done (by @demipixel ), now we can use them in commands :)

rom1504 avatar Dec 09 '15 00:12 rom1504

@rom1504 should this be in the TODO.md?

ghost avatar Dec 09 '15 20:12 ghost

no, issues are better really. TODO.md is useful for a very general roadmap maybe (like currently)

rom1504 avatar Dec 09 '15 21:12 rom1504

Ok

ghost avatar Dec 09 '15 22:12 ghost

I think /me and /say would be easy.

Also, if you're not new to the project, don't do the easy ones. Thanks.

demipixel avatar Dec 10 '15 07:12 demipixel

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.

rom1504 avatar Dec 25 '15 23:12 rom1504

done in 6040a4a12d4e15b5611bca666c1a4a38089cc709

rom1504 avatar Aug 18 '16 11:08 rom1504

Remove /publish command because it is available only in singleplayer

kotinash avatar Mar 02 '22 12:03 kotinash