geforkt von SteamWar/BungeeCore
Update WhoisCommand
Add mutlie note punishments
Dieser Commit ist enthalten in:
Ursprung
f52444f6e5
Commit
2ef6901f8e
@ -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);
|
||||
if (punishmentList.isEmpty()) {
|
||||
Message.send(all ? "WHOIS_NO_ALL_PUNISHMENT" : "WHOIS_NO_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 {
|
||||
Set<Punishment.PunishmentType> found = new HashSet<>();
|
||||
boolean isPunished = false;
|
||||
for (Punishment.PunishmentType punishmentType : Punishment.PunishmentType.values()) {
|
||||
if(!user.isPunished(punishmentType)) {
|
||||
for (Punishment punishment : punishmentList) {
|
||||
if (!all && !punishment.getType().isMulti() && !found.add(punishment.getType())) {
|
||||
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());
|
||||
isPunished = true;
|
||||
}
|
||||
if(!isPunished) {
|
||||
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