summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandGamemode.patch
blob: ac389787abfeaf93ae48790bd4aa8d7cc5f49c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- /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
 }