mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-17 17:31:06 +02:00
56 lines
2.9 KiB
Diff
56 lines
2.9 KiB
Diff
From 6f11a33876ceebf398760bcd2bb8915910975f6c 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 3a942c763..3bd29650c 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -290,4 +290,9 @@ public class PaperWorldConfig {
|
|
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
|
|
index 70a431a63..8908d8b8d 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -2046,6 +2046,7 @@ public abstract class Entity implements ICommandListener {
|
|
return this.getFlag(5);
|
|
}
|
|
|
|
+ @Nullable public ScoreboardTeamBase getTeam() { return this.aQ(); } // Paper - OBFHELPER
|
|
@Nullable
|
|
public ScoreboardTeamBase aQ() {
|
|
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 840448995..dfbae01f4 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1347,7 +1347,14 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
|
|
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) {
|
|
+ displayName = ScoreboardTeam.getPlayerDisplayName(this.player.getTeam(), player.getDisplayName());
|
|
+ }
|
|
+
|
|
+ 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) {
|
|
--
|
|
2.12.2
|
|
|