Paper/nms-patches/CommandGamemode.patch
2015-03-04 09:48:58 +00:00

29 lines
1.3 KiB
Diff

--- /home/matt/mc-dev-private//net/minecraft/server/CommandGamemode.java 2015-02-26 22:40:22.343608142 +0000
+++ src/main/java/net/minecraft/server/CommandGamemode.java 2015-02-26 22:40:22.351608142 +0000
@@ -26,6 +26,13 @@
EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(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
+
entityplayer.fallDistance = 0.0F;
if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) {
entityplayer.sendMessage(new ChatMessage("gameMode.changed", new Object[0]));
@@ -57,4 +64,11 @@
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
}