diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-15 14:14:59 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-15 14:14:59 +0000 |
commit | 4207eeffe027b6231b3f4fd416fcf33a55a1c28e (patch) | |
tree | a11639834c105dd3bb4791179554a8ff7ea9168e /nms-patches/CommandGamemode.patch | |
parent | 55e592e542b6a0fd20e46987b7f4870bb7e85814 (diff) | |
download | craftbukkit-4207eeffe027b6231b3f4fd416fcf33a55a1c28e.tar craftbukkit-4207eeffe027b6231b3f4fd416fcf33a55a1c28e.tar.gz craftbukkit-4207eeffe027b6231b3f4fd416fcf33a55a1c28e.tar.lz craftbukkit-4207eeffe027b6231b3f4fd416fcf33a55a1c28e.tar.xz craftbukkit-4207eeffe027b6231b3f4fd416fcf33a55a1c28e.zip |
SPIGOT-212: Modify the vanilla change gamemode method to call our version
Diffstat (limited to 'nms-patches/CommandGamemode.patch')
-rw-r--r-- | nms-patches/CommandGamemode.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/nms-patches/CommandGamemode.patch b/nms-patches/CommandGamemode.patch new file mode 100644 index 00000000..3f4dd212 --- /dev/null +++ b/nms-patches/CommandGamemode.patch @@ -0,0 +1,38 @@ +--- ../work/decompile-8eb82bde/net/minecraft/server/CommandGamemode.java 2014-12-15 14:13:23.910966159 +0000 ++++ src/main/java/net/minecraft/server/CommandGamemode.java 2014-12-15 14:13:23.910966159 +0000 +@@ -18,7 +18,7 @@ + return "commands.gamemode.usage"; + } + +- public void execute(ICommandListener icommandlistener, String[] astring) { ++ public void execute(ICommandListener icommandlistener, String[] astring) throws ExceptionUsage { // CraftBukkit - added throws + if (astring.length <= 0) { + throw new ExceptionUsage("commands.gamemode.usage", new Object[0]); + } else { +@@ -26,6 +26,14 @@ + EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(icommandlistener); + + entityplayer.a(enumgamemode); ++ ++ // CraftBukkit start - handle event cancelling the change ++ if (entityplayer.playerInteractManager.getGameMode() != 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 +65,11 @@ + public boolean isListStart(String[] astring, int i) { + return i == 1; + } ++ ++ // CraftBukkit start - fix decompiler error ++ @Override ++ public int compareTo(Object o) { ++ return a((ICommand) o); ++ } ++ // CraftBukkit end + } |