Archiviert
1
0

Merge pull request 'Add TpCommand tabcompletions for Teamserver players not joining from SteamWar' (#502) from TpAndTablist into master

Reviewed-on: SteamWar/BungeeCore#502
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2023-12-17 21:04:45 +01:00
Commit d22766fedd
2 geänderte Dateien mit 10 neuen und 6 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;
@ -32,9 +33,7 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList; import java.util.*;
import java.util.Collection;
import java.util.List;
public class TpCommand extends SWCommand { public class TpCommand extends SWCommand {
@ -65,7 +64,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 +85,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, Collections.emptyMap()).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(TextComponent.fromLegacy("§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(TextComponent.fromLegacy("§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)