2018-10-29 14:02:56 +01:00
|
|
|
From 5cc44c28c0d182313770f065b72b9800d49c497b 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
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2018-09-26 06:57:59 +02:00
|
|
|
index 6fe3c0ea8a..cf523a3e48 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-09-26 06:57:59 +02:00
|
|
|
@@ -250,4 +250,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-10-29 14:02:56 +01:00
|
|
|
index e44d8372d8..4c5dc39e3a 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-10-29 14:02:56 +01:00
|
|
|
index 085fa8cd49..66de10ada5 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-10-29 14:02:56 +01:00
|
|
|
@@ -1638,7 +1638,15 @@ 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-07-25 10:58:03 +02:00
|
|
|
+ // 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;
|
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-10-29 14:02:56 +01:00
|
|
|
2.19.1
|
2018-07-15 03:53:17 +02:00
|
|
|
|