Archiviert
1
0
Dieser Commit ist enthalten in:
Chaoscaot 2021-01-16 19:47:21 +01:00
Ursprung 9970266d90
Commit 898a948512
3 geänderte Dateien mit 31 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.sql.Punishment;
import de.steamwar.bungeecore.sql.SteamwarUser;
@ -28,7 +27,10 @@ import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.time.Instant;
import java.util.List;
public class WhoisCommand extends BasicCommand {
public WhoisCommand(){
@ -42,7 +44,7 @@ public class WhoisCommand extends BasicCommand {
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length == 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c/whois [Spieler/ID]");
Message.send("WHOIS_SYNTAX", player);
return;
}
@ -55,7 +57,7 @@ public class WhoisCommand extends BasicCommand {
}
if(user == null) {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler!");
Message.send("UNKNOWN_PLAYER", player);
return;
}
@ -66,14 +68,23 @@ public class WhoisCommand extends BasicCommand {
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_ID", player, user.getId());
Message.send("WHOIS_JOINED_FIRST", player, user.getFirstjoin().toString());
Timestamp firstJoin = user.getFirstjoin();
if(firstJoin == null)
Message.send("WHOIS_JOINED_FIRST", player, "0000-00-00 00:00:00");
else
Message.send("WHOIS_JOINED_FIRST", player, firstJoin.toString());
Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600));
Team team = Team.get(user.getTeam());
Message.send("WHOIS_TEAM", player, 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());
Message.send("WHOIS_PUNISHMENTS", player);
for (Punishment punishment : Punishment.getAllPunishmentsOfPlayer(user.getId())) {
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
if(punishmentList.isEmpty()) {
Message.send("WHOIS_NO_PUNISHMENT", player);
return;
}
for (Punishment punishment : punishmentList) {
Message.send("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason());
}
}

Datei anzeigen

@ -251,19 +251,21 @@ public class SteamwarUser {
public double getOnlinetime() {
ResultSet set = SQL.select("SELECT SUM(UNIX_TIMESTAMP(EndTime) - UNIX_TIMESTAMP(StartTime)) as Playtime FROM Session WHERE UserID = ?", id);
try {
set.next();
if(!set.next())
return 0;
return set.getBigDecimal("Playtime").doubleValue();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
throw new SecurityException("Could not load Online Time", throwables);
} catch (NullPointerException e) { //When no Sessions are recorded
return 0;
}
}
public Timestamp getFirstjoin() {
ResultSet set = SQL.select("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?", id);
try {
if(!set.next())
return Timestamp.from(Instant.MIN);
return null;
return set.getTimestamp("FirstJoin");
} catch (SQLException throwables) {
throw new SecurityException("Could not load First Join");

Datei anzeigen

@ -99,7 +99,7 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8]
#ModListener
MOD_RED_SING=Versuchte Benutzung des Mods {0}
MOD_RED_PLUR=Versuchte Benutzung der Mods\n{0}
MOD_RED_PLUR=Versuchte Benutzung der Mods:\n{0}
MOD_YELLOW_SING=§7Deaktiviere den Mod §e{0}§7, um weiter auf §eSteam§8War §7spielen zu können.
MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War §7spielen zu können.
@ -107,14 +107,13 @@ MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War
ALERT=§f{0}
#Ban&Mute-Command
BAN_TEAM_BANNED=§c{0} wurde von {1} {2} gebannt. §f§lGrund: §f{3}
BAN_TEAM_BANNED=§8[§4☣§8]» §c{0} wurde von {1} {2} gebannt. §f§lGrund: §f{3}
BANNED_MESSAGE_PERMA=§cDu bist permanent gebannt. §r§lGrund§r: §c{0}
BANNED_MESSAGE_UNTIL=§cDu bist bis zum {0} gebannt. §r§lGrund§r: §c{1}
MUTE_TEAM_MUTED=§c{0} wurde von {1} {2} gemuted. §f§lGrund: §f{3}
MUTE_TEAM_MUTED=§8[§4☣§8]» §c{0} wurde von {1} {2} gemuted. §f§lGrund: §f{3}
MUTED_MESSAGE_PERMA=§cDu bist permanent gemuted. §r§lGrund§r: §c{0}
MUTED_MESSAGE_UNTIL=§cDu bist bis zum {0} gemuted. §r§lGrund§r: §c{1}
BAN_CHANGED=§c{0} verändert von {1} von {2} auf {3} wegen {4}
BAN_INVALID_TIME=§cUngültige Zeitangabe.
BAN_CHANGED={0}verändert von {1} von {2} auf {3} wegen {4}
BAN_PERMA=Permanent
BAN_UNTIL=bis zum {0}
BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c
@ -165,6 +164,7 @@ CHECK_DECLINED=§cDein §e{0} {1} §cwurde abgelehnt§8: §c{2}
CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von §e{2} §7abgelehnt!
#WhoisCommand
WHIS_SYNTAX=§c/whois [Spieler/ID]
WHOIS_USERNAME=§7Username§8: §e{0}
WHOIS_UUID=§7UUID§8: §e{0}
WHOIS_UUID_HOVER=§eUUID Kopieren
@ -172,5 +172,7 @@ WHOIS_ID=§7ID§8: §e{0}
WHOIS_JOINED_FIRST=§7Beigetreten am§8: §e{0}
WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h
WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2}
WHOIS_TEAM_HOVER=§e{0} anzeigen
WHOIS_PUNISHMENTS=§7Strafen:
WHOIS_PUNISHMENT=§7{0}§8» §f§l{1}: §e{2} - {3} §f{4}
WHOIS_NO_PUNISHMENT=§8[§a✓§8] §7Der Spieler hat noch nichts getan.