blob: 3f4dd212df46ae1249d8290d8537085d6a7827b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
}
|