Archiviert
1
0

Star fixes, whois ID based only ADMINISTRATION, Prefix

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-11-29 17:20:19 +01:00
Ursprung 792bbd610d
Commit 0df03a7dfb
3 geänderte Dateien mit 24 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -48,28 +48,33 @@ public class WhoisCommand extends SWCommand {
@Register(description = "WHOIS_USAGE")
public void genericCommand(ProxiedPlayer player, @Mapper("player") String target, WhoisParameterTypes... parameters) {
ChatSender sender = ChatSender.of(player);
SteamwarUser user = SteamwarUser.get(target);
if (user == null) {
try {
int id = Integer.parseInt(target);
user = SteamwarUser.get(id);
} catch (NumberFormatException ignored) {
if (sender.user().hasPerm(UserPerm.ADMINISTRATION)) {
if (user == null) {
try {
int id = Integer.parseInt(target);
user = SteamwarUser.get(id);
} catch (NumberFormatException ignored) {
// Ignored
}
}
}
if (user == null) {
try {
long id = Long.parseLong(target);
user = SteamwarUser.get(id);
} catch (NumberFormatException ignored) {
// Ignored
if (user == null) {
try {
long id = Long.parseLong(target);
user = SteamwarUser.get(id);
} catch (NumberFormatException ignored) {
// Ignored
}
}
}
if (user == null) {
Message.send("UNKNOWN_PLAYER", player);
sender.system("UNKNOWN_PLAYER");
} else {
EnumSet<WhoisParameterTypes> set = parameters.length == 0 ? EnumSet.noneOf(WhoisParameterTypes.class) : EnumSet.copyOf(Arrays.asList(parameters));
sendUserinfo(player, user, set);
sendUserinfo(sender, user, set);
}
}
@ -78,11 +83,11 @@ public class WhoisCommand extends SWCommand {
return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()));
}
private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
ChatSender sender = ChatSender.of(player);
private static void sendUserinfo(ChatSender sender, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
Team team = Team.get(user.getTeam());
sender.system("WHOIS_USERNAME", user.getUserName());
sender.system("WHOIS_PREFIX", user.prefix().getChatPrefix());
sender.system("WHOIS_TEAM", new Message("WHOIS_TEAM_HOVER", team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName());
if (!sender.user().hasPerm(UserPerm.TEAM))

Datei anzeigen

@ -380,7 +380,7 @@ TUTORIAL_NAME=§e{0}
TUTORIAL_BY=§8von §7{0}
TUTORIAL_STARS=§e{0} §7Stars
TUTORIAL_RATE_TITLE=Rate tutorial
TUTORIAL_RATE=§e{0} §7Star(e)
TUTORIAL_RATE=§e{0} §7Star(s)
TUTORIAL_DELETE=§cDelete with Shift+Right-Click
TUTORIAL_CREATE_HELP=§8/§7tutorial create §8[§ematerial§8] §8[§ename§8]
TUTORIAL_CREATE_MISSING=§cA tutorial can only be created on a tutorial server!
@ -598,6 +598,7 @@ SERVER_WORLD_ERROR=§cCreating the world failed.
#WhoisCommand
WHOIS_USAGE=§c/whois [player/ID] [-a/-m]
WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_PREFIX=§7Chat-Prefix§8: {0}
WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eCopy UUID
WHOIS_ID=§7ID§8: §e{0}

Datei anzeigen

@ -576,6 +576,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
#WhoisCommand
WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m]
WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_PREFIX=§7Chat-Präfix§8: {0}
WHOIS_PERMS=§7Rechte§8: §7{0}
WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eUUID Kopieren