2015-05-25 18:37:24 +08:00
|
|
|
--- a/net/minecraft/server/TileEntitySign.java
|
|
|
|
+++ b/net/minecraft/server/TileEntitySign.java
|
2016-05-10 19:47:39 +08:00
|
|
|
@@ -21,6 +21,12 @@
|
2014-11-30 19:23:45 +08:00
|
|
|
nbttagcompound.setString("Text" + (i + 1), s);
|
|
|
|
}
|
2015-02-27 06:41:06 +08:00
|
|
|
|
2014-11-30 19:23:45 +08:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (Boolean.getBoolean("convertLegacySigns")) {
|
|
|
|
+ nbttagcompound.setBoolean("Bukkit.isConverted", true);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-27 06:41:06 +08:00
|
|
|
+
|
2014-11-30 19:23:45 +08:00
|
|
|
this.i.b(nbttagcompound);
|
2016-05-10 19:47:39 +08:00
|
|
|
return nbttagcompound;
|
2014-11-30 19:23:45 +08:00
|
|
|
}
|
2017-05-14 10:00:00 +08:00
|
|
|
@@ -58,14 +64,34 @@
|
2016-03-01 05:32:46 +08:00
|
|
|
}
|
2015-02-27 06:41:06 +08:00
|
|
|
};
|
2014-11-30 19:23:45 +08:00
|
|
|
|
|
|
|
+ // 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
|
|
|
+
|
2014-11-30 19:23:45 +08:00
|
|
|
+ boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !nbttagcompound.getBoolean("Bukkit.isConverted");
|
2015-02-27 06:41:06 +08:00
|
|
|
+
|
2014-11-30 19:23:45 +08:00
|
|
|
for (int i = 0; i < 4; ++i) {
|
|
|
|
String s = nbttagcompound.getString("Text" + (i + 1));
|
2016-03-01 05:32:46 +08:00
|
|
|
- IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s);
|
2015-06-12 17:38:20 +08:00
|
|
|
+ if (s != null && s.length() > 2048) {
|
2015-06-12 17:23:05 +08:00
|
|
|
+ s = "\"\"";
|
|
|
|
+ }
|
2014-11-30 19:23:45 +08:00
|
|
|
|
|
|
|
try {
|
2016-03-01 05:32:46 +08:00
|
|
|
- this.lines[i] = ChatComponentUtils.filterForDisplay(icommandlistener, ichatbasecomponent, (Entity) null);
|
|
|
|
- } catch (CommandException commandexception) {
|
|
|
|
- this.lines[i] = ichatbasecomponent;
|
|
|
|
+ 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
|
|
|
|
+
|
2016-03-01 05:32:46 +08:00
|
|
|
+ try {
|
|
|
|
+ this.lines[i] = ChatComponentUtils.filterForDisplay(icommandlistener, ichatbasecomponent, (Entity) null);
|
|
|
|
+ } catch (CommandException commandexception) {
|
|
|
|
+ this.lines[i] = ichatbasecomponent;
|
|
|
|
+ }
|
|
|
|
+ } catch (com.google.gson.JsonParseException jsonparseexception) {
|
|
|
|
+ this.lines[i] = new ChatComponentText(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-14 10:00:00 +08:00
|
|
|
@@ -155,7 +181,14 @@
|
2014-12-06 07:10:47 +08:00
|
|
|
ChatClickable chatclickable = chatmodifier.h();
|
|
|
|
|
2015-02-27 06:41:06 +08:00
|
|
|
if (chatclickable.a() == ChatClickable.EnumClickAction.RUN_COMMAND) {
|
2017-05-19 19:00:13 +08:00
|
|
|
- entityhuman.C_().getCommandHandler().a(icommandlistener, chatclickable.b());
|
2014-12-06 07:10:47 +08:00
|
|
|
+ // CraftBukkit start
|
2017-05-19 19:00:13 +08:00
|
|
|
+ // entityhuman.C_().getCommandHandler().a(icommandlistener, chatclickable.b());
|
2016-11-17 09:41:03 +08:00
|
|
|
+ CommandBlockListenerAbstract.executeSafely(icommandlistener, new org.bukkit.craftbukkit.command.ProxiedNativeCommandSender(
|
2016-03-01 05:32:46 +08:00
|
|
|
+ icommandlistener,
|
|
|
|
+ new org.bukkit.craftbukkit.command.CraftBlockCommandSender(icommandlistener),
|
|
|
|
+ entityhuman.getBukkitEntity()
|
|
|
|
+ ), chatclickable.b());
|
2015-02-27 06:41:06 +08:00
|
|
|
+ // CraftBukkit end
|
2014-12-06 07:10:47 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|