From 99f3ad5f03ee82430302166778c44c2ea2a28c0e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 17 Dec 2023 19:52:50 +0100 Subject: [PATCH] Add TpCommand tabcompletions for Teamserver players not joining from SteamWar Fix Tablist color for Teamserver players not joining from SteamWar --- src/de/steamwar/bungeecore/commands/TpCommand.java | 9 ++++++++- src/de/steamwar/bungeecore/tablist/Tablist.java | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index 19493e31..8dff6f3f 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.tablist.TablistManager; import de.steamwar.sql.*; import de.steamwar.bungeecore.util.BauLock; import de.steamwar.bungeecore.util.Chat19; @@ -34,6 +35,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.List; public class TpCommand extends SWCommand { @@ -65,7 +67,7 @@ public class TpCommand extends SWCommand { } @Mapper("to") - @Cached(cacheDuration = 10, global = true) + @Cached(cacheDuration = 10) public TypeMapper tabCompleter() { return new TypeMapper() { @Override @@ -86,6 +88,11 @@ public class TpCommand extends SWCommand { list.add(team.getTeamKuerzel()); }); } + if (Storage.teamServers.containsValue(((ProxiedPlayer) sender).getServer().getInfo())) { + Storage.directTabItems.getOrDefault((ProxiedPlayer) sender, new HashMap<>()).forEach((uuid, item) -> { + list.add(item.getUsername()); + }); + } return list; } }; diff --git a/src/de/steamwar/bungeecore/tablist/Tablist.java b/src/de/steamwar/bungeecore/tablist/Tablist.java index a9a088f3..bfe35b24 100644 --- a/src/de/steamwar/bungeecore/tablist/Tablist.java +++ b/src/de/steamwar/bungeecore/tablist/Tablist.java @@ -218,7 +218,7 @@ public class Tablist extends MessageToMessageDecoder { item.setDisplayName(new TextComponent()); item.setListed(false); } else if (item.getDisplayName() == null) { - item.setDisplayName(new TextComponent(item.getUsername())); + item.setDisplayName(new TextComponent("§7" + item.getUsername())); } item.setPublicKey(null); if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3) @@ -273,7 +273,7 @@ public class Tablist extends MessageToMessageDecoder { item.setDisplayName(new TextComponent()); item.setListed(false); } else if (item.getDisplayName() == null) { - item.setDisplayName(new TextComponent(item.getUsername())); + item.setDisplayName(new TextComponent("§7" + item.getUsername())); } item.setPublicKey(null); if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)