Chat commands

Posts 12 of 2 · Page 1 of 1
Chat commands
Alright, since SOMEONE wanted me to help him with this (Not naming anyone ), I decided I'll just show the world.

Step 1:
Open up GuiChat.java (net.minecraft.client.gui.GuiChat)
Step 2:
Find this method:
Code:
    public void func_146403_a(String p_146403_1_)
    {
        this.mc.ingameGUI.getChatGUI().func_146239_a(p_146403_1_);
        this.mc.thePlayer.sendChatMessage(p_146403_1_);
    }
Step 3:
Change it like so:
Code:
    public void func_146403_a(String p_146403_1_)
    {
        if(p_146403_1_.startsWith(".")) {
            String commandString = p_146403_1_.substring(1);
            if(commandString.toLowercase().startsWith("help")) {
                // Stuff
            }
            // Continue adding commands here
            return; // Dun forget this.
        }
        this.mc.ingameGUI.getChatGUI().func_146239_a(p_146403_1_);
        this.mc.thePlayer.sendChatMessage(p_146403_1_);
    }
Footnote about the code:
Obviously, I don't do mine like this. Mine looks like this:
Code:
    public void func_146403_a(String p_146403_1_)
    {
        // TODO Isis
        if(p_146403_1_.startsWith(Isis.getInstance().getCommandPrefix())) {
            String command = p_146403_1_.substring(Isis.getInstance().getCommandPrefix().length());
            String[] args = command.split(" ");
            ManagerCommand.getInstance().parseCommand(args);
            return;
        }
        this.mc.ingameGUI.getChatGUI().func_146239_a(p_146403_1_);
        this.mc.thePlayer.sendChatMessage(p_146403_1_);
    }
but I figured most people wouldn't know what to do with that.
Quote Originally Posted by godshawk View Post
Footnote about the code:
Obviously, I don't do mine like this. Mine looks like this:
OMAIGERD learn2eventpls....thats the whole point of event systems, so u no do stuff like dis
Posts 12 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?