Fixing...
Dieser Commit ist enthalten in:
Ursprung
cac7b66208
Commit
bef39c7cc2
@ -57,7 +57,7 @@ public class BanCommand extends BasicCommand {
|
||||
boolean isPerma = args[1].equalsIgnoreCase("perma");
|
||||
String msg = banReason.toString();
|
||||
target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), isPerma);
|
||||
Message.team("BAN_TEAM_BANNED", target.getUserName(), sender.getName(), new Message((isPerma?"BAN_PERMA":"BAN_UNTIL"), banTime), msg);
|
||||
Message.team("BAN_TEAM_BANNED", new Message("PREFIX"), target.getUserName(), sender.getName(), new Message((isPerma?"BAN_PERMA":"BAN_UNTIL"), banTime), msg);
|
||||
}
|
||||
|
||||
public static Timestamp parseTime(CommandSender sender, String arg){
|
||||
|
@ -52,6 +52,6 @@ public class MuteCommand extends BasicCommand {
|
||||
}
|
||||
String msg = muteReason.toString();
|
||||
target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma"));
|
||||
Message.team("MUTE_TEAM_MUTED", target.getUserName(), sender.getName(), new Message((args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), muteTime), msg);
|
||||
Message.team("MUTE_TEAM_MUTED", new Message("PREFIX"), target.getUserName(), sender.getName(), new Message((args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), muteTime), msg);
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class WhoisCommand extends BasicCommand {
|
||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
||||
|
||||
if(args.length == 0){
|
||||
Message.send("WHOIS_SYNTAX", player);
|
||||
Message.send("WHOIS_USAGE", player);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class BanListener extends BasicListener {
|
||||
if(user.isBanned()) {
|
||||
user.updateBanIP(event.getConnection().getAddress().getAddress().getHostAddress());
|
||||
event.setCancelled(true);
|
||||
event.setCancelReason(user.banMessage((ProxiedPlayer) event.getConnection()));
|
||||
event.setCancelReason(user.banMessage(ProxyServer.getInstance().getPlayer(event.getConnection().getUniqueId())));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,15 @@ public class Punishment {
|
||||
}
|
||||
|
||||
public static Map<PunishmentType, Punishment> getPunishmentsOfPlayer(int user) {
|
||||
ResultSet set = SQL.select("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) WHERE UserId = ? GROUP BY Type)", user);
|
||||
try {
|
||||
Map<PunishmentType, Punishment> punishments = new HashMap<>();
|
||||
Punishment banPunishment = getPunishmentOfPlayer(user, PunishmentType.Ban);
|
||||
if(banPunishment != null) punishments.put(PunishmentType.Ban, banPunishment);
|
||||
Punishment mutePunishment = getPunishmentOfPlayer(user, PunishmentType.Mute);
|
||||
if(mutePunishment != null) punishments.put(PunishmentType.Mute, mutePunishment);
|
||||
while (set.next())
|
||||
punishments.put(PunishmentType.valueOf(set.getString("Type")), new Punishment(set));
|
||||
return punishments;
|
||||
} catch (SQLException e) {
|
||||
throw new SecurityException("Could not Load Punishments", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Punishment> getAllPunishmentsOfPlayer(int user) {
|
||||
@ -119,6 +122,8 @@ public class Punishment {
|
||||
}
|
||||
|
||||
public void updateEndTime(int from, String newreason, Timestamp newUpdate, boolean perma) {
|
||||
if(newreason.equals(reason) && newUpdate.equals(endTime) && perma == perma)
|
||||
return;
|
||||
ProxiedPlayer player = BungeeCore.get().getProxy().getPlayer(SteamwarUser.get(from).getUuid());
|
||||
String newReason = Message.parse("BAN_CHANGED", player, reason,
|
||||
SteamwarUser.get(from).getUserName(),
|
||||
@ -139,6 +144,10 @@ public class Punishment {
|
||||
return endTime.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"));
|
||||
}
|
||||
|
||||
public boolean isCurrent() {
|
||||
return isPerma() || getEndTime().after(new Date());
|
||||
}
|
||||
|
||||
public enum PunishmentType {
|
||||
Ban,
|
||||
Mute;
|
||||
|
@ -33,9 +33,7 @@ import java.net.UnknownHostException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@ -71,7 +69,7 @@ public class SteamwarUser {
|
||||
usersById.put(id, this);
|
||||
usersByName.put(userName.toLowerCase(), this);
|
||||
usersByUUID.put(uuid, this);
|
||||
punishments = null;
|
||||
punishments = Punishment.getPunishmentsOfPlayer(id);
|
||||
}
|
||||
|
||||
public static SteamwarUser getOrCreate(PendingConnection connection){
|
||||
@ -151,17 +149,10 @@ public class SteamwarUser {
|
||||
return team;
|
||||
}
|
||||
|
||||
private void loadPunishments() {
|
||||
if(punishments == null) {
|
||||
punishments = Punishment.getPunishmentsOfPlayer(id);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBanned() {
|
||||
loadPunishments();
|
||||
if(!punishments.containsKey(Punishment.PunishmentType.Ban))
|
||||
return false;
|
||||
if(!isCurrent(punishments.get(Punishment.PunishmentType.Ban))) {
|
||||
if(!punishments.get(Punishment.PunishmentType.Ban).isCurrent()) {
|
||||
SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", id);
|
||||
punishments.remove(Punishment.PunishmentType.Ban);
|
||||
return false;
|
||||
@ -170,18 +161,16 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public boolean isMuted(){
|
||||
loadPunishments();
|
||||
if(!punishments.containsKey(Punishment.PunishmentType.Mute))
|
||||
return false;
|
||||
return isCurrent(punishments.get(Punishment.PunishmentType.Mute));
|
||||
if(!punishments.get(Punishment.PunishmentType.Mute).isCurrent()) {
|
||||
punishments.remove(Punishment.PunishmentType.Mute);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isCurrent(Punishment punishment) {
|
||||
return punishment.isPerma() || punishment.getEndTime().after(new Date());
|
||||
return true;
|
||||
}
|
||||
|
||||
public TextComponent banMessage(ProxiedPlayer player){
|
||||
loadPunishments();
|
||||
Punishment punishment = punishments.get(Punishment.PunishmentType.Ban);
|
||||
if (punishment.isPerma()) {
|
||||
return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_PERMA", player, punishment.getReason()));
|
||||
@ -192,7 +181,6 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public TextComponent muteMessage(ProxiedPlayer player){
|
||||
loadPunishments();
|
||||
Punishment punishment = punishments.get(Punishment.PunishmentType.Mute);
|
||||
if (punishment.isPerma()) {
|
||||
return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_PERMA", player, punishment.getReason()));
|
||||
@ -206,7 +194,6 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public void ban(Timestamp time, String banReason, int from, boolean perma){
|
||||
loadPunishments();
|
||||
if(isBanned()) {
|
||||
punishments.get(Punishment.PunishmentType.Ban).updateEndTime(from, banReason, time, perma);
|
||||
return;
|
||||
@ -229,7 +216,6 @@ public class SteamwarUser {
|
||||
}
|
||||
|
||||
public void mute(Timestamp time, String muteReason, int from, boolean perma){
|
||||
loadPunishments();
|
||||
if(isMuted()) {
|
||||
punishments.get(Punishment.PunishmentType.Mute).updateEndTime(from, muteReason, time, perma);
|
||||
return;
|
||||
|
@ -88,8 +88,6 @@ HELP_BAU_DELETE=§8/§ebau delete §8- §7Setzt deine Bauwelt zurück
|
||||
HELP_BAU_DELETE_HOVER=§eBauwelt zurücksetzen
|
||||
HELP_BAU_TESTARENA=§8/§ebau testarena §8- §7Starte eine Testarena
|
||||
HELP_BAU_TESTARENA_HOVER=§eTestarena starten
|
||||
HELP_BAU_BAU=§8/§ehelp bau §8- §7Hilfe zu nützlichen Werkzeugen
|
||||
HELP_BAU_BAU_HOVER=§eNützliche Zusatzfunktionen
|
||||
|
||||
#Usage description of various commands
|
||||
USAGE_ALERT=§8/§7alert §8[§eNachricht§8]
|
||||
@ -107,14 +105,14 @@ MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War
|
||||
ALERT=§f{0}
|
||||
|
||||
#Ban&Mute-Command
|
||||
BAN_TEAM_BANNED=§8[§4☣§8]» §c{0} wurde von {1} {2} gebannt. §f§lGrund: §f{3}
|
||||
BAN_TEAM_BANNED={0}§c{1} wurde von {2} {3} gebannt. §f§lGrund: §f{4}
|
||||
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=§8[§4☣§8]» §c{0} wurde von {1} {2} gemuted. §f§lGrund: §f{3}
|
||||
MUTE_TEAM_MUTED={0}§c{1} wurde von {2} {3} gemuted. §f§lGrund: §f{4}
|
||||
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={0}verändert von {1} von {2} auf {3} wegen {4}
|
||||
BAN_PERMA=Permanent
|
||||
BAN_PERMA=permanent
|
||||
BAN_UNTIL=bis zum {0}
|
||||
BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c
|
||||
BAN_AVOIDING_LIST={0} §e{1} §c
|
||||
@ -164,7 +162,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
|
||||
WHOIS_SYNTAX=§c/whois [Spieler/ID]
|
||||
WHOIS_USAGE=§c/whois [Spieler/ID]
|
||||
WHOIS_USERNAME=§7Username§8: §e{0}
|
||||
WHOIS_UUID=§7UUID§8: §e{0}
|
||||
WHOIS_UUID_HOVER=§eUUID Kopieren
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren