2018-12-13 01:40:29 +01:00
|
|
|
From 77c47f231d1a936f15d3dc8863d9e3362d0ca76d Mon Sep 17 00:00:00 2001
|
2018-07-15 03:53:17 +02:00
|
|
|
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
|
|
|
|
|
2018-11-25 18:16:01 +01:00
|
|
|
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.
|
2018-07-15 03:53:17 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2018-12-13 01:40:29 +01:00
|
|
|
index 276dd98fd..973ea8bca 100644
|
2018-07-15 03:53:17 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2018-12-13 01:40:29 +01:00
|
|
|
@@ -255,4 +255,9 @@ public class PaperWorldConfig {
|
2018-07-15 03:53:17 +02:00
|
|
|
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 8)) * 16);
|
|
|
|
log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16));
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean useVanillaScoreboardColoring;
|
|
|
|
+ private void useVanillaScoreboardColoring() {
|
|
|
|
+ useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2018-12-08 11:09:55 +01:00
|
|
|
index 734ee9d8e..e60e8e8fe 100644
|
2018-07-15 03:53:17 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2018-09-27 04:35:42 +02:00
|
|
|
@@ -2259,6 +2259,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2018-07-15 03:53:17 +02:00
|
|
|
return this.getFlag(5);
|
|
|
|
}
|
|
|
|
|
2018-07-16 22:08:09 +02:00
|
|
|
+ @Nullable public ScoreboardTeamBase getTeam() { return this.be(); } // Paper - OBFHELPER
|
2018-07-15 03:53:17 +02:00
|
|
|
@Nullable
|
|
|
|
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
|
2018-12-08 11:09:55 +01:00
|
|
|
index dc2c143c8..5c7a88ec8 100644
|
2018-07-15 03:53:17 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2018-12-08 11:09:55 +01:00
|
|
|
@@ -1631,7 +1631,16 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
2018-07-15 03:53:17 +02:00
|
|
|
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) {
|
2018-11-25 18:16:01 +01:00
|
|
|
+ IChatBaseComponent nameFromTeam = ScoreboardTeam.a(this.player.getTeam(),((CraftPlayer) player).getHandle().getDisplayName());
|
2018-07-25 10:58:03 +02:00
|
|
|
+ // Explicitly add a RESET here, vanilla uses components for this now...
|
2018-11-25 18:16:01 +01:00
|
|
|
+ displayName = CraftChatMessage.fromComponent(nameFromTeam, EnumChatFormat.WHITE) + org.bukkit.ChatColor.RESET;
|
2018-07-15 03:53:17 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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) {
|
2018-11-25 18:16:01 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2018-12-08 11:09:55 +01:00
|
|
|
index 8c10a0da1..2cb5869ae 100644
|
2018-11-25 18:16:01 +01:00
|
|
|
--- 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 {
|
|
|
|
}
|
|
|
|
|
|
|
|
chatmessage.a(EnumChatFormat.YELLOW);
|
|
|
|
- this.onPlayerJoin(entityplayer, CraftChatMessage.fromComponent(chatmessage));
|
|
|
|
+ this.onPlayerJoin(entityplayer, CraftChatMessage.fromComponent(chatmessage, EnumChatFormat.WHITE)); // Paper
|
|
|
|
// CraftBukkit end
|
|
|
|
worldserver = server.getWorldServer(entityplayer.dimension); // CraftBukkit - Update in case join event changed it
|
|
|
|
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
2018-07-15 03:53:17 +02:00
|
|
|
--
|
2018-12-13 01:40:29 +01:00
|
|
|
2.20.0
|
2018-07-15 03:53:17 +02:00
|
|
|
|