.gm Command

Posts 1–4 of 4 · Page 1 of 1
.gm Command
Anyone know how i would make a .gm command?
I have this set up in my runCommand void of the commands class,
Code:
if(mc.thePlayer.getGameType() == EnumGameType.SURVIVAL){
		    mc.thePlayer.setGameType(EnumGameType.CREATIVE);
		    lithium.addMessage("Gamemode updated to §bCreative§f.");
		}
	    if(mc.thePlayer.getGameType() == EnumGameType.CREATIVE){
		    mc.thePlayer.setGameType(EnumGameType.SURVIVAL);
		    lithium.addMessage("Gamemode updated to §bSurvival§f.");
		}
If message starts with ".gm"
{
split string, get the second part.
if split string equals to that,
{do this;} else {do that}
}
My client isnt set up like that, everything is modulised and ive got it working now.
code is
Code:
public void runCommand(String s, String[] args)
	{
		if (this.mc.thePlayer.capabilities.isCreativeMode) {
            this.sendChat("survival");
        } else {
            this.sendChat("creative");
        }
    }

    private void sendChat(String gameMode) {
        this.mc.thePlayer.sendChatMessage("/gamemode " + gameMode);
    }
Didnt know it was more oop than most clients are. Uhm.. Why not create a toggle.. So say instead of writing .gm (gamemode) just write .gm and it will not your gamemode. Saves time? Uhm and it doesnt matter how youd have it set up. The method which I told you is used in shitloads of games and its simple to use.
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us