2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/CommandGamemode.java
|
|
|
|
+++ b/net/minecraft/server/CommandGamemode.java
|
2016-05-10 13:47:39 +02:00
|
|
|
@@ -28,6 +28,12 @@
|
2017-05-14 04:00:00 +02:00
|
|
|
EntityPlayer entityplayer = astring.length >= 2 ? b(minecraftserver, icommandlistener, astring[1]) : a(icommandlistener);
|
2014-12-15 15:14:59 +01:00
|
|
|
|
2016-06-09 03:43:49 +02:00
|
|
|
entityplayer.a(enumgamemode);
|
2014-12-15 15:14:59 +01:00
|
|
|
+ // CraftBukkit start - handle event cancelling the change
|
2016-06-09 03:43:49 +02:00
|
|
|
+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
2014-12-15 15:14:59 +01:00
|
|
|
+ icommandlistener.sendMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2016-06-09 03:43:49 +02:00
|
|
|
ChatMessage chatmessage = new ChatMessage("gameMode." + enumgamemode.b(), new Object[0]);
|
2016-02-29 22:32:46 +01:00
|
|
|
|
2014-12-15 15:14:59 +01:00
|
|
|
if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) {
|
2016-05-10 13:47:39 +02:00
|
|
|
@@ -50,10 +56,17 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
}
|
|
|
|
|
2016-05-10 13:47:39 +02:00
|
|
|
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
|
2016-02-29 22:32:46 +01:00
|
|
|
- return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.emptyList());
|
|
|
|
+ return astring.length == 1 ? a(astring, new String[] { "survival", "creative", "adventure", "spectator"}) : (astring.length == 2 ? a(astring, minecraftserver.getPlayers()) : Collections.<String>emptyList()); // CraftBukkit - decompile error
|
|
|
|
}
|
|
|
|
|
2014-12-15 15:14:59 +01:00
|
|
|
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) {
|
2014-12-15 15:14:59 +01:00
|
|
|
+ return a((ICommand) o);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|