Archiviert
1
0

Add TpCommand tabcompletions for Teamserver players not joining from SteamWar

Fix Tablist color for Teamserver players not joining from SteamWar
Dieser Commit ist enthalten in:
yoyosource 2023-12-17 19:52:50 +01:00
Ursprung 3d67919f0a
Commit 99f3ad5f03
2 geänderte Dateien mit 10 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.tablist.TablistManager;
import de.steamwar.sql.*; import de.steamwar.sql.*;
import de.steamwar.bungeecore.util.BauLock; import de.steamwar.bungeecore.util.BauLock;
import de.steamwar.bungeecore.util.Chat19; 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.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
public class TpCommand extends SWCommand { public class TpCommand extends SWCommand {
@ -65,7 +67,7 @@ public class TpCommand extends SWCommand {
} }
@Mapper("to") @Mapper("to")
@Cached(cacheDuration = 10, global = true) @Cached(cacheDuration = 10)
public TypeMapper<String> tabCompleter() { public TypeMapper<String> tabCompleter() {
return new TypeMapper<String>() { return new TypeMapper<String>() {
@Override @Override
@ -86,6 +88,11 @@ public class TpCommand extends SWCommand {
list.add(team.getTeamKuerzel()); 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; return list;
} }
}; };

Datei anzeigen

@ -218,7 +218,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
item.setDisplayName(new TextComponent()); item.setDisplayName(new TextComponent());
item.setListed(false); item.setListed(false);
} else if (item.getDisplayName() == null) { } else if (item.getDisplayName() == null) {
item.setDisplayName(new TextComponent(item.getUsername())); item.setDisplayName(new TextComponent("§7" + item.getUsername()));
} }
item.setPublicKey(null); item.setPublicKey(null);
if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3) if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)
@ -273,7 +273,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
item.setDisplayName(new TextComponent()); item.setDisplayName(new TextComponent());
item.setListed(false); item.setListed(false);
} else if (item.getDisplayName() == null) { } else if (item.getDisplayName() == null) {
item.setDisplayName(new TextComponent(item.getUsername())); item.setDisplayName(new TextComponent("§7" + item.getUsername()));
} }
item.setPublicKey(null); item.setPublicKey(null);
if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3) if(!player.getUniqueId().equals(item.getUuid()) && item.getGamemode() == 3)