Paper/Spigot-Server-Patches/0089-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch
Spottedleaf 5c7081fecc Update upstream & fix some chunk related issues (#2177)
* 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 inventories
e8c08362 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
2019-06-14 03:27:40 +01:00

66 lines
3.6 KiB
Diff

From e395de729b0e3ffe6f736f52ce0f2a342c0065c4 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
This change is basically a bandaid to fix CB's complete and utter lack
of support for vanilla scoreboard name modifications.
In the future, finding a way to merge the vanilla expectations in with
bukkit's concept of a display name would be preferable. There was a PR
for this on CB at one point but I can't find it. We may need to do this
ourselves 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 59d11e68c9..1da7ffab5d 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -250,4 +250,9 @@ public class PaperWorldConfig {
grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
log("Grass Spread Tick Rate: " + grassUpdateRate);
}
+
+ public boolean useVanillaScoreboardColoring;
+ private void useVanillaScoreboardColoring() {
+ useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 545e18b8f3..e88abe1d05 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1660,7 +1660,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
return;
}
- s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
+ // Paper Start - (Meh) Support for vanilla world scoreboard name coloring
+ String displayName = event.getPlayer().getDisplayName();
+ if (this.player.getWorld().paperConfig.useVanillaScoreboardColoring) {
+ IChatBaseComponent nameFromTeam = ScoreboardTeam.a(this.player.getScoreboardTeam(),((CraftPlayer) player).getHandle().getDisplayName());
+ // Explicitly add a RESET here, vanilla uses components for this now...
+ displayName = CraftChatMessage.fromComponent(nameFromTeam, EnumChatFormat.WHITE) + org.bukkit.ChatColor.RESET;
+ }
+
+ s = String.format(event.getFormat(), displayName, event.getMessage());
+ // Paper end
minecraftServer.console.sendMessage(s);
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 66f4691918..779117b5db 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -177,7 +177,7 @@ public abstract class PlayerList {
}
// CraftBukkit start
chatmessage.a(EnumChatFormat.YELLOW);
- String joinMessage = CraftChatMessage.fromComponent(chatmessage);
+ String joinMessage = CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE);
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.players.add(entityplayer);
--
2.21.0