Paper/nms-patches/TileEntitySign.patch

53 lines
2.2 KiB
Diff
Raw Normal View History

2015-05-25 18:37:24 +08:00
--- a/net/minecraft/server/TileEntitySign.java
+++ b/net/minecraft/server/TileEntitySign.java
2015-02-27 06:41:06 +08:00
@@ -21,6 +21,12 @@
nbttagcompound.setString("Text" + (i + 1), s);
}
2015-02-27 06:41:06 +08:00
+ // CraftBukkit start
+ if (Boolean.getBoolean("convertLegacySigns")) {
+ nbttagcompound.setBoolean("Bukkit.isConverted", true);
+ }
+ // CraftBukkit end
2015-02-27 06:41:06 +08:00
+
this.i.b(nbttagcompound);
}
2015-02-27 06:41:06 +08:00
@@ -65,12 +71,24 @@
public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {}
};
+ // 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
2015-02-27 06:41:06 +08:00
+
+ boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !nbttagcompound.getBoolean("Bukkit.isConverted");
2015-02-27 06:41:06 +08:00
+
for (int i = 0; i < 4; ++i) {
String s = nbttagcompound.getString("Text" + (i + 1));
try {
2015-02-27 06:41:06 +08:00
IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s);
2015-02-27 06:41:06 +08:00
+ if (oldSign) {
+ lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
+ continue;
+ }
+ // CraftBukkit end
+
try {
2015-02-27 06:41:06 +08:00
this.lines[i] = ChatComponentUtils.filterForDisplay(icommandlistener, ichatbasecomponent, (Entity) null);
} catch (CommandException commandexception) {
2015-05-25 20:04:32 +08:00
@@ -155,7 +173,10 @@
ChatClickable chatclickable = chatmodifier.h();
2015-02-27 06:41:06 +08:00
if (chatclickable.a() == ChatClickable.EnumClickAction.RUN_COMMAND) {
- MinecraftServer.getServer().getCommandHandler().a(icommandlistener, chatclickable.b());
+ // CraftBukkit start
+ // MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b());
+ CommandBlockListenerAbstract.executeCommand(entityhuman, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), chatclickable.b());
2015-02-27 06:41:06 +08:00
+ // CraftBukkit end
}
}
}