--- a/net/minecraft/server/CommandGamemode.java +++ b/net/minecraft/server/CommandGamemode.java @@ -27,6 +27,12 @@ EntityPlayer entityplayer = astring.length >= 2 ? a(minecraftserver, icommandlistener, astring[1]) : a(icommandlistener); entityplayer.a(worldsettings_enumgamemode); + // CraftBukkit start - handle event cancelling the change + if (entityplayer.playerInteractManager.getGameMode() != worldsettings_enumgamemode) { + icommandlistener.sendMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'")); + return; + } + // CraftBukkit end ChatMessage chatmessage = new ChatMessage("gameMode." + worldsettings_enumgamemode.b(), new Object[0]); if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) { @@ -49,10 +55,17 @@ } public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, BlockPosition blockposition) { - return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.emptyList()); + return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.<String>emptyList()); // CraftBukkit - decompile error } public boolean isListStart(String[] astring, int i) { return i == 1; } + + // CraftBukkit start - fix decompiler error + @Override + public int compareTo(ICommand o) { + return a((ICommand) o); + } + // CraftBukkit end }