Archiviert
1
0

Add current infos to Whois

Dieser Commit ist enthalten in:
Chaoscaot 2022-09-09 20:38:37 +02:00
Ursprung eee3dba1de
Commit d7530cae86
3 geänderte Dateien mit 23 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.Message; import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Storage;
import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.Punishment;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.Team;
@ -31,8 +32,10 @@ import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.net.InetSocketAddress;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.Instant;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -78,15 +81,24 @@ public class WhoisCommand extends SWCommand {
Message.send("WHOIS_USERNAME", player, user.getUserName()); Message.send("WHOIS_USERNAME", player, user.getUserName());
Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString()); Message.send("WHOIS_UUID", player, Message.parse("WHOIS_UUID_HOVER", player), new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, user.getUuid().toString()), user.getUuid().toString());
Message.send("WHOIS_ID", player, user.getId()); Message.send("WHOIS_ID", player, user.getId());
Message.send("WHOIS_GROUP", player, user.getUserGroup().getColorCode(), user.getUserGroup().name());
if (user.getDiscordId() != null) { if (user.getDiscordId() != null) {
Message.send("WHOIS_DISCORD_ID", player, user.getDiscordId()); Message.send("WHOIS_DISCORD_ID", player, user.getDiscordId());
} }
Timestamp firstJoin = user.getFirstjoin(); Timestamp firstJoin = user.getFirstjoin();
if (firstJoin == null) if (firstJoin == null) {
Message.send("WHOIS_JOINED_FIRST", player, "0000-00-00 00:00:00"); Message.send("WHOIS_JOINED_FIRST", player, "0000-00-00 00:00:00");
else } else {
Message.send("WHOIS_JOINED_FIRST", player, firstJoin.toString()); Message.send("WHOIS_JOINED_FIRST", player, firstJoin.toString());
Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); }
Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / 3600d));
if(BungeeCord.getInstance().getPlayer(user.getUuid()) != null) {
ProxiedPlayer target = BungeeCord.getInstance().getPlayer(user.getUuid());
Message.send("WHOIS_CURRENT_PLAYED", player, new DecimalFormat("####.##").format(Instant.now().getEpochSecond() - Storage.sessions.get(target).toInstant().getEpochSecond() / 60d));
Message.send("WHOIS_CURRENT_SERVER", player, target.getServer().getInfo().getName());
Message.send("WHOIS_CURRENT_PROTOCOL", player, target.getPendingConnection().getVersion());
}
Team team = Team.get(user.getTeam()); Team team = Team.get(user.getTeam());
Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName()); Message.send("WHOIS_TEAM", player, Message.parse("WHOIS_TEAM_HOVER", player, team.getTeamName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + team.getTeamKuerzel()), team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName());

Datei anzeigen

@ -574,9 +574,13 @@ WHOIS_USERNAME=§7Username§8: §e{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}
WHOIS_GROUP=§7Group§8: §{0}{1}
WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0}
WHOIS_JOINED_FIRST=§7Joined on§8: §e{0} WHOIS_JOINED_FIRST=§7Joined on§8: §e{0}
WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h
WHOIS_CURRENT_PLAYED=§7Current Online Time§8: §e{0}m
WHOIS_CURRENT_SERVER=§7Current Server§8: §e{0}
WHOIS_CURRENT_PROTOCOL=§7Current Protocol§8: §e{0}
WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2} WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2}
WHOIS_TEAM_HOVER=§eShow {0} WHOIS_TEAM_HOVER=§eShow {0}
WHOIS_PUNISHMENTS=§7Punish: WHOIS_PUNISHMENTS=§7Punish:

Datei anzeigen

@ -550,12 +550,16 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen.
#WhoisCommand #WhoisCommand
WHOIS_USAGE=§c/whois [Spieler/ID] <-a> WHOIS_USAGE=§c/whois [Spieler/ID] <-a>
WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_GROUP=§7Gruppe§8: §e{0}
WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eUUID Kopieren WHOIS_UUID_HOVER=§eUUID Kopieren
WHOIS_ID=§7ID§8: §e{0} WHOIS_ID=§7ID§8: §e{0}
WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0}
WHOIS_JOINED_FIRST=§7Beigetreten am§8: §e{0} WHOIS_JOINED_FIRST=§7Beigetreten am§8: §e{0}
WHOIS_HOURS_PLAYED=§7Spielzeit§8: §e{0}h WHOIS_HOURS_PLAYED=§7Spielzeit§8: §e{0}h
WHOIS_CURRENT_PLAYED=§7Aktuell online§8: §e{0}m
WHOIS_CURRENT_SERVER=§7Aktueller Server§8: §e{0}
WHOIS_CURRENT_PROTOCOL=§7Aktuelle Version§8: §e{0}
WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2} WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2}
WHOIS_TEAM_HOVER=§e{0} anzeigen WHOIS_TEAM_HOVER=§e{0} anzeigen
WHOIS_PUNISHMENTS=§7Strafen: WHOIS_PUNISHMENTS=§7Strafen: