Paper/nms-patches/CommandGamemode.patch

29 lines
1.2 KiB
Diff
Raw Normal View History

2015-05-25 18:37:24 +08:00
--- a/net/minecraft/server/CommandGamemode.java
+++ b/net/minecraft/server/CommandGamemode.java
2015-02-27 06:41:06 +08:00
@@ -26,6 +26,13 @@
EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(icommandlistener);
2015-02-27 06:41:06 +08:00
entityplayer.a(worldsettings_enumgamemode);
+ // CraftBukkit start - handle event cancelling the change
2015-02-27 06:41:06 +08:00
+ 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]));
2015-02-27 06:41:06 +08:00
@@ -57,4 +64,11 @@
public boolean isListStart(String[] astring, int i) {
return i == 1;
}
+
+ // CraftBukkit start - fix decompiler error
+ @Override
2015-02-27 06:41:06 +08:00
+ public int compareTo(ICommand o) {
+ return a((ICommand) o);
+ }
+ // CraftBukkit end
}