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.sql.Timestamp;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class WhoisCommand extends BasicCommand {
|
public class WhoisCommand extends BasicCommand {
|
||||||
public WhoisCommand(){
|
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_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);
|
Message.send("WHOIS_PUNISHMENTS", player);
|
||||||
if(all) {
|
|
||||||
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
|
List<Punishment> punishmentList = Punishment.getAllPunishmentsOfPlayer(user.getId());
|
||||||
if(punishmentList.isEmpty()) {
|
if (punishmentList.isEmpty()) {
|
||||||
Message.send("WHOIS_NO_ALL_PUNISHMENT", player);
|
Message.send(all ? "WHOIS_NO_ALL_PUNISHMENT" : "WHOIS_NO_PUNISHMENT", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Punishment punishment : punishmentList) {
|
Set<Punishment.PunishmentType> found = new HashSet<>();
|
||||||
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;
|
boolean isPunished = false;
|
||||||
for (Punishment.PunishmentType punishmentType : Punishment.PunishmentType.values()) {
|
for (Punishment punishment : punishmentList) {
|
||||||
if(!user.isPunished(punishmentType)) {
|
if (!all && !punishment.getType().isMulti() && !found.add(punishment.getType())) {
|
||||||
continue;
|
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());
|
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);
|
Message.send("WHOIS_NO_PUNISHMENT", player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package de.steamwar.bungeecore.sql;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -133,6 +134,7 @@ public class Punishment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum PunishmentType {
|
public enum PunishmentType {
|
||||||
Ban(false, "BAN_TEAM", "BAN_PERMA", "BAN_UNTIL", "UNBAN_ERROR", "UNBAN"),
|
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"),
|
NoDevServer(true, "NODEVSERVER_TEAM", "NODEVSERVER_PERMA", "NODEVSERVER_UNTIL", "UNNODEVSERVER_ERROR", "UNNODEVSERVER"),
|
||||||
NoFightServer(false, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"),
|
NoFightServer(false, "NOFIGHTSERVER_TEAM", "NOFIGHTSERVER_PERMA", "NOFIGHTSERVER_UNTIL", "UNNOFIGHTSERVER_ERROR", "UNNOFIGHTSERVER"),
|
||||||
NoTeamServer(true, "NOTEAMSERVER_TEAM", "NOTEAMSERVER_PERMA", "NOTEAMSERVER_UNTIL", "UNNOTEAMSERVER_ERROR", "UNNOTEAMSERVER"),
|
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;
|
private final boolean needsAdmin;
|
||||||
@ -152,5 +154,6 @@ public class Punishment {
|
|||||||
private final String playerMessageUntil;
|
private final String playerMessageUntil;
|
||||||
private final String usageNotPunished;
|
private final String usageNotPunished;
|
||||||
private final String unpunishmentMessage;
|
private final String unpunishmentMessage;
|
||||||
|
private boolean multi = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren