PaperMC/nms-patches/CommandGamemode.patch

29 lines
1.3 KiB
Diff
Raw Normal View History

2015-02-26 23:41:06 +01:00
--- /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);
2015-02-26 23:41:06 +01:00
entityplayer.a(worldsettings_enumgamemode);
+ // CraftBukkit start - handle event cancelling the change
2015-02-26 23:41:06 +01: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-26 23:41:06 +01:00
@@ -57,4 +64,11 @@
public boolean isListStart(String[] astring, int i) {
return i == 1;
}
+
+ // CraftBukkit start - fix decompiler error
+ @Override
2015-02-26 23:41:06 +01:00
+ public int compareTo(ICommand o) {
+ return a((ICommand) o);
+ }
+ // CraftBukkit end
}