I am trying to have a command /gm 1 to change the players gamemode to gamemode 1. I know there is a plugin called essentials out there that has that command but I am trying to practice building bukkit plugins.
So here is my Main.java:
if(cmd.getName().equalsIgnoreCase("gm 1")){
String gm1 = "gamemode 1 " + player.getName();
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), gm1);
player.sendMessage(ChatColor.GRAY + "Your now in Creative Mode.");
}
Plugin.yml:
commands:
gm 1:
description: Sets your game mode to creative.
I am pretty new to java can someone help?
cmd.getName().equalsIgnoreCase("gm 1")
is not true? Printout cmd.getName to check if it's really equalsequalsIgnoreCase
, so it reads"gm 1".equalsIgnoreCase(cmd.getName())
.cmd.getName()
returns