3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00

Explictly reset chat format in vanilla scoreboard display (fixes #1263)

Vanilla now uses chat components for scoreboards, thus no longer
returns a string which also resets the chat the chat format, add
this back ourselves.
Dieser Commit ist enthalten in:
Shane Freeder 2018-07-25 09:58:03 +01:00
Ursprung ee9416b07d
Commit 23ed74032c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F61EA5A085289C
8 geänderte Dateien mit 31 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 57e306afd1db9d7a08c55f911df40939787d3a7a Mon Sep 17 00:00:00 2001
From bdbe4b6446ba17c498e8264ffa94016fab151b25 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 6 Apr 2016 01:04:23 -0500
Subject: [PATCH] Option to use vanilla per-world scoreboard coloring on names
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 667a0dde8..b6ef1d437 100644
index 667a0dde8c..b6ef1d4378 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -239,4 +239,9 @@ public class PaperWorldConfig {
@ -19,7 +19,7 @@ index 667a0dde8..b6ef1d437 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index a465f1cf7..76934f81a 100644
index a465f1cf79..76934f81a8 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2270,6 +2270,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -31,10 +31,10 @@ index a465f1cf7..76934f81a 100644
public ScoreboardTeamBase be() {
if (!this.world.paperConfig.nonPlayerEntitiesOnScoreboards && !(this instanceof EntityHuman)) { return null; } // Paper
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 90ab7f065..8902e3db0 100644
index 90ab7f065f..1ca3c87c7a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1622,7 +1622,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1622,7 +1622,15 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
return;
}
@ -42,7 +42,8 @@ index 90ab7f065..8902e3db0 100644
+ // Paper Start - (Meh) Support for vanilla world scoreboard name coloring
+ String displayName = event.getPlayer().getDisplayName();
+ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) {
+ displayName = CraftChatMessage.fromComponent(ScoreboardTeam.a(this.player.getTeam(),((CraftPlayer) player).getHandle().getDisplayName()));
+ // Explicitly add a RESET here, vanilla uses components for this now...
+ displayName = CraftChatMessage.fromComponent(ScoreboardTeam.a(this.player.getTeam(),((CraftPlayer) player).getHandle().getDisplayName())) + org.bukkit.ChatColor.RESET;
+ }
+
+ s = String.format(event.getFormat(), displayName, event.getMessage());

Datei anzeigen

@ -1,14 +1,14 @@
From 5b34a9ea3ba3c3732c57d3ff3703e608c4eef485 Mon Sep 17 00:00:00 2001
From ee51f2d2b90389e0e916203dcbb96bf63d83d8b0 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Sun, 4 Sep 2016 16:35:43 -0500
Subject: [PATCH] Fix AIOOBE in inventory handling
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index fc33baf2bf..9ec898d164 100644
index 0fe8d1c3f1..ed02cd7a7a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2085,7 +2085,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2086,7 +2086,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
case CLONE:
if (packetplayinwindowclick.d() == 2) {
click = ClickType.MIDDLE;

Datei anzeigen

@ -1,4 +1,4 @@
From 5f881637843edb83974634b9c7ed501943135071 Mon Sep 17 00:00:00 2001
From 99549bbd0a129084cb529b8d7d5aa1b2cca756c8 Mon Sep 17 00:00:00 2001
From: Alfie Cleveland <alfeh@me.com>
Date: Tue, 27 Dec 2016 01:57:57 +0000
Subject: [PATCH] Properly fix item duplication bug
@ -19,10 +19,10 @@ index 4bde378afb..7059fc1187 100644
@Override
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index fc4e927d67..9ac86f7af2 100644
index 969e28c3b2..3885c8628c 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2504,7 +2504,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2505,7 +2505,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
public final boolean isDisconnected() {

Datei anzeigen

@ -1,4 +1,4 @@
From 0341dbda511917a87f7fbdb2bbab37c277495bd9 Mon Sep 17 00:00:00 2001
From 9578efb4818e086eadd5b51ea7d33f5d2fb0afbf Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 16 May 2017 21:29:08 -0500
Subject: [PATCH] Add option to make parrots stay on shoulders despite movement
@ -11,7 +11,7 @@ I suspect Mojang may switch to this behavior before full release.
To be converted into a Paper-API event at some point in the future?
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4991138df..87c599338 100644
index 4991138dfe..87c599338a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -350,4 +350,10 @@ public class PaperWorldConfig {
@ -26,7 +26,7 @@ index 4991138df..87c599338 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 06b663c4d..42c624953 100644
index 06b663c4db..42c6249535 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -460,7 +460,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -39,10 +39,10 @@ index 06b663c4d..42c624953 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 3bcca32ba..355d61704 100644
index 08ef17dfe1..d4701d8d56 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1746,6 +1746,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1747,6 +1747,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
switch (packetplayinentityaction.c()) {
case START_SNEAKING:
this.player.setSneaking(true);

Datei anzeigen

@ -1,4 +1,4 @@
From 08d88bf479bfa513a4a5dcf0cab8bf6a13aac406 Mon Sep 17 00:00:00 2001
From f2b3ec9db7d748b5dc17a7e00a91145efbb5fd0b Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 5 Oct 2017 01:54:07 +0100
Subject: [PATCH] handle PacketPlayInKeepAlive async
@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 7465c548af..add29081d2 100644
index c1dd2db89d..e8f1883c98 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2470,14 +2470,18 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2471,14 +2471,18 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {

Datei anzeigen

@ -1,14 +1,14 @@
From 2070c1fd61c833fbafdb40b67a7d66b915039469 Mon Sep 17 00:00:00 2001
From be2b54d1a53f9197e5864aaebfca7b9bd94b8c3d Mon Sep 17 00:00:00 2001
From: 0x22 <0x22@futureclient.net>
Date: Thu, 26 Apr 2018 04:41:11 -0400
Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 5778bf1c65..5ee25d70fc 100644
index 90ac83b5b1..7bf99cae1b 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2503,7 +2503,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2504,7 +2504,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
String[] lines = new String[4];
for (int i = 0; i < astring.length; ++i) {

Datei anzeigen

@ -1,4 +1,4 @@
From a42d1a506c7a0658bd9e8fd7882b411bef7a6225 Mon Sep 17 00:00:00 2001
From 0afba65cf3655e8488aed1e76126c9ac4fe87b90 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 3 Jul 2018 21:56:23 -0400
Subject: [PATCH] InventoryCloseEvent Reason API
@ -110,10 +110,10 @@ index 7059fc1187..0c01f8dafa 100644
this.m();
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 5ee25d70fc..fc47738ec5 100644
index 7bf99cae1b..5ffc4fccd0 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2039,7 +2039,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -2040,7 +2040,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
if (this.player.isFrozen()) return; // CraftBukkit
@ -155,7 +155,7 @@ index 4b9ecb4a62..b602a5d1b9 100644
public boolean isBlocking() {
return getHandle().isBlocking();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ab9956fa24..0f3e1d5ae1 100644
index 8c1e497592..a10a78994f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -687,7 +687,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -1,4 +1,4 @@
From 6a99734646c6f697a4ef06e6b0822d3befbcfa53 Mon Sep 17 00:00:00 2001
From 856d2898d092f8955c5403ef95c88dcfa07e8d28 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Fri, 13 Jul 2018 14:54:43 +0200
Subject: [PATCH] Refresh player inventory when cancelling
@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is
cancelled to avoid this problem.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index fc47738ec5..6950f8a729 100644
index 5ffc4fccd0..a405cc0a2a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1953,6 +1953,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@@ -1954,6 +1954,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
}
if (event.isCancelled()) {