geforkt von SteamWar/BungeeCore
Star fixes, whois ID based only ADMINISTRATION, Prefix
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
792bbd610d
Commit
0df03a7dfb
@ -48,28 +48,33 @@ public class WhoisCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(description = "WHOIS_USAGE")
|
@Register(description = "WHOIS_USAGE")
|
||||||
public void genericCommand(ProxiedPlayer player, @Mapper("player") String target, WhoisParameterTypes... parameters) {
|
public void genericCommand(ProxiedPlayer player, @Mapper("player") String target, WhoisParameterTypes... parameters) {
|
||||||
|
ChatSender sender = ChatSender.of(player);
|
||||||
SteamwarUser user = SteamwarUser.get(target);
|
SteamwarUser user = SteamwarUser.get(target);
|
||||||
if (user == null) {
|
if (sender.user().hasPerm(UserPerm.ADMINISTRATION)) {
|
||||||
try {
|
if (user == null) {
|
||||||
int id = Integer.parseInt(target);
|
try {
|
||||||
user = SteamwarUser.get(id);
|
int id = Integer.parseInt(target);
|
||||||
} catch (NumberFormatException ignored) {
|
user = SteamwarUser.get(id);
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
// Ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
try {
|
try {
|
||||||
long id = Long.parseLong(target);
|
long id = Long.parseLong(target);
|
||||||
user = SteamwarUser.get(id);
|
user = SteamwarUser.get(id);
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
// Ignored
|
// Ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
Message.send("UNKNOWN_PLAYER", player);
|
sender.system("UNKNOWN_PLAYER");
|
||||||
} else {
|
} else {
|
||||||
EnumSet<WhoisParameterTypes> set = parameters.length == 0 ? EnumSet.noneOf(WhoisParameterTypes.class) : EnumSet.copyOf(Arrays.asList(parameters));
|
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()));
|
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) {
|
private static void sendUserinfo(ChatSender sender, SteamwarUser user, EnumSet<WhoisParameterTypes> parameterTypes) {
|
||||||
ChatSender sender = ChatSender.of(player);
|
|
||||||
Team team = Team.get(user.getTeam());
|
Team team = Team.get(user.getTeam());
|
||||||
|
|
||||||
sender.system("WHOIS_USERNAME", user.getUserName());
|
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());
|
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))
|
if (!sender.user().hasPerm(UserPerm.TEAM))
|
||||||
|
@ -380,7 +380,7 @@ TUTORIAL_NAME=§e{0}
|
|||||||
TUTORIAL_BY=§8von §7{0}
|
TUTORIAL_BY=§8von §7{0}
|
||||||
TUTORIAL_STARS=§e{0} §7Stars
|
TUTORIAL_STARS=§e{0} §7Stars
|
||||||
TUTORIAL_RATE_TITLE=Rate tutorial
|
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_DELETE=§cDelete with Shift+Right-Click
|
||||||
TUTORIAL_CREATE_HELP=§8/§7tutorial create §8[§ematerial§8] §8[§ename§8]
|
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!
|
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
|
#WhoisCommand
|
||||||
WHOIS_USAGE=§c/whois [player/ID] [-a/-m]
|
WHOIS_USAGE=§c/whois [player/ID] [-a/-m]
|
||||||
WHOIS_USERNAME=§7Username§8: §e{0}
|
WHOIS_USERNAME=§7Username§8: §e{0}
|
||||||
|
WHOIS_PREFIX=§7Chat-Prefix§8: {0}
|
||||||
WHOIS_UUID=§7UUID§8: §e{0}
|
WHOIS_UUID=§7UUID§8: §e{0}
|
||||||
WHOIS_UUID_HOVER=§eCopy UUID
|
WHOIS_UUID_HOVER=§eCopy UUID
|
||||||
WHOIS_ID=§7ID§8: §e{0}
|
WHOIS_ID=§7ID§8: §e{0}
|
||||||
|
@ -576,6 +576,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
|
|||||||
#WhoisCommand
|
#WhoisCommand
|
||||||
WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m]
|
WHOIS_USAGE=§c/whois [Spieler/ID] [-a/-m]
|
||||||
WHOIS_USERNAME=§7Username§8: §e{0}
|
WHOIS_USERNAME=§7Username§8: §e{0}
|
||||||
|
WHOIS_PREFIX=§7Chat-Präfix§8: {0}
|
||||||
WHOIS_PERMS=§7Rechte§8: §7{0}
|
WHOIS_PERMS=§7Rechte§8: §7{0}
|
||||||
WHOIS_UUID=§7UUID§8: §e{0}
|
WHOIS_UUID=§7UUID§8: §e{0}
|
||||||
WHOIS_UUID_HOVER=§eUUID Kopieren
|
WHOIS_UUID_HOVER=§eUUID Kopieren
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren