SPIGOT-212: Modify the vanilla change gamemode method to call our version
Dieser Commit ist enthalten in:
Ursprung
55e592e542
Commit
4207eeffe0
38
nms-patches/CommandGamemode.patch
Normale Datei
38
nms-patches/CommandGamemode.patch
Normale Datei
@ -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
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/EntityPlayer.java 2014-12-12 19:26:14.249913563 +0000
|
||||
+++ src/main/java/net/minecraft/server/EntityPlayer.java 2014-12-12 19:25:07.997914283 +0000
|
||||
--- ../work/decompile-8eb82bde/net/minecraft/server/EntityPlayer.java 2014-12-15 14:13:24.430966154 +0000
|
||||
+++ src/main/java/net/minecraft/server/EntityPlayer.java 2014-12-15 14:13:24.434966154 +0000
|
||||
@@ -13,6 +13,17 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -446,7 +446,24 @@
|
||||
|
||||
public void b(IChatBaseComponent ichatbasecomponent) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent));
|
||||
@@ -768,6 +936,7 @@
|
||||
@@ -747,6 +915,8 @@
|
||||
}
|
||||
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
+ getBukkitEntity().setGameMode(org.bukkit.GameMode.getByValue(enumgamemode.getId()));
|
||||
+ /* CraftBukkit start - defer to our setGameMode
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -757,6 +927,7 @@
|
||||
|
||||
this.updateAbilities();
|
||||
this.bO();
|
||||
+ // CraftBukkit end */
|
||||
}
|
||||
|
||||
public boolean v() {
|
||||
@@ -768,6 +939,7 @@
|
||||
}
|
||||
|
||||
public boolean a(int i, String s) {
|
||||
@ -454,7 +471,7 @@
|
||||
if ("seed".equals(s) && !this.server.ad()) {
|
||||
return true;
|
||||
} else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) {
|
||||
@@ -781,6 +950,9 @@
|
||||
@@ -781,6 +953,9 @@
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -464,7 +481,7 @@
|
||||
}
|
||||
|
||||
public String w() {
|
||||
@@ -867,6 +1039,129 @@
|
||||
@@ -867,6 +1042,129 @@
|
||||
}
|
||||
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren