mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 17:31:06 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
93 lines
4.1 KiB
Diff
93 lines
4.1 KiB
Diff
From 3e832e2ec71012418fe60b3ac89a973ce8f174b6 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach@zachbr.io>
|
|
Date: Tue, 23 Oct 2018 20:53:43 -0400
|
|
Subject: [PATCH] Strip private area unicode characters from signs
|
|
|
|
It is not immediately clear how these characters ended up on signs in
|
|
previous versions. It is clear, however, that they now render as empty
|
|
unicode boxes in 1.13, whereas previously they rendered as invisible
|
|
characters.
|
|
|
|
When these signs are loaded in versions after this commit, these
|
|
characters from the private use area of the Unicode block will be
|
|
stripped. The sign will then be marked to ensure this conversion only
|
|
runs once.
|
|
|
|
There is a flag -DPaper.keepInvalidUnicode=true that can be used if you
|
|
do not want us to strip these characters from your signs, though I can
|
|
think of no reason to use it.
|
|
|
|
Fixes GH-1571
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
|
|
index 2c6ce5bae0..15b3add9ed 100644
|
|
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
|
|
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
|
|
@@ -14,6 +14,11 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
|
private final String[] k = new String[4];
|
|
private EnumColor color;
|
|
|
|
+ // Paper start - Strip invalid unicode from signs on load
|
|
+ private static final boolean keepInvalidUnicode = Boolean.getBoolean("Paper.keepInvalidUnicode"); // Allow people to keep their bad unicode if they really want it
|
|
+ private boolean privateUnicodeRemoved = false;
|
|
+ // Paper end
|
|
+
|
|
public TileEntitySign() {
|
|
super(TileEntityTypes.SIGN);
|
|
this.color = EnumColor.BLACK;
|
|
@@ -36,6 +41,12 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
|
// CraftBukkit end
|
|
|
|
nbttagcompound.setString("Color", this.color.b());
|
|
+ // Paper start - Only remove private area unicode once // TODO - this doesn't need to run for every sign, check data ver
|
|
+ if (this.privateUnicodeRemoved) {
|
|
+ nbttagcompound.setBoolean("Paper.RemovedPrivateUnicode", true);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
return nbttagcompound;
|
|
}
|
|
|
|
@@ -45,6 +56,11 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
|
super.load(nbttagcompound);
|
|
this.color = EnumColor.a(nbttagcompound.getString("Color"), EnumColor.BLACK);
|
|
|
|
+ // Paper start - Keep track, only do it once per sign
|
|
+ this.privateUnicodeRemoved = nbttagcompound.getBoolean("Paper.RemovedPrivateUnicode");
|
|
+ boolean ranUnicodeRemoval = false;
|
|
+ // Paper end
|
|
+
|
|
// 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
|
|
@@ -57,6 +73,19 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
|
s = "\"\"";
|
|
}
|
|
|
|
+ // Paper start - Strip private use area unicode from signs
|
|
+ if (s != null && !keepInvalidUnicode && !this.privateUnicodeRemoved) {
|
|
+ StringBuilder builder = new StringBuilder();
|
|
+ for (char character : s.toCharArray()) {
|
|
+ if (Character.UnicodeBlock.of(character) != Character.UnicodeBlock.PRIVATE_USE_AREA) {
|
|
+ builder.append(character);
|
|
+ }
|
|
+ }
|
|
+ s = builder.toString();
|
|
+ ranUnicodeRemoval = true;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
try {
|
|
//IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error
|
|
|
|
@@ -83,6 +112,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
|
this.k[i] = null;
|
|
}
|
|
|
|
+ if (ranUnicodeRemoval) this.privateUnicodeRemoved = true; // Paper - Flag to write NBT
|
|
}
|
|
|
|
public void a(int i, IChatBaseComponent ichatbasecomponent) {
|
|
--
|
|
2.21.0
|
|
|