Add some new punishments after talking with mods #352
@ -29,7 +29,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class WhoisCommand extends BasicCommand {
|
||||
public WhoisCommand(){
|
||||
@ -94,28 +96,22 @@ public class WhoisCommand extends BasicCommand {
|
||||
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);
|
||||
if(all) {
|
||||
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
|
||||
if(punishmentList.isEmpty()) {
|
||||
Message.send("WHOIS_NO_ALL_PUNISHMENT", player);
|
||||
return;
|
||||
}
|
||||
for (Punishment punishment : punishmentList) {
|
||||
Message.sendPrefixless("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason());
|
||||
}
|
||||
} else {
|
||||
boolean isPunished = false;
|
||||
for (Punishment.PunishmentType punishmentType : Punishment.PunishmentType.values()) {
|
||||
if(!user.isPunished(punishmentType)) {
|
||||
continue;
|
||||
}
|
||||
Punishment punishment = user.getPunishment(punishmentType);
|
||||
isPunished = true;
|
||||
Message.sendPrefixless("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason());
|
||||
}
|
||||
if(!isPunished) {
|
||||
Message.send("WHOIS_NO_PUNISHMENT", player);
|
||||
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
|
||||
if (punishmentList.isEmpty()) {
|
||||
YoyoNow markierte diese Unterhaltung als gelöst
|
||||
Message.send(all ? "WHOIS_NO_ALL_PUNISHMENT" : "WHOIS_NO_PUNISHMENT", player);
|
||||
return;
|
||||
}
|
||||
Set<Punishment.PunishmentType> found = new HashSet<>();
|
||||
boolean isPunished = false;
|
||||
for (Punishment punishment : punishmentList) {
|
||||
if (!all && !punishment.getType().isMulti() && !found.add(punishment.getType())) {
|
||||
continue;
|
||||
}
|
||||
Message.sendPrefixless("WHOIS_PUNISHMENT", player, SteamwarUser.get(punishment.getPunisher()).getUserName(), punishment.getType().name(), punishment.getBantime(punishment.getStartTime(), false), punishment.getBantime(punishment.getEndTime(), punishment.isPerma()), punishment.getReason());
|
||||
isPunished = true;
|
||||
}
|
||||
if (!all && !isPunished) {
|
||||
Message.send("WHOIS_NO_PUNISHMENT", player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.sql;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -133,6 +134,7 @@ public class Punishment {
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum PunishmentType {
|
||||
Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"),
|
||||
@ -143,7 +145,7 @@ public class Punishment {
|
||||
NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"),
|
||||
NoFightServer(false, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"),
|
||||
NoTeamServer(true, "NOTEAMSERVER_TEAM", "NOTEAMSERVER_PERMA", "NOTEAMSERVER_UNTIL", "UNNOTEAMSERVER_ERROR", "UNNOTEAMSERVER"),
|
||||
Note(false, "NOTE_TEAM", null, null, null, null),
|
||||
Note(false, "NOTE_TEAM", null, null, null, null, true),
|
||||
;
|
||||
|
||||
private final boolean needsAdmin;
|
||||
@ -152,5 +154,6 @@ public class Punishment {
|
||||
private final String playerMessageUntil;
|
||||
private final String usageNotPunished;
|
||||
private final String unpunishmentMessage;
|
||||
private boolean multi = false;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
WÜrde hier die Prüfung weglassen und nur die nach der for-Schleife nutzen