BUKKIT - MINECRAFT Setting gamemode issue
<p>I started developing plugin for my server. I made main class and pleh commands but all stopped when I started with <code>gamemode</code> command. I mean it works with no errors but gives no output. It could be a simple mistake but I can't find it.</p>

<p>Here is my code:</p>

<pre><code>import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class Gamemode implements CommandExecutor {

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {

        if (!(sender instanceof Player)) {
            sender.sendMessage(ChatColor.RED + "Haha nice try not happening today.");
            return true;
        }
        Player p = (Player) sender;
        if (cmd.getName().equalsIgnoreCase("gm")) {
            if ((!p.hasPermission("sutils.*")) &amp;&amp;
                    (!p.hasPermission("sutils.gamemode"))) {
                p.sendMessage(ChatColor.RED + "Sorry no permission.");
                return true;
            }
            if (args.equals("0")) {
                p.setGameMode(GameMode.SURVIVAL);
                p.sendMessage(ChatColor.RED + "Gamemode set to Survival");
            }

            if (args.equals("1")) {
                p.setGameMode(GameMode.CREATIVE);
                p.sendMessage(ChatColor.RED + "Gamemode set to Creative");
            }

            if (args.equals("2")) {
                p.setGameMode(GameMode.ADVENTURE);
                p.sendMessage(ChatColor.RED + "Gamemode set to Adventure");
            }

            if (args.equals("3")) {
                p.setGameMode(GameMode.SPECTATOR);
                p.sendMessage(ChatColor.RED + "Gamemode set to Spectator");
            }
            return true;

        }
        return true;
    }

}
</code></pre>

<p>Actually, the only thing that happens is when I type command in console it sends me my not a player msg but as player nope does not work.</p>