summaryrefslogtreecommitdiffstats
path: root/nms-patches/CommandGamemode.patch
blob: 939a80d371b11409a62d37b6a9cde754d7f2c01b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--- a/net/minecraft/server/CommandGamemode.java
+++ b/net/minecraft/server/CommandGamemode.java
@@ -57,6 +57,12 @@
 
             if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
                 entityplayer.a(enumgamemode);
+                // CraftBukkit start - handle event cancelling the change
+                if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
+                    commandcontext.getSource().sendFailureMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
+                    continue;
+                }
+                // CraftBukkit end
                 a((CommandListenerWrapper) commandcontext.getSource(), entityplayer, enumgamemode);
                 ++i;
             }