Add ChatCommands & New ConsoleCommands#939
Conversation
…,give,enchant,setblock,fill,time,weather,summon for Chat Commands, Added Summon in Console Commands And Edited Help For New parameters
|
Could you add /tp to coordinates? |
|
oh yeah i missed that completely im going to add /particle soon i will add that with this |
|
This is too messy. 4J had the basics of a command system setup and this just guts it in favor of a lot of hard coded magic values and fixed strings. This isn't a super maintainable way to have a command system unfortunately. If you refactor this to use the actual command system we could consider this, but make sure the isolated dedicated server project isn't already doing this before you waste time doing what's already been done. Thanks for the contribution. |
|
Thanks for the feedback. Could you pinpoint the code snippets for the "basics of a command system setup" you're talking about? I saw the "4J - TODO" on message 4J put on handlecommand, so thought that was the basic command system and just finished that part of the code. Also, could you specify more explicitly what numbers and variables you take issue with? I can add more comments to clarify what the variables, numbers, and some functions do, but I'm a little confused on what I'm doing wrong here. I checked the dedicated server fork and they haven't done anything for the ingame chat, just for commands input in the CMD terminal of the server. Aswell as this, the only non-server specific command they added was /gamemode, which is broken in the latest commit of the dedicated server. Commands already in the source code: Commands added by Kuwacoms dedicated server: Commands added by me: Before my edits there weren't any chat commands, only ones that worked in -server, or when Minecraft.Server.exe was ran. Now with my edits all these commands run both in chat and in -server. |
| return true; | ||
| } | ||
|
|
||
| if (action == L"summon") |
There was a problem hiding this comment.
In general, this particular non-modular implementation of commands in addition to the various independent command .cpp/.h files is confusing and not very good architecturally. Ideally these should be unified and all of our commands should be implemented in their own files. Having this duplicate implementation is messy and just not good for maintainability long term.
Description
it adds the chat commands was left not finished
Changes
Added arg parsing to handlecommand() to check added commands also changed minecraftserver.cpp to add some commands to console
Previous Behavior
the game was looking messages starts with / but wasnt doing anything with it before changing there was a comment "4J - TODO"
Root Cause
not finished command system
New Behavior
it checks some keywords like /kill /gamemode if handlechat() finds / in the message start and check right args if not give a sendmessage to show args for that command
Fix Implementation
added arg parser to handlecommand() and with if statemens looked available commands if not give a sendmessage "unkown command"
AI Use Disclosure
ai was used to format some hard bracket insides and mapping item,tile,entity names for giveitem,setblock/fill,summon for time saving
Related Issues