mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-09 12:19:56 +01:00
29 lines
1.2 KiB
Diff
29 lines
1.2 KiB
Diff
--- a/net/minecraft/server/CommandGamemode.java
|
|
+++ b/net/minecraft/server/CommandGamemode.java
|
|
@@ -26,6 +26,13 @@
|
|
EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(icommandlistener);
|
|
|
|
entityplayer.a(worldsettings_enumgamemode);
|
|
+ // CraftBukkit start - handle event cancelling the change
|
|
+ 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]));
|
|
@@ -57,4 +64,11 @@
|
|
public boolean isListStart(String[] astring, int i) {
|
|
return i == 1;
|
|
}
|
|
+
|
|
+ // CraftBukkit start - fix decompiler error
|
|
+ @Override
|
|
+ public int compareTo(ICommand o) {
|
|
+ return a((ICommand) o);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|