mirror of
https://github.com/BlazingGames/blazing-games-plugin.git
synced 2025-02-03 21:26:41 -05:00
show player display name in tablist
This commit is contained in:
parent
059e91a2e7
commit
1adc8bc3ba
3 changed files with 13 additions and 0 deletions
|
@ -143,5 +143,6 @@ public class DisplayCommand implements CommandExecutor, TabCompleter {
|
|||
.append(Component.text(config.buildNameString(player.getName(), player.isOp())).color(NamedTextColor.WHITE)));
|
||||
player.sendMessage(Component.text("- Current discord name (short): ").color(colorSuccess)
|
||||
.append(Component.text(config.buildNameStringShort(player.getName())).color(NamedTextColor.WHITE)));
|
||||
config.updatePlayer(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import de.blazemcworld.blazinggames.computing.api.BlazingAPI;
|
|||
import de.blazemcworld.blazinggames.discord.DiscordApp;
|
||||
import de.blazemcworld.blazinggames.discord.DiscordNotification;
|
||||
import de.blazemcworld.blazinggames.packs.ResourcePackManager.PackConfig;
|
||||
import de.blazemcworld.blazinggames.utils.PlayerConfig;
|
||||
import de.blazemcworld.blazinggames.items.recipes.CustomRecipes;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
|
@ -44,5 +45,8 @@ public class JoinEventListener implements Listener {
|
|||
true
|
||||
);
|
||||
}
|
||||
|
||||
PlayerConfig config = PlayerConfig.forPlayer(event.getPlayer().getUniqueId());
|
||||
config.updatePlayer(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package de.blazemcworld.blazinggames.utils;
|
|||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.blazemcworld.blazinggames.data.DataStorage;
|
||||
import de.blazemcworld.blazinggames.data.compression.GZipCompressionProvider;
|
||||
import de.blazemcworld.blazinggames.data.name.UUIDNameProvider;
|
||||
|
@ -51,6 +53,12 @@ public class PlayerConfig {
|
|||
|
||||
|
||||
|
||||
public void updatePlayer(Player player) {
|
||||
Component name = buildNameComponent(player.getName(), player.isOp());
|
||||
player.displayName(name);
|
||||
player.playerListName(name);
|
||||
}
|
||||
|
||||
public Component buildNameComponent(String playerName, boolean isOp) {
|
||||
Component username;
|
||||
if (getDisplayName() != null && !getDisplayName().equals(playerName)) {
|
||||
|
|
Loading…
Reference in a new issue