legacy formatting will be the death of me

Dieser Commit ist enthalten in:
Riley Park 2021-03-09 10:03:27 -08:00
Ursprung f597fea0de
Commit 2dcf8bff4f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: D831AF236C834E45
11 geänderte Dateien mit 56 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..a2acd31dce4461338a8baa96e03df36a
+}
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
new file mode 100644
index 0000000000000000000000000000000000000000..f5a24b82b902498bb52eeb11fa351391b3adb31e
index 0000000000000000000000000000000000000000..8767c84e6417888cacf1ed76c7e3def73f873d70
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -0,0 +1,218 @@
@ -216,7 +216,7 @@ index 0000000000000000000000000000000000000000..f5a24b82b902498bb52eeb11fa351391
+ }
+
+ private static String legacyDisplayName(final CraftPlayer player) {
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(Component.empty().append(displayName(player)));
+ return player.getDisplayName();
+ }
+
+ private static Component displayName(final CraftPlayer player) {
@ -328,6 +328,34 @@ index 0000000000000000000000000000000000000000..f5a24b82b902498bb52eeb11fa351391
+ return handlers.getRegisteredListeners().length > 0;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/adventure/DisplayNames.java b/src/main/java/io/papermc/paper/adventure/DisplayNames.java
new file mode 100644
index 0000000000000000000000000000000000000000..48eedc4e7804d9d6986745ec8028f579701a2736
--- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/DisplayNames.java
@@ -0,0 +1,22 @@
+package io.papermc.paper.adventure;
+
+import net.minecraft.server.EntityPlayer;
+import org.bukkit.ChatColor;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+
+public final class DisplayNames {
+ private DisplayNames() {
+ }
+
+ public static String getLegacy(final CraftPlayer player) {
+ return getLegacy(player.getHandle());
+ }
+
+ public static String getLegacy(final EntityPlayer player) {
+ final String legacy = player.displayName;
+ if (legacy != null) {
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(player.adventure$displayName) + ChatColor.getLastColors(player.displayName);
+ }
+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(player.adventure$displayName);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java b/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java
new file mode 100644
index 0000000000000000000000000000000000000000..64fcc77eb2ce8979ae756696d98f1d3a91326ba6
@ -2038,14 +2066,14 @@ index 3ea267a786f8f047767cace4dc59951b28a615a6..19cdff6eebb7c07d75b515dfa0d47bb7
player.activeContainer.addSlotListener(player);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4bfdd900bae4c886360b24fcc8563e1d2e73ebf0..9963de00a8143050d423bd45a7e2b92a441e6083 100644
index 4bfdd900bae4c886360b24fcc8563e1d2e73ebf0..f5520a793cd1d2d56f8c890b74ef50cea61e30f3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -240,14 +240,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public String getDisplayName() {
+ if(true) return io.papermc.paper.adventure.PaperAdventure.superHackyLegacyRepresentationOfComponent(this.getHandle().adventure$displayName, this.getHandle().displayName); // Paper
+ if(true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper
return getHandle().displayName;
}
@ -2223,7 +2251,7 @@ index 4bfdd900bae4c886360b24fcc8563e1d2e73ebf0..9963de00a8143050d423bd45a7e2b92a
@Override
public String getLocale() {
return getHandle().locale;
@@ -1711,6 +1787,137 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1711,6 +1787,138 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getInventory().setItemInMainHand(hand);
}
@ -2236,6 +2264,7 @@ index 4bfdd900bae4c886360b24fcc8563e1d2e73ebf0..9963de00a8143050d423bd45a7e2b92a
+ @Override
+ public void displayName(final net.kyori.adventure.text.Component displayName) {
+ this.getHandle().adventure$displayName = displayName != null ? displayName : net.kyori.adventure.text.Component.text(this.getName());
+ this.getHandle().displayName = null;
+ }
+
+ @Override

Datei anzeigen

@ -64,7 +64,7 @@ index 772ca6256964692a2b9c12e2edc532d2a8f51f7b..71168d9d0252e93253fa3b3f0bface3a
// Paper end
packetdataserializer.a(this.b);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 41bb934dda000cf3abd062dfcd12eea73afb86e5..02805bada2ca3e587dc45592ce4f4eafd57e0e8b 100644
index 2e7e2ed1bb7d42a6ac26a6da965ed4eed9c8b554..efc8f23b43f9b9765b3c49f9dde9fdbe64291cd4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,6 @@
@ -170,4 +170,4 @@ index 41bb934dda000cf3abd062dfcd12eea73afb86e5..02805bada2ca3e587dc45592ce4f4eaf
+
@Override
public String getDisplayName() {
if(true) return io.papermc.paper.adventure.PaperAdventure.superHackyLegacyRepresentationOfComponent(this.getHandle().adventure$displayName, this.getHandle().displayName); // Paper
if(true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper

Datei anzeigen

@ -17,10 +17,10 @@ index 67e14b606f9eb83e111e76665bd1228034193513..d9eaa6ed3408d377218d64d75e97c2ed
return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index df5c75aaeb1aef7cbed9e4b500a2a9a1632e049f..47e6986f1f3b1366cbabb76d16491bc4bba04b36 100644
index 778bbaf03d050271c7b97c2dc72ee57d46600e0d..794235ef374e1f035220d8485f5a937e3e9ff72c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2180,6 +2180,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2181,6 +2181,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.sendPacket(new net.minecraft.server.PacketPlayOutOpenBook(net.minecraft.server.EnumHand.MAIN_HAND));
connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand()));
}

Datei anzeigen

@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 78b6860a9b786a9ca74e76f1e550b43be369e699..719e2ce08e780e9d6e2bbfe0e5b1b9d5be5c3e53 100644
index 9666192e7e5a25e482af9c575300239fcc5b8a19..fffe522058144da31149e59a06263914865983ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2225,6 +2225,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2226,6 +2226,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() {
getHandle().resetAttackCooldown();
}

Datei anzeigen

@ -7,7 +7,7 @@ I hope to look at this more in-depth soon. It appears doable.
However this should not block the update.
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 6bd55433fafcfd8079b8e7b1ce6b65daa13b83c1..144ad80520487749a212c0b2c030386af53af14e 100644
index 90a3d3711f71209b7db89d2515377ed1818c3c83..a545a620486c7ffd9a15d903270a5091e1cacb97 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -576,9 +576,10 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
@ -40,10 +40,10 @@ index ad5a7cbe83fb61b79203369895e82edca2ffcb72..06cf8ca80c314b7c236984c7f6236533
double deltaZ = this.locZ() - player.locZ();
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 719e2ce08e780e9d6e2bbfe0e5b1b9d5be5c3e53..cdfc22f7a5c5e18178c7eeb0c3a799ce3981c4f4 100644
index fffe522058144da31149e59a06263914865983ec..24cdf63dfdc222edb9677dbf62f1761a138b2a83 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2234,6 +2234,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2235,6 +2235,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
super.remove();
}
}

Datei anzeigen

@ -149,7 +149,7 @@ index dbc3552d50c4129e1844c8a379ab5ba396645f52..87ec3987d4b6de836016e91ef90383e3
return this.e;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index cdfc22f7a5c5e18178c7eeb0c3a799ce3981c4f4..29d0ce54fdc94353e3b2280f1c7cf97a766f31bf 100644
index 24cdf63dfdc222edb9677dbf62f1761a138b2a83..890b5c4ee2a1313d75cf069d660de62af81badcf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,8 @@
@ -161,7 +161,7 @@ index cdfc22f7a5c5e18178c7eeb0c3a799ce3981c4f4..29d0ce54fdc94353e3b2280f1c7cf97a
import com.destroystokyo.paper.Title;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
@@ -2244,6 +2247,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2245,6 +2248,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setViewDistance(int viewDistance) {
throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
}

Datei anzeigen

@ -65,10 +65,10 @@ index 01e18079989043c2c8c49ef1dba254122617261d..50fef192bec41070c5dd89ffbc131012
return (!this.player.joining && !this.networkManager.isConnected()) || this.processedDisconnect; // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index edae6ed7c80883e4c27c09d9dd3dcc2f93676390..ca8e6bfa3d472b5eef6ba9aca749a207e02f71c7 100644
index 879164beabd7fecd2c737f6edc6b1c03f655ea81..105572b2847207e83580808bba3b5abf6960d049 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2377,6 +2377,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2378,6 +2378,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Brand support
TODO(Proximyst): Fixup this into the other brand support patch
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ca8e6bfa3d472b5eef6ba9aca749a207e02f71c7..5dbe8b797ae11fb2d6dfd5e66a1d17d307bec978 100644
index 105572b2847207e83580808bba3b5abf6960d049..31aad6440e23ef3bbef90418923747a71709854c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2380,7 +2380,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2381,7 +2381,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper start - brand support
@Override
public String getClientBrandName() {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5dbe8b797ae11fb2d6dfd5e66a1d17d307bec978..5cfccc27daa758f36e14fd6526a0ab6532a20aa6 100644
index 31aad6440e23ef3bbef90418923747a71709854c..f166f23381d892e7ddda439d52243b7a9c5d09e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2273,6 +2273,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2274,6 +2274,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
throw new RuntimeException("Unknown settings type");
}

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index fbe2b2b3f96232d86efa1bc02c780ec7cc54aa9b..568b404e85e6f96cc025ff48bbc9f466c036b841 100644
index 32b9ef6d418e1d897855ab95840cec542bffd8aa..cf92f63d82bd43a1511ab77bf7adbbc03b4e3b84 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1054,6 +1054,11 @@ public abstract class PlayerList {
@ -32,10 +32,10 @@ index fbe2b2b3f96232d86efa1bc02c780ec7cc54aa9b..568b404e85e6f96cc025ff48bbc9f466
// Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 08448756b48db78bb5693995be8806ca43763f2e..a9c1a4ef45f4e85202c8d31c6b7cca58f2aa0df6 100644
index 00ea7d9d946a70399d8ddb3b7ebfab42d0fab88c..756009d20b23b2e5c51e72e61348bd60d93a7c11 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2287,6 +2287,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2288,6 +2288,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
? (org.bukkit.entity.Firework) entity.getBukkitEntity()
: null;
}

Datei anzeigen

@ -18,7 +18,7 @@ index d8787985ab4c94e9808332c15b3d16d4b52ba195..e87e1b04e13593f1efa4d1c59cb9e433
Throwable addedToWorldStack; // Paper - entity debug
public CraftEntity getBukkitEntity() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4b214783ad4fabf5c2dc4c6c45635dc6e75f2113..fc761a3bd87004f16ff9b0a3b0add52f7938f566 100644
index 756009d20b23b2e5c51e72e61348bd60d93a7c11..f965b071cd2f6a70a216679e4f19956115edee4f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -16,6 +16,7 @@ import java.net.InetSocketAddress;
@ -29,7 +29,7 @@ index 4b214783ad4fabf5c2dc4c6c45635dc6e75f2113..fc761a3bd87004f16ff9b0a3b0add52f
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -2296,6 +2297,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2297,6 +2298,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end