3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00
Paper/nms-patches/TileEntitySign.patch

56 Zeilen
2.5 KiB
Diff

--- ../work/decompile-8eb82bde//net/minecraft/server/TileEntitySign.java 2014-12-05 23:10:25.877614213 +0000
+++ src/main/java/net/minecraft/server/TileEntitySign.java 2014-12-05 23:06:56.609618857 +0000
@@ -20,6 +20,12 @@
nbttagcompound.setString("Text" + (i + 1), s);
}
+
+ // CraftBukkit start
+ if (Boolean.getBoolean("convertLegacySigns")) {
+ nbttagcompound.setBoolean("Bukkit.isConverted", true);
+ }
+ // CraftBukkit end
this.i.b(nbttagcompound);
}
@@ -29,14 +35,27 @@
super.a(nbttagcompound);
TileEntitySignCommandListener tileentitysigncommandlistener = new TileEntitySignCommandListener(this);
+ // CraftBukkit start - Add an option to convert signs correctly
+ // This is done with a flag instead of all the time because
+ // we have no way to tell whether a sign is from 1.7.10 or 1.8
+
+ boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !nbttagcompound.getBoolean("Bukkit.isConverted");
+
for (int i = 0; i < 4; ++i) {
String s = nbttagcompound.getString("Text" + (i + 1));
+
+ if (oldSign) {
+ lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
+ continue;
+ }
+ // CraftBukkit end
try {
IChatBaseComponent ichatbasecomponent = ChatSerializer.a(s);
try {
this.lines[i] = ChatComponentUtils.filterForDisplay(tileentitysigncommandlistener, ichatbasecomponent, (Entity) null);
+ if (false) throw new CommandException(null, null); // CraftBukkit - fix decompile error
} catch (CommandException commandexception) {
this.lines[i] = ichatbasecomponent;
}
@@ -77,7 +96,10 @@
ChatClickable chatclickable = chatmodifier.h();
if (chatclickable.a() == EnumClickAction.RUN_COMMAND) {
- MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b());
+ // CraftBukkit start
+ // MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b());
+ CommandBlockListenerAbstract.executeCommand(tileentitysignplayerwrapper, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), chatclickable.b());
+ // CraftBukkit ebd
}
}
}