From 986b53fbf82bf6940d31a1c26aecd85179a304e9 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 14 Nov 2020 23:23:49 +0100 Subject: [PATCH 001/108] Reworked Ban and Mute --- src/de/steamwar/bungeecore/BungeeCore.java | 2 +- .../bungeecore/commands/BanCommand.java | 5 +- .../bungeecore/commands/MuteCommand.java | 3 +- .../bungeecore/commands/UnbanCommand.java | 3 +- .../bungeecore/commands/WhoisCommand.java | 10 +- .../bungeecore/listeners/BanListener.java | 9 ++ .../bungeecore/listeners/mods/Utils.java | 4 +- .../bungeecore/sql/BannedUserIPs.java | 4 + .../steamwar/bungeecore/sql/Punishment.java | 141 ++++++++++++++++++ .../steamwar/bungeecore/sql/SteamwarUser.java | 65 +++----- 10 files changed, 189 insertions(+), 57 deletions(-) create mode 100644 src/de/steamwar/bungeecore/sql/Punishment.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index a6a9ccad..ce648628 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -54,7 +54,7 @@ public class BungeeCore extends Plugin { public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e"; public static final String TEAMCHAT_PREFIX = "§8TC §e"; - public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy"); + public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy"); public static String CHAT_PREFIX; public static String WORLD_FOLDER; diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 9ac7ff89..c2d637de 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.connection.ProxiedPlayer; import java.sql.Timestamp; import java.text.ParseException; @@ -56,12 +57,12 @@ public class BanCommand extends BasicCommand { } String msg = banReason.toString(); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg); - target.ban(banTime, msg); + target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); } public static Timestamp parseTime(CommandSender sender, String arg){ if(arg.equalsIgnoreCase("perma")) { - return Timestamp.from(Instant.ofEpochSecond(946674800)); + return Timestamp.from(Instant.ofEpochSecond(946684800)); }else{ SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH:mm"); try{ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index dc0d681e..cf35b9d5 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -24,6 +24,7 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import java.sql.Timestamp; +import java.time.Instant; public class MuteCommand extends BasicCommand { @@ -52,6 +53,6 @@ public class MuteCommand extends BasicCommand { } String msg = muteReason.toString(); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg); - target.mute(muteTime, msg); + target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); } } diff --git a/src/de/steamwar/bungeecore/commands/UnbanCommand.java b/src/de/steamwar/bungeecore/commands/UnbanCommand.java index 080a8d65..c21561a9 100644 --- a/src/de/steamwar/bungeecore/commands/UnbanCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnbanCommand.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.connection.ProxiedPlayer; import java.sql.Timestamp; import java.util.Date; @@ -44,6 +45,6 @@ public class UnbanCommand extends BasicCommand { return; BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt."); - target.ban(Timestamp.from(new Date().toInstant()), ""); + target.ban(Timestamp.from(new Date().toInstant()), "Unban", SteamwarUser.get(sender.getName()).getId(), false); } } diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index 5bd83d6a..cc66c1a7 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; import net.md_5.bungee.api.CommandSender; @@ -70,11 +71,10 @@ public class WhoisCommand extends BasicCommand { Team team = Team.get(user.getTeam()); BungeeCore.send(player, "§7Team§8: §e" + team.getTeamName()); - if(user.isBanned()){ - player.sendMessage(user.banMessage()); - } - if(user.isMuted()){ - player.sendMessage(user.muteMessage()); + BungeeCore.send(player, "§7Bestrafungen: "); + for (Punishment punishment : Punishment.getAllPunishmentsByPlayer(user.getId())) { + BungeeCore.send(player, "§7" + SteamwarUser.get(punishment.getPunisher()).getUserName() + "§8» §f§l" + punishment.getType().name() + ": §e" + + punishment.getStartTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " - " + (punishment.isPerma()?"Perma":punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " §c" + punishment.getReason()); } } } diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index c9aadb73..bc56de32 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -47,6 +47,15 @@ public class BanListener extends BasicListener { List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); if(!ips.isEmpty()){ + if(ips.stream().anyMatch(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId())) { + ips.forEach(bannedUserIPs -> { + if(bannedUserIPs.getUserID() == user.getId()) + bannedUserIPs.remove(); + }); + ips.removeIf(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId()); + if(ips.isEmpty()) + return; + } StringBuilder potentialBan = new StringBuilder(); potentialBan.append(BungeeCore.CHAT_PREFIX); potentialBan.append("§cMögliche Bannumgehung durch §r"); diff --git a/src/de/steamwar/bungeecore/listeners/mods/Utils.java b/src/de/steamwar/bungeecore/listeners/mods/Utils.java index 7f6d16f1..1ca83e3e 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Utils.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Utils.java @@ -74,7 +74,7 @@ class Utils { if(max == ModType.YELLOW) player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können.")); else{ - user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName()); + user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName(), 0, false); BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen des Mods " + mods.get(0).getModName() + " gebannt."); } }else{ @@ -84,7 +84,7 @@ class Utils { if(max == ModType.YELLOW) player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können.")); else{ - user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString()); + user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString(), 0, false); BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen der Mods " + sb.toString() + " gebannt."); } } diff --git a/src/de/steamwar/bungeecore/sql/BannedUserIPs.java b/src/de/steamwar/bungeecore/sql/BannedUserIPs.java index 6b371ccc..243e5f30 100644 --- a/src/de/steamwar/bungeecore/sql/BannedUserIPs.java +++ b/src/de/steamwar/bungeecore/sql/BannedUserIPs.java @@ -78,4 +78,8 @@ public class BannedUserIPs { public java.sql.Timestamp getTimestamp() { return timestamp; } + + public void remove() { + SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", userID); + } } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java new file mode 100644 index 00000000..ec787a72 --- /dev/null +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -0,0 +1,141 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ + +package de.steamwar.bungeecore.sql; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.*; +import java.util.stream.Collectors; + +public class Punishment { + + public static Punishment getPunishmentByPlayer(int user, PunishmentType type) { + ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE `PunishmentId` IN (SELECT MAX(`PunishmentId`) FROM Punishments WHERE UserId = ? AND Type = ?)", user, type.toDb()); + try { + if(!set.next()) + return null; + return new Punishment(set); + } catch (SQLException throwable) { + throwable.printStackTrace(); + throw new SecurityException("Could not Load Punishments", throwable); + } + } + + public static Map getPunishmentsByPlayer(int user) { + ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE `PunishmentId` IN (SELECT MAX(`PunishmentId`) FROM Punishments WHERE UserId = ? GROUP BY Type)", user); + try { + Map punishmentMap = new HashMap<>(); + while (set.next()) { + Punishment punishment = new Punishment(set); + punishmentMap.put(punishment.getType(), punishment); + } + return punishmentMap; + } catch (SQLException throwable) { + throwable.printStackTrace(); + throw new SecurityException("Could not Load Punishments", throwable); + } + } + + public static Set getAllPunishmentsByPlayer(int user) { + ResultSet set = SQL.select("SELECT * FROM Punishments WHERE UserId = ? ORDER BY `PunishmentId` DESC", user); + try { + Set punishments = new HashSet<>(); + while (set.next()) { + punishments.add(new Punishment(set)); + } + return punishments; + } catch (SQLException throwable) { + throwable.printStackTrace(); + throw new SecurityException("Could not Load all Punishments", throwable); + } + } + + public static Punishment createPunishment(int user, int executor, PunishmentType type, String reason, Timestamp endTime, Boolean perma) { + SQL.update("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)", + user, executor, type.toDb(), reason, endTime, perma); + return getPunishmentByPlayer(user, type); + } + + private final Timestamp startTime; + private final Timestamp endTime; + private final PunishmentType type; + private final int user; + private final String reason; + private final int id; + private final int punisher; + private final boolean perma; + + private Punishment(ResultSet set) throws SQLException { + id = set.getInt("PunishmentId"); + user = set.getInt("UserId"); + reason = set.getString("Reason"); + type = PunishmentType.getTypeFromDB(set.getString("Type")); + startTime = set.getTimestamp("StartTime"); + endTime = set.getTimestamp("EndTime"); + punisher = set.getInt("Punisher"); + perma = set.getBoolean("Perma"); + } + + public Timestamp getStartTime() { + return startTime; + } + + public Timestamp getEndTime() { + return endTime; + } + + public PunishmentType getType() { + return type; + } + + public int getUser() { + return user; + } + + public String getReason() { + return reason; + } + + public int getId() { + return id; + } + + public int getPunisher() { + return punisher; + } + + public boolean isPerma() { + return perma; + } + + public enum PunishmentType { + Ban, + Mute; + + public String toDb() { + return name().toLowerCase(); + } + + public static PunishmentType getTypeFromDB(String str) { + return Arrays.stream(values()).filter(punishmentType -> punishmentType.name().equalsIgnoreCase(str)).collect(Collectors.toList()).get(0); + } + } +} diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 61625eab..82ace6b1 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -32,7 +32,6 @@ import java.net.UnknownHostException; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; -import java.time.Instant; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -43,16 +42,12 @@ public class SteamwarUser { private final UUID uuid; private String userName; private UserGroup userGroup; - private Timestamp banTime; - private String banReason; private int team; - private Timestamp muteTime; - private String muteReason; + private Map punishments; private static final Map usersByName = new HashMap<>(); private static final Map usersByUUID = new HashMap<>(); private static final Map usersById = new HashMap<>(); - private static final Timestamp PERMA_BAN = Timestamp.from(Instant.ofEpochSecond(946684800)); private static final InetAddress LIXFEL_DE; static { @@ -69,14 +64,11 @@ public class SteamwarUser { uuid = UUID.fromString(rs.getString("UUID")); userName = rs.getString("UserName"); userGroup = UserGroup.getUsergroup(rs.getString("UserGroup")); - banTime = rs.getTimestamp("BanTime"); - banReason = rs.getString("BanReason"); team = rs.getInt("Team"); - muteTime = rs.getTimestamp("MuteTime"); - muteReason = rs.getString("MuteReason"); usersById.put(id, this); usersByName.put(userName.toLowerCase(), this); usersByUUID.put(uuid, this); + punishments = Punishment.getPunishmentsByPlayer(id); } public static SteamwarUser getOrCreate(PendingConnection connection){ @@ -157,47 +149,32 @@ public class SteamwarUser { } public boolean isBanned() { - if (banTime == null) { - return false; - } else if (banTime.after(new Date()) || banTime.before(PERMA_BAN)) { - return true; - } else { - SQL.update("UPDATE UserData SET BanTime = NULL, BanReason = '' WHERE id = ?", id); - SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", id); - banTime = null; - banReason = ""; - return false; - } + return punishments.containsKey(Punishment.PunishmentType.Ban) && + (punishments.get(Punishment.PunishmentType.Ban).getEndTime().after(new Date()) || punishments.get(Punishment.PunishmentType.Ban).isPerma()); } public boolean isMuted(){ - if(muteTime == null){ - return false; - }else if(muteTime.after(new Date()) || muteTime.before(PERMA_BAN)){ - return true; - }else{ - SQL.update("UPDATE UserData SET MuteTime = NULL, MuteReason = '' WHERE id = ?", id); - muteTime = null; - muteReason = ""; - return false; - } + return punishments.containsKey(Punishment.PunishmentType.Mute) && + (punishments.get(Punishment.PunishmentType.Mute).getEndTime().after(new Date()) || punishments.get(Punishment.PunishmentType.Mute).isPerma()); } public TextComponent banMessage(){ - if (banTime.before(PERMA_BAN)) { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + banReason); + Punishment punishment = punishments.get(Punishment.PunishmentType.Ban); + if (punishment.isPerma()) { + return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + punishment.getReason()); } else { return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " + - banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + banReason); + punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + punishment.getReason()); } } public TextComponent muteMessage(){ - if (muteTime.before(PERMA_BAN)) { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + muteReason); + Punishment punishment = punishments.get(Punishment.PunishmentType.Mute); + if (punishment.isPerma()) { + return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + punishment.getReason()); } else { return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " + - muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + muteReason); + punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + punishment.getReason()); } } @@ -205,10 +182,9 @@ public class SteamwarUser { BannedUserIPs.banIP(this, ip); } - public void ban(Timestamp time, String banReason){ - SQL.update("UPDATE UserData SET BanTime = ?, BanReason = ? WHERE id = ?", time, banReason, id); - banTime = time; - this.banReason = banReason; + public void ban(Timestamp time, String banReason, int from, boolean perma){ + punishments.remove(Punishment.PunishmentType.Ban); + punishments.put(Punishment.PunishmentType.Ban, Punishment.createPunishment(id, from, Punishment.PunishmentType.Ban, banReason, time, perma)); ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid); if(player != null){ @@ -218,10 +194,9 @@ public class SteamwarUser { updateBanIP(""); } - public void mute(Timestamp time, String muteReason){ - SQL.update("UPDATE UserData SET MuteTime = ?, MuteReason = ? WHERE id = ?", time, muteReason, id); - muteTime = time; - this.muteReason = muteReason; + public void mute(Timestamp time, String muteReason, int from, boolean perma){ + punishments.remove(Punishment.PunishmentType.Mute); + punishments.put(Punishment.PunishmentType.Mute, Punishment.createPunishment(id, from, Punishment.PunishmentType.Mute, muteReason, time, perma)); } private static SteamwarUser dbInit(ResultSet rs){ From 2c026a1d21938940bb091e72854d7e02b3e9f251 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 14 Nov 2020 23:25:39 +0100 Subject: [PATCH 002/108] Imports... --- src/de/steamwar/bungeecore/commands/BanCommand.java | 3 +-- src/de/steamwar/bungeecore/commands/MuteCommand.java | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index c2d637de..8939ebc6 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -22,7 +22,6 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.connection.ProxiedPlayer; import java.sql.Timestamp; import java.text.ParseException; @@ -62,7 +61,7 @@ public class BanCommand extends BasicCommand { public static Timestamp parseTime(CommandSender sender, String arg){ if(arg.equalsIgnoreCase("perma")) { - return Timestamp.from(Instant.ofEpochSecond(946684800)); + return Timestamp.from(Instant.ofEpochSecond(946674800)); }else{ SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH:mm"); try{ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index cf35b9d5..6a681f44 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -24,7 +24,6 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import java.sql.Timestamp; -import java.time.Instant; public class MuteCommand extends BasicCommand { From f20be78c5953c3e7e3738496463a37c6a313e948 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 14 Nov 2020 23:31:11 +0100 Subject: [PATCH 003/108] Announce Bans and Mutes --- src/de/steamwar/bungeecore/commands/BanCommand.java | 1 + src/de/steamwar/bungeecore/commands/MuteCommand.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 8939ebc6..eef825bf 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -56,6 +56,7 @@ public class BanCommand extends BasicCommand { } String msg = banReason.toString(); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); } diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 6a681f44..7e9b1eae 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -51,6 +51,7 @@ public class MuteCommand extends BasicCommand { muteReason.append(args[i]).append(" "); } String msg = muteReason.toString(); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg); target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); } From 6607b736ee0278de6bd233715ed8913ff42adc66 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 11:02:23 +0100 Subject: [PATCH 004/108] Fixing... --- .../bungeecore/commands/BanCommand.java | 3 +- .../bungeecore/commands/MuteCommand.java | 3 +- .../bungeecore/commands/WhoisCommand.java | 4 +- .../steamwar/bungeecore/sql/Punishment.java | 48 ++++++------------- .../steamwar/bungeecore/sql/SteamwarUser.java | 16 +++++-- 5 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index eef825bf..ff4516bc 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -55,9 +55,8 @@ public class BanCommand extends BasicCommand { banReason.append(args[i]).append(" "); } String msg = banReason.toString(); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 7e9b1eae..edd429a5 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -51,8 +51,7 @@ public class MuteCommand extends BasicCommand { muteReason.append(args[i]).append(" "); } String msg = muteReason.toString(); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg); target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); } } diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index cc66c1a7..d2e2f4b9 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -71,8 +71,8 @@ public class WhoisCommand extends BasicCommand { Team team = Team.get(user.getTeam()); BungeeCore.send(player, "§7Team§8: §e" + team.getTeamName()); - BungeeCore.send(player, "§7Bestrafungen: "); - for (Punishment punishment : Punishment.getAllPunishmentsByPlayer(user.getId())) { + BungeeCore.send(player, "§7Strafen: "); + for (Punishment punishment : Punishment.getAllPunishmentsOfPlayer(user.getId())) { BungeeCore.send(player, "§7" + SteamwarUser.get(punishment.getPunisher()).getUserName() + "§8» §f§l" + punishment.getType().name() + ": §e" + punishment.getStartTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " - " + (punishment.isPerma()?"Perma":punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " §c" + punishment.getReason()); } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index ec787a72..87d50dde 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -23,24 +23,22 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.*; -import java.util.stream.Collectors; public class Punishment { - public static Punishment getPunishmentByPlayer(int user, PunishmentType type) { - ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE `PunishmentId` IN (SELECT MAX(`PunishmentId`) FROM Punishments WHERE UserId = ? AND Type = ?)", user, type.toDb()); + public static Punishment getPunishmentOfPlayer(int user, PunishmentType type) { + ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE EndTime < NOW() AND UserId = ? AND Type = ? ORDER BY PunishmentId DESC LIMIT 1", user, type.name()); try { if(!set.next()) return null; return new Punishment(set); - } catch (SQLException throwable) { - throwable.printStackTrace(); - throw new SecurityException("Could not Load Punishments", throwable); + } catch (SQLException e) { + throw new SecurityException("Could not Load Punishments", e); } } - public static Map getPunishmentsByPlayer(int user) { - ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE `PunishmentId` IN (SELECT MAX(`PunishmentId`) FROM Punishments WHERE UserId = ? GROUP BY Type)", user); + public static Map getPunishmentsOfPlayer(int user) { + ResultSet set = SQL.select("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) FROM Punishments WHERE UserId = ? GROUP BY Type)", user); try { Map punishmentMap = new HashMap<>(); while (set.next()) { @@ -48,30 +46,28 @@ public class Punishment { punishmentMap.put(punishment.getType(), punishment); } return punishmentMap; - } catch (SQLException throwable) { - throwable.printStackTrace(); - throw new SecurityException("Could not Load Punishments", throwable); + } catch (SQLException e) { + throw new SecurityException("Could not Load Punishments", e); } } - public static Set getAllPunishmentsByPlayer(int user) { + public static List getAllPunishmentsOfPlayer(int user) { ResultSet set = SQL.select("SELECT * FROM Punishments WHERE UserId = ? ORDER BY `PunishmentId` DESC", user); try { - Set punishments = new HashSet<>(); + List punishments = new ArrayList<>(); while (set.next()) { punishments.add(new Punishment(set)); } return punishments; - } catch (SQLException throwable) { - throwable.printStackTrace(); - throw new SecurityException("Could not Load all Punishments", throwable); + } catch (SQLException e) { + throw new SecurityException("Could not Load all Punishments", e); } } public static Punishment createPunishment(int user, int executor, PunishmentType type, String reason, Timestamp endTime, Boolean perma) { SQL.update("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)", - user, executor, type.toDb(), reason, endTime, perma); - return getPunishmentByPlayer(user, type); + user, executor, type.name(), reason, endTime, perma); + return getPunishmentOfPlayer(user, type); } private final Timestamp startTime; @@ -79,15 +75,13 @@ public class Punishment { private final PunishmentType type; private final int user; private final String reason; - private final int id; private final int punisher; private final boolean perma; private Punishment(ResultSet set) throws SQLException { - id = set.getInt("PunishmentId"); user = set.getInt("UserId"); reason = set.getString("Reason"); - type = PunishmentType.getTypeFromDB(set.getString("Type")); + type = PunishmentType.valueOf(set.getString("Type")); startTime = set.getTimestamp("StartTime"); endTime = set.getTimestamp("EndTime"); punisher = set.getInt("Punisher"); @@ -114,10 +108,6 @@ public class Punishment { return reason; } - public int getId() { - return id; - } - public int getPunisher() { return punisher; } @@ -129,13 +119,5 @@ public class Punishment { public enum PunishmentType { Ban, Mute; - - public String toDb() { - return name().toLowerCase(); - } - - public static PunishmentType getTypeFromDB(String str) { - return Arrays.stream(values()).filter(punishmentType -> punishmentType.name().equalsIgnoreCase(str)).collect(Collectors.toList()).get(0); - } } } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 82ace6b1..d092b9eb 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -68,7 +68,7 @@ public class SteamwarUser { usersById.put(id, this); usersByName.put(userName.toLowerCase(), this); usersByUUID.put(uuid, this); - punishments = Punishment.getPunishmentsByPlayer(id); + punishments = Punishment.getPunishmentsOfPlayer(id); } public static SteamwarUser getOrCreate(PendingConnection connection){ @@ -149,13 +149,19 @@ public class SteamwarUser { } public boolean isBanned() { - return punishments.containsKey(Punishment.PunishmentType.Ban) && - (punishments.get(Punishment.PunishmentType.Ban).getEndTime().after(new Date()) || punishments.get(Punishment.PunishmentType.Ban).isPerma()); + if(!punishments.containsKey(Punishment.PunishmentType.Ban)) + return false; + return isCurrent(punishments.get(Punishment.PunishmentType.Ban)); } public boolean isMuted(){ - return punishments.containsKey(Punishment.PunishmentType.Mute) && - (punishments.get(Punishment.PunishmentType.Mute).getEndTime().after(new Date()) || punishments.get(Punishment.PunishmentType.Mute).isPerma()); + if(!punishments.containsKey(Punishment.PunishmentType.Mute)) + return false; + return isCurrent(punishments.get(Punishment.PunishmentType.Mute)); + } + + private boolean isCurrent(Punishment punishment) { + return punishment.isPerma() || punishment.getEndTime().after(new Date()); } public TextComponent banMessage(){ From 4dd593243e8181bd230ea2c1b37d43d51563cce1 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 12:23:44 +0100 Subject: [PATCH 005/108] Fixing Recursive SQL Select --- .../steamwar/bungeecore/sql/Punishment.java | 59 ++++++++++++++----- .../steamwar/bungeecore/sql/SteamwarUser.java | 8 +++ 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 87d50dde..f6f1c2ca 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -19,6 +19,8 @@ package de.steamwar.bungeecore.sql; +import de.steamwar.bungeecore.BungeeCore; + import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; @@ -27,7 +29,7 @@ import java.util.*; public class Punishment { public static Punishment getPunishmentOfPlayer(int user, PunishmentType type) { - ResultSet set = SQL.select("SELECT * FROM `Punishments` WHERE EndTime < NOW() AND UserId = ? AND Type = ? ORDER BY PunishmentId DESC LIMIT 1", user, type.name()); + ResultSet set = SQL.select("SELECT * FROM Punishments WHERE UserId = ? AND Type = ? ORDER BY PunishmentId DESC LIMIT 1", user, type.name()); try { if(!set.next()) return null; @@ -38,17 +40,14 @@ public class Punishment { } public static Map getPunishmentsOfPlayer(int user) { - ResultSet set = SQL.select("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) FROM Punishments WHERE UserId = ? GROUP BY Type)", user); - try { - Map punishmentMap = new HashMap<>(); - while (set.next()) { - Punishment punishment = new Punishment(set); - punishmentMap.put(punishment.getType(), punishment); - } - return punishmentMap; - } catch (SQLException e) { - throw new SecurityException("Could not Load Punishments", e); + Map punishmentMap = new HashMap<>(); + for (PunishmentType type : PunishmentType.values()) { + Punishment punishment = getPunishmentOfPlayer(user, type); + if(punishment == null) + continue; + punishmentMap.put(type, punishment); } + return punishmentMap; } public static List getAllPunishmentsOfPlayer(int user) { @@ -71,12 +70,13 @@ public class Punishment { } private final Timestamp startTime; - private final Timestamp endTime; + private Timestamp endTime; private final PunishmentType type; private final int user; - private final String reason; + private final int id; + private String reason; private final int punisher; - private final boolean perma; + private boolean perma; private Punishment(ResultSet set) throws SQLException { user = set.getInt("UserId"); @@ -86,6 +86,7 @@ public class Punishment { endTime = set.getTimestamp("EndTime"); punisher = set.getInt("Punisher"); perma = set.getBoolean("Perma"); + id = set.getInt("PunishmentId"); } public Timestamp getStartTime() { @@ -116,6 +117,36 @@ public class Punishment { return perma; } + public void updateEndTime(int from, String reason, Timestamp newUpdate, boolean perma) { + StringBuilder newReason = new StringBuilder(reason); + if(newUpdate.before(endTime)) + newReason.append(" verkürtz vom ") + .append(getBantime()) + .append(" von ") + .append(SteamwarUser.get(from).getUserName()) + .append(" Grund: ") + .append(reason); + else + newReason.append(" verlängert vom ") + .append(getBantime()) + .append(" von ") + .append(SteamwarUser.get(from).getUserName()) + .append(" Grund: ") + .append(reason); + + SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason.toString(), perma, id); + this.reason = newReason.toString(); + this.perma = perma; + this.endTime = newUpdate; + } + + public String getBantime() { + if(perma) + return "Permanent"; + else + return endTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT); + } + public enum PunishmentType { Ban, Mute; diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index d092b9eb..b1e723fe 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -189,6 +189,10 @@ public class SteamwarUser { } public void ban(Timestamp time, String banReason, int from, boolean perma){ + if(isBanned()) { + punishments.get(Punishment.PunishmentType.Ban).updateEndTime(from, banReason, time, perma); + return; + } punishments.remove(Punishment.PunishmentType.Ban); punishments.put(Punishment.PunishmentType.Ban, Punishment.createPunishment(id, from, Punishment.PunishmentType.Ban, banReason, time, perma)); @@ -201,6 +205,10 @@ public class SteamwarUser { } public void mute(Timestamp time, String muteReason, int from, boolean perma){ + if(isMuted()) { + punishments.get(Punishment.PunishmentType.Ban).updateEndTime(from, muteReason, time, perma); + return; + } punishments.remove(Punishment.PunishmentType.Mute); punishments.put(Punishment.PunishmentType.Mute, Punishment.createPunishment(id, from, Punishment.PunishmentType.Mute, muteReason, time, perma)); } From 5ee2d1030876feffa6a67b2f466dfeafc51f96f3 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 13:04:31 +0100 Subject: [PATCH 006/108] Fixing BannedUserIp Delete --- src/de/steamwar/bungeecore/listeners/BanListener.java | 9 --------- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 6 +++++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index bc56de32..c9aadb73 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -47,15 +47,6 @@ public class BanListener extends BasicListener { List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); if(!ips.isEmpty()){ - if(ips.stream().anyMatch(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId())) { - ips.forEach(bannedUserIPs -> { - if(bannedUserIPs.getUserID() == user.getId()) - bannedUserIPs.remove(); - }); - ips.removeIf(bannedUserIPs -> bannedUserIPs.getUserID() == user.getId()); - if(ips.isEmpty()) - return; - } StringBuilder potentialBan = new StringBuilder(); potentialBan.append(BungeeCore.CHAT_PREFIX); potentialBan.append("§cMögliche Bannumgehung durch §r"); diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index b1e723fe..8fc30fe4 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -151,7 +151,11 @@ public class SteamwarUser { public boolean isBanned() { if(!punishments.containsKey(Punishment.PunishmentType.Ban)) return false; - return isCurrent(punishments.get(Punishment.PunishmentType.Ban)); + if(!isCurrent(punishments.get(Punishment.PunishmentType.Ban))) { + SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", id); + return false; + } + return true; } public boolean isMuted(){ From aa73889ffe4dbb50c9d2222ef9c62fe908035660 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 13:04:53 +0100 Subject: [PATCH 007/108] Fixing BannedUserIp Delete --- src/de/steamwar/bungeecore/sql/BannedUserIPs.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/BannedUserIPs.java b/src/de/steamwar/bungeecore/sql/BannedUserIPs.java index 243e5f30..6b371ccc 100644 --- a/src/de/steamwar/bungeecore/sql/BannedUserIPs.java +++ b/src/de/steamwar/bungeecore/sql/BannedUserIPs.java @@ -78,8 +78,4 @@ public class BannedUserIPs { public java.sql.Timestamp getTimestamp() { return timestamp; } - - public void remove() { - SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", userID); - } } From cfb12dfb75ac6adb38752e7e4a1c4910a20e538c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 20:45:34 +0100 Subject: [PATCH 008/108] Fixing Ban extended --- src/de/steamwar/bungeecore/sql/Punishment.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index f6f1c2ca..31e3934f 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -117,22 +117,22 @@ public class Punishment { return perma; } - public void updateEndTime(int from, String reason, Timestamp newUpdate, boolean perma) { - StringBuilder newReason = new StringBuilder(reason); - if(newUpdate.before(endTime)) - newReason.append(" verkürtz vom ") + public void updateEndTime(int from, String newreason, Timestamp newUpdate, boolean perma) { + StringBuilder newReason = new StringBuilder(this.reason); + if(newUpdate.before(endTime) || this.perma) + newReason.append("verkürtz vo" + (this.perma?"n":"m") + " ") .append(getBantime()) .append(" von ") .append(SteamwarUser.get(from).getUserName()) .append(" Grund: ") - .append(reason); + .append(newreason); else - newReason.append(" verlängert vom ") + newReason.append("verlängert vo" + (this.perma?"n":"m") + " ") .append(getBantime()) .append(" von ") .append(SteamwarUser.get(from).getUserName()) .append(" Grund: ") - .append(reason); + .append(newreason); SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason.toString(), perma, id); this.reason = newReason.toString(); From 4137ebb61bf19a96addfdfb133f340042c4e4b8c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 16 Nov 2020 15:47:28 +0100 Subject: [PATCH 009/108] Fixing... --- .../bungeecore/commands/BanCommand.java | 2 +- .../bungeecore/commands/MuteCommand.java | 2 +- .../steamwar/bungeecore/sql/Punishment.java | 24 +++++++------------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index ff4516bc..0e6e55b2 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -56,7 +56,7 @@ public class BanCommand extends BasicCommand { } String msg = banReason.toString(); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + target.getUserGroup().getColorCode() + target.getUserName() + "§c wurde von " + SteamwarUser.get(sender.getName()).getUserGroup().getColorCode() + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index edd429a5..7590d228 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -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")); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " " + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + target.getUserGroup().getColorCode() + target.getUserName() + "§c wurde von " + SteamwarUser.get(sender.getName()).getUserGroup().getColorCode() + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); } } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 31e3934f..abd3bee3 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -119,20 +119,14 @@ public class Punishment { public void updateEndTime(int from, String newreason, Timestamp newUpdate, boolean perma) { StringBuilder newReason = new StringBuilder(this.reason); - if(newUpdate.before(endTime) || this.perma) - newReason.append("verkürtz vo" + (this.perma?"n":"m") + " ") - .append(getBantime()) - .append(" von ") - .append(SteamwarUser.get(from).getUserName()) - .append(" Grund: ") - .append(newreason); - else - newReason.append("verlängert vo" + (this.perma?"n":"m") + " ") - .append(getBantime()) - .append(" von ") - .append(SteamwarUser.get(from).getUserName()) - .append(" Grund: ") - .append(newreason); + newReason.append("verändert von ") + .append(SteamwarUser.get(from).getUserName()) + .append(" von ") + .append(getBantime(endTime, this.perma)) + .append(" auf ") + .append(getBantime(newUpdate, perma)) + .append(" wegen ") + .append(newreason); SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason.toString(), perma, id); this.reason = newReason.toString(); @@ -140,7 +134,7 @@ public class Punishment { this.endTime = newUpdate; } - public String getBantime() { + public String getBantime(Timestamp endTime, boolean perma) { if(perma) return "Permanent"; else From 3cb5eac639114d2a2ce197364638db8dd5126745 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 18 Nov 2020 14:03:52 +0100 Subject: [PATCH 010/108] Fixing Everything --- src/de/steamwar/bungeecore/BungeeCore.java | 2 +- src/de/steamwar/bungeecore/commands/BanCommand.java | 2 +- src/de/steamwar/bungeecore/commands/MuteCommand.java | 2 +- src/de/steamwar/bungeecore/sql/Punishment.java | 2 +- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index ce648628..843ba1bd 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -54,7 +54,7 @@ public class BungeeCore extends Plugin { public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e"; public static final String TEAMCHAT_PREFIX = "§8TC §e"; - public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("HH:mm dd.MM.yyyy"); + public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"); public static String CHAT_PREFIX; public static String WORLD_FOLDER; diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 0e6e55b2..159e07e0 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -56,7 +56,7 @@ public class BanCommand extends BasicCommand { } String msg = banReason.toString(); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + target.getUserGroup().getColorCode() + target.getUserName() + "§c wurde von " + SteamwarUser.get(sender.getName()).getUserGroup().getColorCode() + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 7590d228..ac53d05f 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -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")); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + target.getUserGroup().getColorCode() + target.getUserName() + "§c wurde von " + SteamwarUser.get(sender.getName()).getUserGroup().getColorCode() + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); + ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); } } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index abd3bee3..72e5c0ab 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -63,7 +63,7 @@ public class Punishment { } } - public static Punishment createPunishment(int user, int executor, PunishmentType type, String reason, Timestamp endTime, Boolean perma) { + public static Punishment createPunishment(int user, int executor, PunishmentType type, String reason, Timestamp endTime, boolean perma) { SQL.update("INSERT INTO Punishments (UserId, Punisher, Type, Reason, EndTime, Perma) VALUES (?, ?, ?, ?, ?, ?)", user, executor, type.name(), reason, endTime, perma); return getPunishmentOfPlayer(user, type); diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 8fc30fe4..09166866 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -153,6 +153,7 @@ public class SteamwarUser { return false; if(!isCurrent(punishments.get(Punishment.PunishmentType.Ban))) { SQL.update("DELETE FROM BannedUserIPs WHERE UserID = ?", id); + punishments.remove(Punishment.PunishmentType.Ban); return false; } return true; @@ -210,7 +211,7 @@ public class SteamwarUser { public void mute(Timestamp time, String muteReason, int from, boolean perma){ if(isMuted()) { - punishments.get(Punishment.PunishmentType.Ban).updateEndTime(from, muteReason, time, perma); + punishments.get(Punishment.PunishmentType.Mute).updateEndTime(from, muteReason, time, perma); return; } punishments.remove(Punishment.PunishmentType.Mute); From 63ce857c4589fbbc50ed280783bd441521ed4029 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 18 Nov 2020 14:23:46 +0100 Subject: [PATCH 011/108] Add MoreMultilingualTransfer --- src/de/steamwar/bungeecore/commands/BanCommand.java | 6 ++++-- src/de/steamwar/messages/BungeeCore.properties | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 330960a7..f770ee8f 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -19,6 +19,7 @@ package de.steamwar.bungeecore.commands; +import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -38,7 +39,7 @@ public class BanCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 3){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]"); + Message.send("USAGE_BAN", sender); return; } @@ -56,7 +57,8 @@ public class BanCommand extends BasicCommand { } String msg = banReason.toString(); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gebannt. §f§lGrund: §f" + banReason); + Message.team("BAN_TEAM_BANNED", target.getUserName(), sender.getName(), + (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)), msg); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 64916c90..32b2ac14 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -66,8 +66,10 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] #Various commands ALERT=§f{0} -BAN_YOU_BANNED=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} +BAN_TEAM_BANNED=§c {0} wurde von {1} {2} gebannt. §f§lGrund: §f{3} BAN_INVALID_TIME=§cUngültige Zeitangabe. +BAN_PERMA=Permanent +BAN_UNTIL=bis zum BUG_SAVED=§7Dein Bugreport wurde gespeichert. From 293b037ffd901c01ab3aadb0a1fbed67402abbf5 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 19 Nov 2020 17:13:02 +0100 Subject: [PATCH 012/108] Update Message --- src/de/steamwar/bungeecore/commands/MuteCommand.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index ac53d05f..dc43bae0 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -52,6 +53,7 @@ public class MuteCommand extends BasicCommand { } String msg = muteReason.toString(); target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - ServerTeamchatCommand.sendToTeam(BungeeCore.CHAT_PREFIX + "§c" + target.getUserName() + " wurde von " + sender.getName() + " §c" + (args[1].equalsIgnoreCase("perma")?"Permanent":"bis zum " + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " gemuted. §f§lGrund: §f" + muteReason); + Message.team("BAN_TEAM_BANNED", target.getUserName(), sender.getName(), + (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)), msg); } } From 2d9f686ba80767a1f8383364c1d5e7c72bbaa504 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 19 Nov 2020 17:14:56 +0100 Subject: [PATCH 013/108] Update Message Mute --- src/de/steamwar/bungeecore/commands/MuteCommand.java | 4 ++-- src/de/steamwar/messages/BungeeCore.properties | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index dc43bae0..4cbda7b8 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -35,7 +35,7 @@ public class MuteCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 3){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]"); + Message.send("USAGE_MUTE", sender); return; } @@ -53,7 +53,7 @@ public class MuteCommand extends BasicCommand { } String msg = muteReason.toString(); target.mute(muteTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - Message.team("BAN_TEAM_BANNED", target.getUserName(), sender.getName(), + Message.team("MUTE_TEAM_MUTED", target.getUserName(), sender.getName(), (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)), msg); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 32b2ac14..8f2a672c 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -61,12 +61,14 @@ HELP_BAU_BAU_HOVER=§eNützliche Zusatzfunktionen #Usage description of various commands USAGE_ALERT=§8/§7alert §8[§eNachricht§8] USAGE_BAN=§8/§7ban §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] +USAGE_MUTE=§8/§7mute §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] #Various commands ALERT=§f{0} BAN_TEAM_BANNED=§c {0} wurde von {1} {2} gebannt. §f§lGrund: §f{3} +MUTE_TEAM_MUTED=§c {0} wurde von {1} {2} gemuted. §f§lGrund: §f{3} BAN_INVALID_TIME=§cUngültige Zeitangabe. BAN_PERMA=Permanent BAN_UNTIL=bis zum From 01f40b9440f58a410dc63b91cb3cf04fe57b90ff Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 23 Nov 2020 18:26:04 +0100 Subject: [PATCH 014/108] Changing Messages --- src/de/steamwar/bungeecore/sql/Punishment.java | 3 ++- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 16 ++++++++++------ src/de/steamwar/messages/BungeeCore.properties | 5 +++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 72e5c0ab..e39f8543 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import java.sql.ResultSet; import java.sql.SQLException; @@ -136,7 +137,7 @@ public class Punishment { public String getBantime(Timestamp endTime, boolean perma) { if(perma) - return "Permanent"; + return Message.parse("BAN_PERMA", SteamwarUser.get(user).getPlayer()); else return endTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT); } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 09166866..62dc67c5 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.commands.WebregisterCommand; import de.steamwar.bungeecore.listeners.ConnectionListener; import net.md_5.bungee.api.ProxyServer; @@ -148,6 +149,10 @@ public class SteamwarUser { return team; } + public ProxiedPlayer getPlayer() { + return BungeeCore.get().getProxy().getPlayer(uuid); + } + public boolean isBanned() { if(!punishments.containsKey(Punishment.PunishmentType.Ban)) return false; @@ -172,20 +177,19 @@ public class SteamwarUser { public TextComponent banMessage(){ Punishment punishment = punishments.get(Punishment.PunishmentType.Ban); if (punishment.isPerma()) { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gebannt. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_PERMA", getPlayer(), punishment.getReason())); } else { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " + - punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gebannt. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_UNTIL", getPlayer(), punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT), + punishment.getReason())); } } public TextComponent muteMessage(){ Punishment punishment = punishments.get(Punishment.PunishmentType.Mute); if (punishment.isPerma()) { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu bist permanent gemuted. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_PERMA", getPlayer(), punishment.getReason())); } else { - return BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + " Du bist bis zum " + - punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " gemuted. §r§lGrund§r: §c" + punishment.getReason()); + return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_UNTIL",getPlayer(), punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT), punishment.getReason())); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8f2a672c..8d08c2c4 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -68,7 +68,12 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] ALERT=§f{0} BAN_TEAM_BANNED=§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=Du bist bis zum {0} gebannt. §r§lGrund§r: §c{1} MUTE_TEAM_MUTED=§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=Du bist bis zum {0} gemuted. §r§lGrund§r: §c{1} +BAN_CHANGED={0} verändert von {1} von BAN_INVALID_TIME=§cUngültige Zeitangabe. BAN_PERMA=Permanent BAN_UNTIL=bis zum From 06d18866b64575a40510f5de38b53aba7966b62d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 24 Nov 2020 16:38:47 +0100 Subject: [PATCH 015/108] Add Multilang --- src/de/steamwar/bungeecore/sql/Punishment.java | 13 ++++--------- src/de/steamwar/messages/BungeeCore.properties | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index e39f8543..321fb871 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -119,15 +119,10 @@ public class Punishment { } public void updateEndTime(int from, String newreason, Timestamp newUpdate, boolean perma) { - StringBuilder newReason = new StringBuilder(this.reason); - newReason.append("verändert von ") - .append(SteamwarUser.get(from).getUserName()) - .append(" von ") - .append(getBantime(endTime, this.perma)) - .append(" auf ") - .append(getBantime(newUpdate, perma)) - .append(" wegen ") - .append(newreason); + String newReason = Message.parse("BAN_CHANGED", SteamwarUser.get(from).getPlayer(), SteamwarUser.get(from).getUserName(), + getBantime(endTime, this.perma), + getBantime(newUpdate, perma), + newreason); SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason.toString(), perma, id); this.reason = newReason.toString(); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8d08c2c4..63f47aca 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -73,7 +73,7 @@ BANNED_MESSAGE_UNTIL=Du bist bis zum {0} gebannt. §r§lGrund§r: §c{1} MUTE_TEAM_MUTED=§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=Du bist bis zum {0} gemuted. §r§lGrund§r: §c{1} -BAN_CHANGED={0} verändert von {1} von +BAN_CHANGED={0} verändert von {1} von {2} auf {3} wegen {4} BAN_INVALID_TIME=§cUngültige Zeitangabe. BAN_PERMA=Permanent BAN_UNTIL=bis zum From fec517f5a1c606a7c3ef1d1b494f7ffa144c761e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 30 Dec 2020 13:28:09 +0100 Subject: [PATCH 016/108] WIP --- src/de/steamwar/bungeecore/BungeeCore.java | 1 - src/de/steamwar/bungeecore/Message.java | 14 +++++++++---- .../bungeecore/commands/BanCommand.java | 4 ++-- .../bungeecore/commands/MsgCommand.java | 2 +- .../bungeecore/commands/MuteCommand.java | 6 +++--- .../bungeecore/commands/RCommand.java | 2 +- .../bungeecore/listeners/BanListener.java | 2 +- .../bungeecore/listeners/ChatListener.java | 4 ++-- .../steamwar/bungeecore/sql/Punishment.java | 16 ++++++++------ .../steamwar/bungeecore/sql/SteamwarUser.java | 21 ++++++++----------- .../steamwar/messages/BungeeCore.properties | 1 + 11 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 971f0ab8..82ff3208 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -55,7 +55,6 @@ public class BungeeCore extends Plugin { public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e"; public static final String TEAMCHAT_PREFIX = "§8TC §e"; - public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"); public static String CHAT_PREFIX; public static String WORLD_FOLDER; diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 1e5e0c06..2d2fbb20 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -31,6 +31,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; +import java.util.function.Function; public class Message { private Message(){} @@ -119,14 +120,19 @@ public class Message { } } - public static void team(String message, Object... params){ + public static void team(String message, Function... params){ team(message, ChatMessageType.SYSTEM, params); } - public static void team(String message, ChatMessageType type, Object... params){ + public static void team(String message, ChatMessageType type, Function... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ - if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) - sendPrefixless(message, player, type, params); + if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) { + Object[] objects = new Object[params.length]; + for (int i = 0; i < params.length; i++) { + objects[i] = params[i].apply(player); + } + sendPrefixless(message, player, type, objects); + } } } } \ No newline at end of file diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index bccd5d9d..52b26385 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -28,6 +27,7 @@ import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; +import java.time.format.DateTimeFormatter; import java.util.Date; public class BanCommand extends BasicCommand { @@ -58,7 +58,7 @@ public class BanCommand extends BasicCommand { String msg = banReason.toString(); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); Message.team("BAN_TEAM_BANNED", target.getUserName(), sender.getName(), - (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + banTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)), msg); + (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + banTime.toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", sender)))), msg); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index 5d5baba3..c013386c 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -48,7 +48,7 @@ public class MsgCommand extends BasicCommand { SteamwarUser user = SteamwarUser.get(player); if(user.isMuted()){ - sender.sendMessage(user.muteMessage()); + sender.sendMessage(user.muteMessage(player)); return; } diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 4cbda7b8..043428eb 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -19,12 +19,12 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import java.sql.Timestamp; +import java.time.format.DateTimeFormatter; public class MuteCommand extends BasicCommand { @@ -53,7 +53,7 @@ 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(), - (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + muteTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT)), msg); + Message.team("MUTE_TEAM_MUTED", player -> target.getUserName(), player -> sender.getName(), + player -> (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", player):Message.parse("BAN_UNTIL", player) + muteTime.toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player)))), player -> msg); } } diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index 566dbcf8..8a1dd039 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -44,7 +44,7 @@ public class RCommand extends BasicCommand { SteamwarUser user = SteamwarUser.get(player); if(user.isMuted()){ - sender.sendMessage(user.muteMessage()); + sender.sendMessage(user.muteMessage(player)); return; } diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index 9c8b85c7..2d276858 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -44,7 +44,7 @@ public class BanListener extends BasicListener { if(user.isBanned()) { user.updateBanIP(event.getConnection().getAddress().getAddress().getHostAddress()); event.setCancelled(true); - event.setCancelReason(user.banMessage()); + event.setCancelReason(user.banMessage((ProxiedPlayer) event.getConnection())); return; } diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 0ee62653..c08c3893 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -137,7 +137,7 @@ public class ChatListener extends BasicListener { SteamwarUser user = SteamwarUser.get(sender); if(user.isMuted()){ - sender.sendMessage(user.muteMessage()); + sender.sendMessage(user.muteMessage(sender)); e.setCancelled(true); return; } @@ -200,7 +200,7 @@ public class ChatListener extends BasicListener { SteamwarUser user = SteamwarUser.get(sender); if(user.isMuted()){ - sender.sendMessage(user.muteMessage()); + sender.sendMessage(user.muteMessage(sender)); e.setCancelled(true); return; } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 321fb871..295a330b 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -21,10 +21,12 @@ package de.steamwar.bungeecore.sql; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; +import net.md_5.bungee.api.connection.ProxiedPlayer; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; +import java.time.format.DateTimeFormatter; import java.util.*; public class Punishment { @@ -119,22 +121,24 @@ public class Punishment { } public void updateEndTime(int from, String newreason, Timestamp newUpdate, boolean perma) { - String newReason = Message.parse("BAN_CHANGED", SteamwarUser.get(from).getPlayer(), SteamwarUser.get(from).getUserName(), + ProxiedPlayer player = BungeeCore.get().getProxy().getPlayer(SteamwarUser.get(from).getUuid()); + String newReason = Message.parse("BAN_CHANGED", player, SteamwarUser.get(from).getUserName(), getBantime(endTime, this.perma), getBantime(newUpdate, perma), newreason); + //TODO Add User - SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason.toString(), perma, id); - this.reason = newReason.toString(); + SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason, perma, id); + this.reason = newReason; this.perma = perma; this.endTime = newUpdate; } - public String getBantime(Timestamp endTime, boolean perma) { + public String getBantime(Timestamp endTime, boolean perma, ProxiedPlayer player) { if(perma) - return Message.parse("BAN_PERMA", SteamwarUser.get(user).getPlayer()); + return Message.parse("BAN_PERMA", player); else - return endTime.toLocalDateTime().format(BungeeCore.DATE_FORMAT); + return endTime.toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player))); } public enum PunishmentType { diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index b1dc3095..b681b24f 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -33,6 +33,7 @@ import java.net.UnknownHostException; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -149,10 +150,6 @@ public class SteamwarUser { return team; } - public ProxiedPlayer getPlayer() { - return BungeeCore.get().getProxy().getPlayer(uuid); - } - public boolean isBanned() { if(!punishments.containsKey(Punishment.PunishmentType.Ban)) return false; @@ -174,22 +171,22 @@ public class SteamwarUser { return punishment.isPerma() || punishment.getEndTime().after(new Date()); } - public TextComponent banMessage(){ + public TextComponent banMessage(ProxiedPlayer player){ Punishment punishment = punishments.get(Punishment.PunishmentType.Ban); if (punishment.isPerma()) { - return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_PERMA", getPlayer(), punishment.getReason())); + return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_PERMA", player, punishment.getReason())); } else { - return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_UNTIL", getPlayer(), punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT), + return BungeeCore.stringToText(Message.parsePrefixed("BANNED_MESSAGE_UNTIL", player, punishment.getEndTime().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player))), punishment.getReason())); } } - public TextComponent muteMessage(){ + public TextComponent muteMessage(ProxiedPlayer player){ Punishment punishment = punishments.get(Punishment.PunishmentType.Mute); if (punishment.isPerma()) { - return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_PERMA", getPlayer(), punishment.getReason())); + return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_PERMA", player, punishment.getReason())); } else { - return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_UNTIL",getPlayer(), punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT), punishment.getReason())); + return BungeeCore.stringToText(Message.parsePrefixed("MUTED_MESSAGE_UNTIL", player, punishment.getEndTime().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player))), punishment.getReason())); } } @@ -208,12 +205,12 @@ public class SteamwarUser { ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid); if(player != null){ updateBanIP(player.getAddress().getAddress().getHostAddress()); - player.disconnect(banMessage()); + player.disconnect(banMessage(player)); for (BannedUserIPs banned: BannedUserIPs.get(player.getAddress().getAddress().getHostAddress())) { SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); if(bannedUser.isBanned() && banned.getTimestamp().before(time)) - bannedUser.ban(time, bannedUser.banReason); + bannedUser.ban(time, banReason, from, perma); } }else updateBanIP(""); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index f1e30150..883a77c0 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -1,5 +1,6 @@ PREFIX=§eSteam§8War» SPACER= +TIMEFORMAT=dd.MM.yyyy HH:mm UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. From 0a472091ba3370b52069ae3f1399b69132bd4f71 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 14 Jan 2021 21:10:24 +0100 Subject: [PATCH 017/108] Hotfix testarena Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/FightCommand.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 1c6cd2ee..6a5dc65d 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -128,15 +128,15 @@ public class FightCommand extends BasicCommand { if(!(sender instanceof ProxiedPlayer)) return; - if(ModLoaderBlocker.isFabric((ProxiedPlayer) sender) && !precommand.equals("/bau testarena")) { - BungeeCore.send((ProxiedPlayer) sender, BungeeCore.CHAT_PREFIX + "§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf?"); - return; - } - ProxiedPlayer player = (ProxiedPlayer) sender; if(alreadyInArena(player)) return; + if(ModLoaderBlocker.isFabric(player) && !precommand.equals("/bau testarena ")) { + BungeeCore.send((ProxiedPlayer) sender, BungeeCore.CHAT_PREFIX + "§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf?"); + return; + } + if(args.length < startArg+1){ getModes(sender, precommand, historic); return; From e76c79c8d8820f2b47337237b6aeffd287d3d79d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 15 Jan 2021 19:29:44 +0100 Subject: [PATCH 018/108] Add Some Refactoring and enabling Doublelayer Messages --- src/de/steamwar/bungeecore/Message.java | 57 +++++++++++++------ .../bungeecore/commands/BanCommand.java | 4 +- .../bungeecore/commands/MuteCommand.java | 4 +- .../bungeecore/commands/WhoisCommand.java | 4 +- .../bungeecore/listeners/BanListener.java | 2 +- .../steamwar/bungeecore/sql/Punishment.java | 6 +- .../steamwar/messages/BungeeCore.properties | 4 +- 7 files changed, 50 insertions(+), 31 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 2d2fbb20..f3f0b26d 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -28,27 +28,36 @@ import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; +import java.text.ChoiceFormat; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; -import java.util.function.Function; public class Message { private Message(){} - public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, Object... params){ - return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, sender, params))); + public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, int[] useFormatter, Object... params){ + return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, sender, useFormatter, params))); + } + + public static String parsePrefixed(String message, CommandSender sender, int[] useFormatter, Object... params){ + return parse(message, true, sender, useFormatter, params); } public static String parsePrefixed(String message, CommandSender sender, Object... params){ - return parse(message, true, sender, params); + return parse(message, true, sender, new int[0], params); + } + + + public static String parse(String message, CommandSender sender, int[] useFormatter, Object... params){ + return parse(message, false, sender, useFormatter, params); } public static String parse(String message, CommandSender sender, Object... params){ - return parse(message, false, sender, params); + return parse(message, false, sender, new int[0], params); } - private static String parse(String message, boolean prefixed, CommandSender sender,Object... params){ + private static String parse(String message, boolean prefixed, CommandSender sender, int[] useFormatter, Object... params){ Locale locale; if(sender instanceof ProxiedPlayer) locale = ((ProxiedPlayer)sender).getLocale(); @@ -61,7 +70,11 @@ public class Message { pattern = resourceBundle.getObject("PREFIX") + " "; pattern += (String)resourceBundle.getObject(message); - return new MessageFormat(pattern, locale).format(params); + MessageFormat format = new MessageFormat(pattern, locale); + for (int i : useFormatter) { + params[i] = new MessageFormat((String) resourceBundle.getObject((String) params[i]), locale).format(params); + } + return format.format(params); } public static void send(String message, CommandSender sender, Object... params){ @@ -80,6 +93,10 @@ public class Message { send(message, false, sender, type, null, null, params); } + public static void sendPrefixless(String message, CommandSender sender, ChatMessageType type, int[] useFormatter, Object... params) { + send(message, false, sender, type, null, null, useFormatter, params); + } + public static void send(String message, CommandSender sender, String onHover, ClickEvent onClick, Object... params){ send(message, true, sender, ChatMessageType.SYSTEM, onHover, onClick, params); } @@ -88,10 +105,10 @@ public class Message { send(message, false, sender, ChatMessageType.SYSTEM, onHover, onClick, params); } - public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, Object... params){ + public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, int[] useFormatter, Object... params){ if(type == ChatMessageType.CHAT && sender instanceof ProxiedPlayer && ((ProxiedPlayer)sender).getChatMode() != ProxiedPlayer.ChatMode.SHOWN) return; - TextComponent msg = parseToComponent(message, prefixed, sender, params); + TextComponent msg = parseToComponent(message, prefixed, sender, useFormatter, params); if(onHover != null) msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover))); if(onClick != null) @@ -102,9 +119,13 @@ public class Message { sender.sendMessage(msg); } + public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, Object... params){ + send(message, prefixed, sender, type, onHover, onClick, new int[0], params); + } + public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) - send(message, player, parse(onHover, false, player), onClick, params); + send(message, player, parse(onHover, false, player, new int[0]), onClick, params); } public static void broadcast(String message, Object... params){ @@ -120,18 +141,18 @@ public class Message { } } - public static void team(String message, Function... params){ - team(message, ChatMessageType.SYSTEM, params); + public static void team(String message, Object... params){ + team(message, ChatMessageType.SYSTEM, new int[0], params); } - public static void team(String message, ChatMessageType type, Function... params){ + public static void team(String message, int[] useChoice, Object... params){ + team(message, ChatMessageType.SYSTEM, useChoice, params); + } + + public static void team(String message, ChatMessageType type, int[] useFormatter, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) { - Object[] objects = new Object[params.length]; - for (int i = 0; i < params.length; i++) { - objects[i] = params[i].apply(player); - } - sendPrefixless(message, player, type, objects); + sendPrefixless(message, player, type, useFormatter, params); } } } diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 52b26385..8e6830f9 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -27,7 +27,6 @@ import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; -import java.time.format.DateTimeFormatter; import java.util.Date; public class BanCommand extends BasicCommand { @@ -57,8 +56,7 @@ public class BanCommand extends BasicCommand { } String msg = banReason.toString(); target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - Message.team("BAN_TEAM_BANNED", target.getUserName(), sender.getName(), - (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", sender):Message.parse("BAN_UNTIL", sender) + banTime.toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", sender)))), msg); + Message.team("BAN_TEAM_BANNED", new int[]{2}, target.getUserName(), sender.getName(), (args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), msg, banTime); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 043428eb..e8661b9f 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -24,7 +24,6 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import java.sql.Timestamp; -import java.time.format.DateTimeFormatter; public class MuteCommand extends BasicCommand { @@ -53,7 +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", player -> target.getUserName(), player -> sender.getName(), - player -> (args[1].equalsIgnoreCase("perma")?Message.parse("BAN_PERMA", player):Message.parse("BAN_UNTIL", player) + muteTime.toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player)))), player -> msg); + Message.team("MUTE_TEAM_MUTED", target.getUserName(), new int[]{2}, sender.getName(), (args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), msg, muteTime); } } diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index d2e2f4b9..4b1d5626 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -20,6 +20,7 @@ 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; import de.steamwar.bungeecore.sql.Team; @@ -28,6 +29,7 @@ import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.text.DecimalFormat; +import java.time.format.DateTimeFormatter; public class WhoisCommand extends BasicCommand { public WhoisCommand(){ @@ -74,7 +76,7 @@ public class WhoisCommand extends BasicCommand { BungeeCore.send(player, "§7Strafen: "); for (Punishment punishment : Punishment.getAllPunishmentsOfPlayer(user.getId())) { BungeeCore.send(player, "§7" + SteamwarUser.get(punishment.getPunisher()).getUserName() + "§8» §f§l" + punishment.getType().name() + ": §e" - + punishment.getStartTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT) + " - " + (punishment.isPerma()?"Perma":punishment.getEndTime().toLocalDateTime().format(BungeeCore.DATE_FORMAT)) + " §c" + punishment.getReason()); + + punishment.getStartTime().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player))) + " - " + (punishment.isPerma()?"Perma":punishment.getEndTime().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player)))) + " §c" + punishment.getReason()); } } } diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index 2d276858..a4fbbecc 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -70,7 +70,7 @@ public class BanListener extends BasicListener { for(BannedUserIPs banned : ips) { SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getUserName(), - banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT))); + banned.getTimestamp().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", target))))); } TextComponent msg = new TextComponent(potentialBan.toString()); diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 295a330b..ada287de 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -134,11 +134,11 @@ public class Punishment { this.endTime = newUpdate; } - public String getBantime(Timestamp endTime, boolean perma, ProxiedPlayer player) { + public String getBantime(Timestamp endTime, boolean perma) { if(perma) - return Message.parse("BAN_PERMA", player); + return "Permanent"; else - return endTime.toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player))); + return endTime.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")); } public enum PunishmentType { diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 883a77c0..35f5a152 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -96,7 +96,7 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] #Various commands ALERT=§f{0} -BAN_TEAM_BANNED=§c {0} wurde von {1} {2} gebannt. §f§lGrund: §f{3} +BAN_TEAM_BANNED=§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=Du bist bis zum {0} gebannt. §r§lGrund§r: §c{1} MUTE_TEAM_MUTED=§c {0} wurde von {1} {2} gemuted. §f§lGrund: §f{3} @@ -105,7 +105,7 @@ MUTED_MESSAGE_UNTIL=Du bist bis zum {0} gemuted. §r§lGrund§r: §c{1} BAN_CHANGED={0} verändert von {1} von {2} auf {3} wegen {4} BAN_INVALID_TIME=§cUngültige Zeitangabe. BAN_PERMA=Permanent -BAN_UNTIL=bis zum +BAN_UNTIL=bis zum {4} BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c BAN_AVOIDING_LIST={0} §e{1} §c BAN_AVOIDING_BAN_HOVER=§cBanne Spieler wegen Bannumgehung From e0222982cbfe40832d5176d35a15b2afa9ab89d0 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 16 Jan 2021 13:38:47 +0100 Subject: [PATCH 019/108] Fixing some Things --- src/de/steamwar/bungeecore/Message.java | 50 +++++++++++-------- .../bungeecore/commands/BanCommand.java | 5 +- .../bungeecore/commands/MuteCommand.java | 2 +- .../bungeecore/commands/WhoisCommand.java | 18 +++---- .../steamwar/bungeecore/sql/Punishment.java | 9 +--- .../steamwar/bungeecore/sql/SteamwarUser.java | 18 ++++++- .../steamwar/messages/BungeeCore.properties | 24 ++++++--- 7 files changed, 78 insertions(+), 48 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 68450855..705bae33 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -28,36 +28,26 @@ import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import java.text.ChoiceFormat; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; public class Message { - private Message(){} - public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, int[] useFormatter, Object... params){ - return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, sender, useFormatter, params))); - } - - public static String parsePrefixed(String message, CommandSender sender, int[] useFormatter, Object... params){ - return parse(message, true, sender, useFormatter, params); + public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, Object... params){ + return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, sender, params))); } public static String parsePrefixed(String message, CommandSender sender, Object... params){ - return parse(message, true, sender, new int[0], params); + return parse(message, true, sender, params); } - public static String parse(String message, CommandSender sender, int[] useFormatter, Object... params){ - return parse(message, false, sender, useFormatter, params); - } - public static String parse(String message, CommandSender sender, Object... params){ - return parse(message, false, sender, new int[0], params); + return parse(message, false, sender, params); } - private static String parse(String message, boolean prefixed, CommandSender sender, int[] useFormatter, Object... params){ + private static String parse(String message, boolean prefixed, CommandSender sender, Object... params){ Locale locale = null; if(sender instanceof ProxiedPlayer) locale = ((ProxiedPlayer)sender).getLocale(); @@ -71,8 +61,11 @@ public class Message { pattern += (String)resourceBundle.getObject(message); MessageFormat format = new MessageFormat(pattern, locale); - for (int i : useFormatter) { - params[i] = new MessageFormat((String) resourceBundle.getObject((String) params[i]), locale).format(params); + for (int i = 0; i < params.length; i++) { + if(params[i] instanceof Message) { + Message msg = (Message) params[i]; + params[i] = parse(msg.getMessage(), sender, msg.getParams()); + } } return format.format(params); } @@ -105,10 +98,10 @@ public class Message { send(message, false, sender, ChatMessageType.SYSTEM, onHover, onClick, params); } - public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, int[] useFormatter, Object... params){ + public static void send(String message, boolean prefixed, CommandSender sender, ChatMessageType type, String onHover, ClickEvent onClick, Object... params){ if(type == ChatMessageType.CHAT && sender instanceof ProxiedPlayer && ((ProxiedPlayer)sender).getChatMode() != ProxiedPlayer.ChatMode.SHOWN) return; - TextComponent msg = parseToComponent(message, prefixed, sender, useFormatter, params); + TextComponent msg = parseToComponent(message, prefixed, sender, params); if(onHover != null) msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover))); if(onClick != null) @@ -143,8 +136,25 @@ public class Message { public static void team(String message, ChatMessageType type, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ - if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) + if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) { sendPrefixless(message, player, type, params); + } } } + + private final String message; + private final Object[] params; + + public Message(String message, Object... params) { + this.message = message; + this.params = params; + } + + public String getMessage() { + return message; + } + + public Object[] getParams() { + return params; + } } \ No newline at end of file diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 8e6830f9..e977fefe 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -54,9 +54,10 @@ public class BanCommand extends BasicCommand { for (int i = 2; i < args.length; i++){ banReason.append(args[i]).append(" "); } + boolean isPerma = args[1].equalsIgnoreCase("perma"); String msg = banReason.toString(); - target.ban(banTime, msg, SteamwarUser.get(sender.getName()).getId(), args[1].equalsIgnoreCase("perma")); - Message.team("BAN_TEAM_BANNED", new int[]{2}, target.getUserName(), sender.getName(), (args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), msg, banTime); + 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); } public static Timestamp parseTime(CommandSender sender, String arg){ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index e8661b9f..0ab8d29f 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -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(), new int[]{2}, sender.getName(), (args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), msg, muteTime); + Message.team("MUTE_TEAM_MUTED", target.getUserName(), sender.getName(), new Message((args[1].equalsIgnoreCase("perma")?"BAN_PERMA":"BAN_UNTIL"), muteTime), msg); } } diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index 4b1d5626..567574e5 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -29,7 +29,6 @@ import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.text.DecimalFormat; -import java.time.format.DateTimeFormatter; public class WhoisCommand extends BasicCommand { public WhoisCommand(){ @@ -64,19 +63,18 @@ public class WhoisCommand extends BasicCommand { } private static void sendUserinfo(ProxiedPlayer player, SteamwarUser user) { - BungeeCore.send(player, "§7Username§8: §e" + user.getUserName()); - BungeeCore.send(player, "§7UUID§8: §e" + user.getUuid().toString(), "", new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, user.getUuid().toString())); - BungeeCore.send(player, "§7ID§8: §e" + user.getId()); - BungeeCore.send(player, "§7Beigetreten am§8: §e" + user.getFirstjoin().toString()); - BungeeCore.send(player, "§7Online Time§8: §e" + new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600) + "h"); + 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()); + Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); Team team = Team.get(user.getTeam()); - BungeeCore.send(player, "§7Team§8: §e" + team.getTeamName()); + Message.send("WHOIS_TEAM", player, team.getTeamColor(), team.getTeamKuerzel(), team.getTeamName()); - BungeeCore.send(player, "§7Strafen: "); + Message.send("WHOIS_PUNISHMENTS", player); for (Punishment punishment : Punishment.getAllPunishmentsOfPlayer(user.getId())) { - BungeeCore.send(player, "§7" + SteamwarUser.get(punishment.getPunisher()).getUserName() + "§8» §f§l" + punishment.getType().name() + ": §e" - + punishment.getStartTime().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player))) + " - " + (punishment.isPerma()?"Perma":punishment.getEndTime().toLocalDateTime().format(DateTimeFormatter.ofPattern(Message.parse("TIMEFORMAT", player)))) + " §c" + punishment.getReason()); + 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()); } } } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index ada287de..964961d5 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -44,12 +44,8 @@ public class Punishment { public static Map getPunishmentsOfPlayer(int user) { Map punishmentMap = new HashMap<>(); - for (PunishmentType type : PunishmentType.values()) { - Punishment punishment = getPunishmentOfPlayer(user, type); - if(punishment == null) - continue; - punishmentMap.put(type, punishment); - } + punishmentMap.put(PunishmentType.Ban, getPunishmentOfPlayer(user, PunishmentType.Ban)); + punishmentMap.put(PunishmentType.Mute, getPunishmentOfPlayer(user, PunishmentType.Mute)); return punishmentMap; } @@ -126,7 +122,6 @@ public class Punishment { getBantime(endTime, this.perma), getBantime(newUpdate, perma), newreason); - //TODO Add User SQL.update("UPDATE Punishments SET EndTime = ?, Reason = ?, Perma = ? WHERE PunishmentId = ?", newUpdate, newReason, perma, id); this.reason = newReason; diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index b681b24f..08ec23b9 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -33,6 +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; @@ -70,7 +71,7 @@ public class SteamwarUser { usersById.put(id, this); usersByName.put(userName.toLowerCase(), this); usersByUUID.put(uuid, this); - punishments = Punishment.getPunishmentsOfPlayer(id); + punishments = null; } public static SteamwarUser getOrCreate(PendingConnection connection){ @@ -150,7 +151,14 @@ 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))) { @@ -162,6 +170,7 @@ public class SteamwarUser { } public boolean isMuted(){ + loadPunishments(); if(!punishments.containsKey(Punishment.PunishmentType.Mute)) return false; return isCurrent(punishments.get(Punishment.PunishmentType.Mute)); @@ -172,6 +181,7 @@ public class SteamwarUser { } 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())); @@ -182,6 +192,7 @@ 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())); @@ -195,6 +206,7 @@ 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; @@ -217,6 +229,7 @@ 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; @@ -249,7 +262,8 @@ public class SteamwarUser { public Timestamp getFirstjoin() { ResultSet set = SQL.select("SELECT MIN(StartTime) AS FirstJoin FROM Session WHERE UserID = ?", id); try { - set.next(); + if(!set.next()) + return Timestamp.from(Instant.MIN); return set.getTimestamp("FirstJoin"); } catch (SQLException throwables) { throw new SecurityException("Could not load First Join"); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 77412b93..5c06f672 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -100,16 +100,17 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] #Various commands ALERT=§f{0} +#Ban&Mute-Command BAN_TEAM_BANNED=§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=Du bist bis zum {0} gebannt. §r§lGrund§r: §c{1} -MUTE_TEAM_MUTED=§c {0} wurde von {1} {2} gemuted. §f§lGrund: §f{3} +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} MUTED_MESSAGE_PERMA=§cDu bist permanent gemuted. §r§lGrund§r: §c{0} -MUTED_MESSAGE_UNTIL=Du bist bis zum {0} gemuted. §r§lGrund§r: §c{1} -BAN_CHANGED={0} verändert von {1} von {2} auf {3} wegen {4} +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_PERMA=Permanent -BAN_UNTIL=bis zum {4} +BAN_UNTIL=bis zum {0} BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c BAN_AVOIDING_LIST={0} §e{1} §c BAN_AVOIDING_BAN_HOVER=§cBanne Spieler wegen Bannumgehung @@ -157,4 +158,15 @@ CHECK_RANK_HOVER=§aMit diesem Rang freigeben CHECK_ACCEPTED=§aDein §e{0} {1} §ewurde freigegeben§8! CHECK_ACCEPTED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7ist nun freigegeben! 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! \ No newline at end of file +CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von §e{2} §7abgelehnt! + +#WhoisCommand +WHOIS_USERNAME=§7Username§8: §e{0} +WHOIS_UUID=§7UUID§8: §e{0} +WHOIS_UUID_HOVER=§eUUID Kopieren +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_PUNISHMENTS=§7Strafen: +WHOIS_PUNISHMENT=§7{0}§8» §f§l{1}: §e{2} - {3} §f{4} \ No newline at end of file From 0d643d618af0231312c9c34c66a1296a3ecb5157 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 16 Jan 2021 13:50:34 +0100 Subject: [PATCH 020/108] Add ML to Mod Autoban --- src/de/steamwar/bungeecore/listeners/mods/Utils.java | 9 +++++---- src/de/steamwar/messages/BungeeCore.properties | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Utils.java b/src/de/steamwar/bungeecore/listeners/mods/Utils.java index 1ca83e3e..e6907c5c 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Utils.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Utils.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.listeners.mods; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Mod; import de.steamwar.bungeecore.sql.Mod.ModType; import de.steamwar.bungeecore.sql.SteamwarUser; @@ -72,9 +73,9 @@ class Utils { if(mods.size() == 1){ if(max == ModType.YELLOW) - player.disconnect(BungeeCore.stringToText("§7Deaktiviere den Mod §e" + mods.get(0).getModName() + "§7, um weiter auf §eSteam§8War §7spielen zu können.")); + player.disconnect(BungeeCore.stringToText(Message.parse("MOD_YELLOW_SING", player, mods.get(0).getModName()))); else{ - user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung des Mods " + mods.get(0).getModName(), 0, false); + user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), Message.parse("MOD_RED_SING", player, mods.get(0).getModName()), 0, false); BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen des Mods " + mods.get(0).getModName() + " gebannt."); } }else{ @@ -82,9 +83,9 @@ class Utils { mods.forEach(mod -> sb.append(mod.getModName()).append('\n')); if(max == ModType.YELLOW) - player.disconnect(BungeeCore.stringToText("§7Deaktiviere die Mods\n§e" + sb.toString() + "§7um weiter auf §eSteam§8War §7spielen zu können.")); + player.disconnect(BungeeCore.stringToText(Message.parse("MOD_YELLOW_PLUR", player, sb.toString()))); else{ - user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), "Versuchte Benutzung der Mods\n" + sb.toString(), 0, false); + user.ban(Timestamp.from(Instant.now().plus(7, ChronoUnit.DAYS)), Message.parse("MOD_RED_PLUR", player, sb.toString()), 0, false); BungeeCore.log(Level.SEVERE, user.getUserName() + " " + user.getId() + " wurde automatisch wegen der Mods " + sb.toString() + " gebannt."); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 5c06f672..84877033 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -97,6 +97,12 @@ USAGE_BAN=§8/§7ban §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd USAGE_MUTE=§8/§7mute §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] 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_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. + #Various commands ALERT=§f{0} From f99b10ade201d51ccd7185edf3a526d15731bd34 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 16 Jan 2021 16:41:34 +0100 Subject: [PATCH 021/108] Fix NPE --- src/de/steamwar/bungeecore/listeners/BanListener.java | 1 - src/de/steamwar/bungeecore/sql/Punishment.java | 10 ++++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index a4fbbecc..c62a17d0 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.BannedUserIPs; import de.steamwar.bungeecore.sql.SteamwarUser; diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 964961d5..0e47e053 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -43,10 +43,12 @@ public class Punishment { } public static Map getPunishmentsOfPlayer(int user) { - Map punishmentMap = new HashMap<>(); - punishmentMap.put(PunishmentType.Ban, getPunishmentOfPlayer(user, PunishmentType.Ban)); - punishmentMap.put(PunishmentType.Mute, getPunishmentOfPlayer(user, PunishmentType.Mute)); - return punishmentMap; + Map 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); + return punishments; } public static List getAllPunishmentsOfPlayer(int user) { From 9970266d90a854cda7f8867ea8c4095dab2e4e92 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 16 Jan 2021 18:36:19 +0100 Subject: [PATCH 022/108] Fix Ban Changed --- src/de/steamwar/bungeecore/sql/Punishment.java | 3 ++- src/de/steamwar/messages/BungeeCore.properties | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 0e47e053..2e14a2a9 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -120,7 +120,8 @@ public class Punishment { public void updateEndTime(int from, String newreason, Timestamp newUpdate, boolean perma) { ProxiedPlayer player = BungeeCore.get().getProxy().getPlayer(SteamwarUser.get(from).getUuid()); - String newReason = Message.parse("BAN_CHANGED", player, SteamwarUser.get(from).getUserName(), + String newReason = Message.parse("BAN_CHANGED", player, reason, + SteamwarUser.get(from).getUserName(), getBantime(endTime, this.perma), getBantime(newUpdate, perma), newreason); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 84877033..f61d1eac 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -121,8 +121,6 @@ BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: §c BAN_AVOIDING_LIST={0} §e{1} §c BAN_AVOIDING_BAN_HOVER=§cBanne Spieler wegen Bannumgehung -MUTE_MESSAGE_YOU=§7Du hast §e{0} §7gemutet§8. §7Grund§8: §c{1} - BUG_MESSAGE=§7Dein Bugreport wurde gespeichert. IGNORE_YOURSELF=§cWie willst du dich selber ignorieren? From 898a948512d6803a23f7b0d25079977fcf25b321 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 16 Jan 2021 19:47:21 +0100 Subject: [PATCH 023/108] Fixing Whois --- .../bungeecore/commands/WhoisCommand.java | 23 ++++++++++++++----- .../steamwar/bungeecore/sql/SteamwarUser.java | 10 ++++---- .../steamwar/messages/BungeeCore.properties | 14 ++++++----- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index 567574e5..a183f009 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -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 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()); } } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 08ec23b9..3f926a66 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -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; } - 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"); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index f61d1eac..9b9df0d6 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -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} \ No newline at end of file +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. \ No newline at end of file From 4a5ccc0bbf4f5acd30a58b5a9a32f8dae3cc9b29 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 03:17:13 +0100 Subject: [PATCH 024/108] Remove Unused Method --- src/de/steamwar/bungeecore/Message.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 705bae33..88f2b7f3 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -86,10 +86,6 @@ public class Message { send(message, false, sender, type, null, null, params); } - public static void sendPrefixless(String message, CommandSender sender, ChatMessageType type, int[] useFormatter, Object... params) { - send(message, false, sender, type, null, null, useFormatter, params); - } - public static void send(String message, CommandSender sender, String onHover, ClickEvent onClick, Object... params){ send(message, true, sender, ChatMessageType.SYSTEM, onHover, onClick, params); } From 45e97702ca7596899c40d545303eb2c1da1caa43 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 03:18:19 +0100 Subject: [PATCH 025/108] Fix Message Name --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9b9df0d6..0b8b8309 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -164,7 +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_SYNTAX=§c/whois [Spieler/ID] WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eUUID Kopieren From cac7b662087acd7860bca3bfae5b53b1350ebb0b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 03:18:36 +0100 Subject: [PATCH 026/108] Remove Unused Import --- src/de/steamwar/bungeecore/commands/WhoisCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index a183f009..c774ac1f 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -29,7 +29,6 @@ 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 { From a4359b6dd5776837233126bdaebada26a1af94de Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 20:04:30 +0100 Subject: [PATCH 027/108] Add BauCommand ML --- .../bungeecore/commands/BauCommand.java | 46 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 19 ++++++++ 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 8f39327f..87fd8dbc 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -34,8 +34,6 @@ public class BauCommand { private BauCommand(){} - private static final String UNKNOWN_PLAYER = BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler"; - public static void onBau(ChatEvent e, String[] command){ if(BungeeCore.EVENT_MODE) return; @@ -115,43 +113,43 @@ public class BauCommand { private static void addmember(ProxiedPlayer p, String[] command){ if (command.length == 2) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau addmember "); + Message.send("BAU_ADDMEMBER_SYNTAX", p); return; } SteamwarUser target = SteamwarUser.get(command[2]); if (target == null) { - BungeeCore.send(p, UNKNOWN_PLAYER); + Message.send("UNKNOWN_PLAYER", p); return; }else if(target.getUuid().equals(p.getUniqueId())) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu brauchst dich nicht selbst hinzufügen!"); + Message.send("BAU_ADDMEMBER_SELFADD", p); return; }else if (BauweltMember.getBauMember(p.getUniqueId(), target.getUuid()) != null) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist bereits Mitglied auf deiner Welt"); + Message.send("BAU_ADDMEMBER_ISADDED", p); return; } new BauweltMember(p.getUniqueId(), target.getUuid(), true, false, false); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt"); + Message.send("BAU_ADDMEMBER_ADDED", p); ProxiedPlayer z = ProxyServer.getInstance().getPlayer(target.getUuid()); if(z != null) - BungeeCore.send(z, BungeeCore.CHAT_PREFIX + "§aDu wurdest zu der Welt von §6" + p.getName() + " §ahinzugefügt"); + Message.send("BAU_ADDMEMBER_ADDED_TARGET", p, p.getName()); } private static void teleport(ProxiedPlayer p, String[] command){ if (command.length == 2) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau tp "); + Message.send("BAU_TP_SYNTAX", p); return; } SteamwarUser worldOwner = SteamwarUser.get(command[2]); if (worldOwner == null) { - BungeeCore.send(p, UNKNOWN_PLAYER); + Message.send("UNKNOWN_PLAYER", p); return; }else if (!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null){ SubserverSystem.sendDeniedMessage(p, worldOwner.getUuid()); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu darfst dich nicht auf diese Welt teleportieren"); + Message.send("BAU_TP_NOALLOWED", p); return; } @@ -214,7 +212,7 @@ public class BauCommand { private static void delmember(ProxiedPlayer p, String[] command){ if (command.length == 2) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau delmember "); + Message.send("BAU_DELMEMBER_SYNTAX", p); return; } @@ -223,19 +221,19 @@ public class BauCommand { return; if(SteamwarUser.get(target.getMemberID()).getUuid().equals(p.getUniqueId())) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu kannst dich nicht selbst entfernen!"); + Message.send("BAU_DELMEMBER_SELFDEL", p); return; } target.remove(); ProxiedPlayer z = ProxyServer.getInstance().getPlayer(SteamwarUser.get(target.getMemberID()).getUuid()); if(z != null){ - BungeeCore.send(z, BungeeCore.CHAT_PREFIX + "§cDu wurdest von der Welt von §6" + p.getName() + " §centfernt."); + Message.send("BAU_DELMEMBER_DELETED_TARGET", z, p.getName()); Subserver server = Subserver.getSubserver(z); if(server != null && server.getType() == Servertype.BAUSERVER && ((Bauserver)server).getOwner().equals(p.getUniqueId())) z.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LOBBY_SERVER)); } - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Spieler wurde entfernt."); + Message.send("BAU_DELMEMBER_DELETED", p); } private static void delete(ProxiedPlayer p, String[] command){ @@ -255,7 +253,7 @@ public class BauCommand { } private static void deleteWorld(ProxiedPlayer player, String world) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDeine Welt wird zurückgesetzt."); + Message.send("BAU_DELETE_DELETED", player); ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { for (Subserver subserver : Subserver.getServerList()) { if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(player.getUniqueId())) { @@ -273,7 +271,7 @@ public class BauCommand { for (Subserver subserver : Subserver.getServerList()) { if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { if(subserver.getServer().getPlayers().isEmpty()){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Server startet bereits."); + Message.send("BAU_START_ALREADY", p); return; } subserver.stop(); @@ -291,13 +289,13 @@ public class BauCommand { private static BauweltMember member(ProxiedPlayer p, SteamwarUser member){ if (member == null) { - BungeeCore.send(p, UNKNOWN_PLAYER); + Message.send("UNKNOWN_PLAYER", p); return null; } BauweltMember target = BauweltMember.getBauMember(p.getUniqueId(), member.getUuid()); if (target == null) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt!"); + Message.send("BAU_MEMBER_NOMEMBER", p); return null; } return target; @@ -305,7 +303,7 @@ public class BauCommand { private static BauweltMember toggle(ProxiedPlayer p, String[] command, String subcommand){ if (command.length == 2) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "/bau " + subcommand + " "); + Message.send("BAU_MEMBER_TOGGLE_SYNTAX", p, subcommand); return null; } @@ -318,12 +316,12 @@ public class BauCommand { if(permission){ if(player != null) - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDu kannst nun auf der Welt von §e" + p.getName() + "§a " + what); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§aDer Spieler darf nun " + what); + Message.send("BAU_MEMBER_TOGGLE_TARGET", p, p.getName(), what); + Message.send("BAU_MEMBER_TOGGLE", p, what); }else{ if(player != null) - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §e" + p.getName() + "§c " + what); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDer Spieler darf nun nicht mehr " + what); + Message.send("BAU_MEMBER_TOGGLE_TARGET_OFF", p, p.getName(), what); + Message.send("BAU_MEMBER_TOGGLE_OFF", p, what); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 0b11312e..32ad2b2f 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -116,9 +116,28 @@ POLLRESULT_HEADER=§eEs haben {0} abgestimmt auf die Frage: §7{1} POLLRESULT_LIST=§e{0}§8: §7{1} #BauCommand +BAU_ADDMEMBER_SYNTAX=/bau addmember +BAU_ADDMEMBER_SELFADD=§cDu brauchst dich nicht selbst hinzufügen! +BAU_ADDMEMBER_ISADDED=§cDieser Spieler ist bereits Mitglied auf deiner Welt +BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt +BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §6{0} §ahinzugefügt +BAU_TP_SYNTAX=/bau tp +BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren +BAU_DELMEMBER_SYNTAX=/bau delmember +BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! +BAU_DELMEMBER_DELETED=§cDer Spieler wurde entfernt. +BAU_DELMEMBER_DELETED_TARGET=§cDu wurdest von der Welt von §6{0} §centfernt. +BAU_DELETE_DELETED=§aDeine Welt wird zurückgesetzt. BAU_DELETE_GUI_NAME=§eWirklich Welt löschen? BAU_DELETE_GUI_CANCEL=§cAbbrechen BAU_DELETE_GUI_DELETE=§aLöschen +BAU_START_ALREADY=§cDer Server startet bereits. +BAU_MEMBER_NOMEMBER=§cDer Spieler ist kein Mitglied deiner Welt! +BAU_MEMBER_TOGGLE_SYNTAX=/bau {0} +BAU_MEMBER_TOGGLE_TARGET=§aDu kannst nun auf der Welt von §e{0}§a {1} +BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0} +BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1} +BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0} #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! From 8dc4bd5f618ff1f9f5dc41a9ac350ed043b91ac7 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 20:49:24 +0100 Subject: [PATCH 028/108] Add ChallengeCommand ML --- src/de/steamwar/bungeecore/Message.java | 5 ++++ .../bungeecore/commands/ChallengeCommand.java | 26 ++++++++----------- .../steamwar/messages/BungeeCore.properties | 15 +++++++++++ 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 65f1dec3..b2c471a8 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -101,6 +101,11 @@ public class Message { sender.sendMessage(msg); } + public static void broadcast(String message, boolean prefixed, String onHover, ClickEvent onClick, Object... params){ + for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) + send(message, player, parse(onHover, prefixed, player), onClick, params); + } + public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) send(message, player, parse(onHover, false, player), onClick, params); diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 231081b7..333819d3 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -40,7 +40,7 @@ public class ChallengeCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§echallenge §8[§7Spieler§8]"); + Message.send("CHALLENGE_SYNTAX", sender); return; } @@ -48,25 +48,25 @@ public class ChallengeCommand extends BasicCommand { return; if(ModLoaderBlocker.isFabric((ProxiedPlayer) sender)) { - BungeeCore.send((ProxiedPlayer) sender, BungeeCore.CHAT_PREFIX + "§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf?"); + Message.send("CHALLENGE_FABRIC", sender); return; } ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDer Herausgeforderte ist nicht online."); + Message.send("CHALLENGE_OFFLINE", sender); return; }else if(target == sender){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cSchizophren?"); + Message.send("CHALLENGE_SELF", sender); return; }else if (IgnoreSystem.isIgnored(target, (ProxiedPlayer) sender)) { - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDer Herausgeforderte hat dich geblockt."); + Message.send("CHALLENGE_IGNORED", sender); return; } Subserver subserver = Subserver.getSubserver(target); if(subserver != null && subserver.getType() == Servertype.ARENA){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDer Herausgeforderte ist bereits in einer Arena."); + Message.send("CHALLENGE_INARENA", sender); return; } @@ -80,9 +80,8 @@ public class ChallengeCommand extends BasicCommand { arena.sendPlayer(player); arena.sendPlayer(target); - BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§e" + mode.getDisplayName() + "§7-§eDuell§7: " + player.getName() + " vs " + target.getName(), - "§aZuschauen", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); + Message.broadcast("CHALLENGE_BROADCAST", sender, true, Message.parse("CHALLENGE_BROADCAST_HOVER", player), //Needs BanSystemRework for Loading from Message File + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getDisplayName(), target.getDisplayName()); }else{ if(!challenges.containsKey(player)){ challenges.put(player, new LinkedList<>()); @@ -90,13 +89,10 @@ public class ChallengeCommand extends BasicCommand { challenges.get(player).add(target); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast §e" + target.getName() + " §7zu einem §e" + mode.getDisplayName() + "-Kampf §7herausgefordert!"); - BungeeCore.send(target, BungeeCore.CHAT_PREFIX + "§e" + player.getName() + " §7 hat dich zu einem §e" + mode.getDisplayName() + - "-Kampf §7" + (mode.getMaps().size()!=1?"auf §e" + map + " §7 ":"") + "herausgefordert!"); + Message.send("CHALLENGE_CHALLENGED", player, target.getName(), mode.getDisplayName()); + Message.send("CHALLENGE_CHALLENGED_TARGET", target, player.getName(), mode.getDisplayName(), mode.getMaps().size()!=1?Message.parse("CHALLENGE_CHALLENGED_MAP", target, map):""); - BungeeCore.send(target, BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um die Herausforderung anzunehmen", - "§aHerausforderung annehmen", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge " + player.getName() + " " + mode.getChatName() + " " + map)); + Message.send("CHALLENGE_ACCEPT", target, Message.parse("CHALLENGE_ACCEPT_HOVER", target), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge " + player.getName() + " " + mode.getChatName() + " " + map)); } }); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 32ad2b2f..bca8aee6 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -139,6 +139,21 @@ BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0} BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1} BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0} +#ChallengeCommand +CHALLENGE_SYNTAX=§8/§echallenge §8[§7Spieler§8] +CHALLENGE_FABRIC=§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf? +CHALLENGE_OFFLINE=§cDer Herausgeforderte ist nicht online. +CHALLENGE_SELF=§cSchizophren? +CHALLENGE_IGNORED=§cDer Herausgeforderte hat dich geblockt. +CHALLENGE_INARENA=§cDer Herausgeforderte ist bereits in einer Arena. +CHALLENGE_BROADCAST=§e{0}§7-§eDuell§7: {1} vs {2} +CHALLENGE_BROADCAST_HOVER=§aZuschauen +CHALLENGE_CHALLENGED=§7Du hast §e{0} §7zu einem §e{1}-Kampf §7herausgefordert! +CHALLENGE_CHALLENGED_TARGET=§e{0} §7 hat dich zu einem §e{1}-Kampf §7{2}herausgefordert! +CHALLENGE_CHALLENGED_MAP=auf §e{0} §7 +CHALLENGE_ACCEPT=§7Klicke §ehier§7, um die Herausforderung anzunehmen +CHALLENGE_ACCEPT_HOVER=§aHerausforderung annehmen + #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. From 1b77a53c857d62e6e3c463cb1940e356a2bb7edf Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 21:38:28 +0100 Subject: [PATCH 029/108] Add EventCommand ML --- .../bungeecore/commands/EventCommand.java | 44 ++++++++----------- .../steamwar/messages/BungeeCore.properties | 16 +++++++ 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 6e4b8e54..a81d075c 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -21,6 +21,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.EventStarter; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.EventFight; @@ -37,9 +38,6 @@ import java.util.Set; public class EventCommand extends BasicCommand { - public static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ofPattern("HH:mm"); - static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM."); - public EventCommand() { super("event", ""); } @@ -64,13 +62,13 @@ public class EventCommand extends BasicCommand { Team team = Team.get(args[0]); if(team == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Team gibt es nicht"); + Message.send("EVENT_NO_TEAM", player); return; } Subserver eventArena = EventStarter.getEventServer().get(team.getTeamId()); if(eventArena == null || !Subserver.getServerList().contains(eventArena)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas Team kämpft derzeit nicht"); + Message.send("EVENT_NO_FIGHT_TEAM", player); return; } @@ -78,23 +76,20 @@ public class EventCommand extends BasicCommand { } private void noCurrentEvent(ProxiedPlayer player){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDerzeit findet kein Event statt"); + Message.send("EVENT_NO_CURRENT", player); List coming = Event.getComing(); if(!coming.isEmpty()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§eKommende Events§8:"); + DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); + Message.send("EVENT_COMING", player); for(Event e : coming){ - BungeeCore.send(player, "§7" + - e.getStart().toLocalDateTime().format(DATE_FORMAT) + - "§8-§7" + - e.getEnd().toLocalDateTime().format(DATE_FORMAT) + - "§8: §e" + - e.getEventName()); + Message.send("EVENT_COMING_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEnd().toLocalDateTime().format(dateFormat), e.getEventName()); Set teams = TeamTeilnahme.getTeams(e.getEventID()); if(!teams.isEmpty()){ - StringBuilder tline = new StringBuilder("§7 Mit§8: "); + StringBuilder tline = new StringBuilder(); for(Team t : teams){ - tline.append("§").append(t.getTeamColor()).append(t.getTeamKuerzel()).append(" "); + tline.append(Message.parse("EVENT_COMING_TEAM", player, t.getTeamColor(), t.getTeamKuerzel())); } + Message.send("EVENT_COMING_TEAMS", player, tline.toString()); BungeeCore.send(player, tline.toString()); } } @@ -102,33 +97,30 @@ public class EventCommand extends BasicCommand { } private void eventOverview(ProxiedPlayer player, Event currentEvent){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren"); + Message.send("EVENT_SYNTAX", player); List fights = EventFight.getEvent(currentEvent.getEventID()); Instant now = Instant.now(); - BungeeCore.send(player, "§e§l" + currentEvent.getEventName()); + Message.send("EVENT_CURRENT_EVENT", player, currentEvent.getEventName()); + DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_TIME_FORMAT", player)); for(EventFight fight : fights){ Team blue = Team.get(fight.getTeamBlue()); Team red = Team.get(fight.getTeamRed()); - StringBuilder fline = new StringBuilder("§7") - .append(fight.getStartTime().toLocalDateTime().format(TIME_FORMAT)) - .append(" §e") - .append(blue.getTeamKuerzel()) - .append("§8 vs §e") - .append(red.getTeamKuerzel()); + StringBuilder fline = new StringBuilder(Message.parse("EVENT_CURRENT_FIGHT", player, fight.getStartTime().toLocalDateTime().format(timeFormat), blue.getTeamColor(), blue.getTeamKuerzel(), + red.getTeamColor(), red.getTeamKuerzel())); if(now.isAfter(fight.getStartTime().toInstant().plus(35, ChronoUnit.MINUTES))){ switch(fight.getErgebnis()){ case 1: - fline.append("§8: §7Sieg §e").append(blue.getTeamKuerzel()); + fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, blue.getTeamColor(), blue.getTeamKuerzel())); break; case 2: - fline.append("§8: §7Sieg §e").append(red.getTeamKuerzel()); + fline.append(Message.parse("EVENT_CURRENT_FIGHT_WIN", player, red.getTeamColor(), red.getTeamKuerzel())); break; default: - fline.append("§8: §7Unentschieden"); + fline.append(Message.parse("EVENT_CURRENT_FIGHT_DRAW", player)); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index bca8aee6..4867c697 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -154,6 +154,22 @@ CHALLENGE_CHALLENGED_MAP=auf §e{0} §7 CHALLENGE_ACCEPT=§7Klicke §ehier§7, um die Herausforderung anzunehmen CHALLENGE_ACCEPT_HOVER=§aHerausforderung annehmen +#EventCommand +EVENT_TIME_FORMAT=HH:mm +EVENT_DATE_FORMAT=dd.MM. +EVENT_SYNTAX=§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren +EVENT_NO_TEAM=§cDieses Team gibt es nicht +EVENT_NO_FIGHT_TEAM=§cDas Team kämpft derzeit nicht +EVENT_NO_CURRENT=§cDerzeit findet kein Event statt +EVENT_COMING=§eKommende Events§8: +EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} +EVENT_COMING_TEAMS=§7 Mit§8:{0} +EVENT_COMING_TEAM= §{0}{1} +EVENT_CURRENT_EVENT=§e§l{0} +EVENT_CURRENT_FIGHT=§7{0} §{1}{2}§8 vs §{3}{4} +EVENT_CURRENT_FIGHT_WIN=§8: §7Sieg §{0}{1} +EVENT_CURRENT_FIGHT_DRAW=§8: §7Unentschieden + #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. From 5d23d3689792dc888000e05b321c6e5f0815f480 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 22:36:24 +0100 Subject: [PATCH 030/108] Add EventRescheduleCommand ML --- .../bungeecore/commands/EventRescheduleCommand.java | 9 +++++---- src/de/steamwar/messages/BungeeCore.properties | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java index e17d6c15..9f2fac44 100644 --- a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.Team; @@ -44,7 +45,7 @@ public class EventRescheduleCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c/eventreschedule [Team1 (Blue)] [Team2 (Red)]"); + Message.send("EVENTRESCHEDULE_SYNTAX", player); return; } @@ -52,7 +53,7 @@ public class EventRescheduleCommand extends BasicCommand { Team teamRed = Team.get(args[1]); Event event = Event.get(); if(teamBlue == null || teamRed == null || event == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Team ist unbekannt / Derzeit kein Event"); + Message.send("EVENTRESCHEDULE_UNKNOWN_TEAM", player); return; } @@ -65,13 +66,13 @@ public class EventRescheduleCommand extends BasicCommand { continue; if(fight.getTeamBlue() == teamBlue.getTeamId() && fight.getTeamRed() == teamRed.getTeamId()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aKampf startet in 30s"); + Message.send("EVENTRESCHEDULE_STARTING", player); fight.reschedule(); EventFight.loadAllComingFights(); return; } } - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cKein Kampf zwischen den Teams gefunden"); + Message.send("EVENTRESCHEDULE_NO_FIGHT", player); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 4867c697..7f4d6e7e 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -170,6 +170,12 @@ EVENT_CURRENT_FIGHT=§7{0} §{1}{2}§8 vs §{3}{4} EVENT_CURRENT_FIGHT_WIN=§8: §7Sieg §{0}{1} EVENT_CURRENT_FIGHT_DRAW=§8: §7Unentschieden +#EventRescheduleCommand +EVENTRESCHEDULE_SYNTAX=§c/eventreschedule [Team1 (Blue)] [Team2 (Red)] +EVENTRESCHEDULE_UNKNOWN_TEAM=§cEin Team ist unbekannt / Derzeit kein Event +EVENTRESCHEDULE_NO_FIGHT="§cKein Kampf zwischen den Teams gefunden" +EVENTRESCHEDULE_STARTING=§aKampf startet in 30s + #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. From e74fa6765b89b2d3e19f381a6cc121a7993f7e97 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 23:15:44 +0100 Subject: [PATCH 031/108] Add FightCommand ML --- .../bungeecore/commands/ChallengeCommand.java | 2 +- .../bungeecore/commands/FightCommand.java | 16 +++++++--------- src/de/steamwar/messages/BungeeCore.properties | 10 +++++++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 333819d3..fe4c80d7 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -48,7 +48,7 @@ public class ChallengeCommand extends BasicCommand { return; if(ModLoaderBlocker.isFabric((ProxiedPlayer) sender)) { - Message.send("CHALLENGE_FABRIC", sender); + Message.send("FIGHT_FABRIC", sender); return; } diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 6a5dc65d..362137e4 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -51,7 +51,7 @@ public class FightCommand extends BasicCommand { if(mode != null) return mode; - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spielmodus: " + arg); + Message.send("FIGHT_UNKNOWN_GAMEMODE", sender, arg); return null; } @@ -62,7 +62,7 @@ public class FightCommand extends BasicCommand { if(arg.equalsIgnoreCase("Random")) return mode.getRandomMap(); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDie gewünschte Arena gibt es nicht."); + Message.send("FIGHT_UNKNOWN_ARENA", sender); return null; } @@ -93,7 +93,7 @@ public class FightCommand extends BasicCommand { String command = precommand + mode.getChatName() + " Random"; start.setBold(true); start.setColor(ChatColor.GRAY); - start.setText("Random "); + start.setText(Message.parse("FIGHT_ARENA_RANDOM", sender) + " "); start.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§e" + command).create())); start.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)); current = new TextComponent(); @@ -117,7 +117,7 @@ public class FightCommand extends BasicCommand { private static boolean alreadyInArena(ProxiedPlayer player){ Subserver subserver = Subserver.getSubserver(player); if(subserver != null && subserver.getType() == Servertype.ARENA){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu befindest dich bereits in einer Arena."); + Message.send("FIGHT_IN_ARENA", player); return true; } @@ -133,7 +133,7 @@ public class FightCommand extends BasicCommand { return; if(ModLoaderBlocker.isFabric(player) && !precommand.equals("/bau testarena ")) { - BungeeCore.send((ProxiedPlayer) sender, BungeeCore.CHAT_PREFIX + "§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf?"); + Message.send("FIGHT_FABRIC", sender); return; } @@ -167,10 +167,8 @@ public class FightCommand extends BasicCommand { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + mode.getDisplayName() + " §7gegen §e" + player.getName() + " §7zu §7kämpfen!"); - tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aGegen §7" + player.getName() + " §ekämpfen").create())); - tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); - ProxyServer.getInstance().broadcast(tc); + Message.broadcast("FIGHT_BROADCAST", true, Message.parse("FIGHT_BROADCAST_HOVER", player, player.getName()) + , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 7f4d6e7e..2179e174 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -141,7 +141,6 @@ BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0} #ChallengeCommand CHALLENGE_SYNTAX=§8/§echallenge §8[§7Spieler§8] -CHALLENGE_FABRIC=§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf? CHALLENGE_OFFLINE=§cDer Herausgeforderte ist nicht online. CHALLENGE_SELF=§cSchizophren? CHALLENGE_IGNORED=§cDer Herausgeforderte hat dich geblockt. @@ -176,6 +175,15 @@ EVENTRESCHEDULE_UNKNOWN_TEAM=§cEin Team ist unbekannt / Derzeit kein Event EVENTRESCHEDULE_NO_FIGHT="§cKein Kampf zwischen den Teams gefunden" EVENTRESCHEDULE_STARTING=§aKampf startet in 30s +#FightCommand +FIGHT_UNKNOWN_GAMEMODE=§cUnbekannter Spielmodus: {0} +FIGHT_UNKNOWN_ARENA=§cDie gewünschte Arena gibt es nicht. +FIGHT_ARENA_RANDOM=Random +FIGHT_IN_ARENA=§cDu befindest dich bereits in einer Arena. +FIGHT_FABRIC=§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf? +FIGHT_BROADCAST=§7Klicke §ehier§7, um §e{0} §7gegen §e{1} §7zu §7kämpfen! +FIGHT_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen + #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. From 2b96c1fbc620ba7b5521cc72c2dd27d74dd2df35 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 23:23:48 +0100 Subject: [PATCH 032/108] Add HistoricCommand ML & Optimize Imports --- .../bungeecore/commands/ChallengeCommand.java | 2 +- .../commands/EventRescheduleCommand.java | 1 - .../bungeecore/commands/FightCommand.java | 3 +-- .../bungeecore/commands/HistoricCommand.java | 15 +++------------ src/de/steamwar/messages/BungeeCore.properties | 6 +++++- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index fe4c80d7..06c7f405 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -80,7 +80,7 @@ public class ChallengeCommand extends BasicCommand { arena.sendPlayer(player); arena.sendPlayer(target); - Message.broadcast("CHALLENGE_BROADCAST", sender, true, Message.parse("CHALLENGE_BROADCAST_HOVER", player), //Needs BanSystemRework for Loading from Message File + Message.broadcast("CHALLENGE_BROADCAST", sender, true, Message.parse("CHALLENGE_BROADCAST_HOVER", player), //TODO Needs BanSystemRework for Loading from Message File new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getDisplayName(), target.getDisplayName()); }else{ if(!challenges.containsKey(player)){ diff --git a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java index 9f2fac44..8cb3689a 100644 --- a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.EventFight; diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 362137e4..0e26ffa2 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -23,7 +23,6 @@ import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.listeners.mods.ModLoaderBlocker; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; @@ -167,7 +166,7 @@ public class FightCommand extends BasicCommand { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - Message.broadcast("FIGHT_BROADCAST", true, Message.parse("FIGHT_BROADCAST_HOVER", player, player.getName()) + Message.broadcast("FIGHT_BROADCAST", true, Message.parse("FIGHT_BROADCAST_HOVER", player, player.getName()) //TODO Needs Message Object , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index 9c69ebab..113f0f6d 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -19,16 +19,9 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.ArenaMode; -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.Subserver; -import de.steamwar.bungeecore.SubserverSystem; +import de.steamwar.bungeecore.*; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; import java.util.LinkedList; @@ -42,10 +35,8 @@ public class HistoricCommand extends BasicCommand { FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Historischer §e" + mode.getDisplayName() + "§8-§7Kampf von §e" + player.getName() + "§8!"); - tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aGegen §7" + player.getName() + " §ekämpfen").create())); - tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); - ProxyServer.getInstance().broadcast(tc); + Message.broadcast("HISTORIC_BROADCAST", true, Message.parse("HISTORIC_BROADCAST_HOVER", player, player.getName()) //TODO Needs Message Object + , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 2179e174..4afc5444 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -209,4 +209,8 @@ CHECK_RANK_HOVER=§aMit diesem Rang freigeben CHECK_ACCEPTED=§aDein §e{0} {1} §ewurde freigegeben§8! CHECK_ACCEPTED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7ist nun freigegeben! 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! \ No newline at end of file +CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von §e{2} §7abgelehnt! + +#HistoricCommand +HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! +HISTORIC_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen \ No newline at end of file From 0dbbea35582531463b5db850480f96b3e9bb8988 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 18 Jan 2021 23:35:50 +0100 Subject: [PATCH 033/108] Optimizing Stuff --- src/de/steamwar/bungeecore/commands/ChallengeCommand.java | 2 +- src/de/steamwar/bungeecore/commands/FightCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 06c7f405..b09a5b1f 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -48,7 +48,7 @@ public class ChallengeCommand extends BasicCommand { return; if(ModLoaderBlocker.isFabric((ProxiedPlayer) sender)) { - Message.send("FIGHT_FABRIC", sender); + Message.send("MODLOADER_DENIED", sender); return; } diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 0e26ffa2..2009ded2 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -132,7 +132,7 @@ public class FightCommand extends BasicCommand { return; if(ModLoaderBlocker.isFabric(player) && !precommand.equals("/bau testarena ")) { - Message.send("FIGHT_FABRIC", sender); + Message.send("MODLOADER_DENIED", sender); return; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 4afc5444..644a8a26 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -180,7 +180,6 @@ FIGHT_UNKNOWN_GAMEMODE=§cUnbekannter Spielmodus: {0} FIGHT_UNKNOWN_ARENA=§cDie gewünschte Arena gibt es nicht. FIGHT_ARENA_RANDOM=Random FIGHT_IN_ARENA=§cDu befindest dich bereits in einer Arena. -FIGHT_FABRIC=§cHabe ich dir nicht gesagt, dass man mit Fabric/LiteLoader nicht auf die Arenen darf? FIGHT_BROADCAST=§7Klicke §ehier§7, um §e{0} §7gegen §e{1} §7zu §7kämpfen! FIGHT_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen From 85d5a76e304f0eeaa21e9b7a0e5160276811540d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:06:33 +0100 Subject: [PATCH 034/108] Add JoinmeCommand MultiLang --- .../bungeecore/commands/JoinmeCommand.java | 20 ++++++++----------- .../steamwar/messages/BungeeCore.properties | 10 +++++++++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index e4f9c0d3..cb338d33 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -34,8 +34,6 @@ import java.util.ArrayList; public class JoinmeCommand extends BasicCommand { - private static final String DENY_MESSAGE = "§cDu kannst diesem Spieler derzeit nicht folgen."; - public JoinmeCommand() { super("joinme", ""); } @@ -46,17 +44,15 @@ public class JoinmeCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { - TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8!"); - tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aSpieler folgen").create())); - tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); - ProxyServer.getInstance().broadcast(tc); + Message.broadcast("JOINME_BROADCAST", true, Message.parse("JOINME_BROADCAST_HOVER", player) //TODO Needs Message Object + , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); } else if (args.length == 1) { ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null || !target.isConnected()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist offline."); + Message.send("JOINME_PLAYER_OFFLINE", player); return; }else if(target.equals(player)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cSei eins mit dir selbst!"); + Message.send("JOINME_PLAYER_SELF", player); return; } ServerInfo server = target.getServer().getInfo(); @@ -74,18 +70,18 @@ public class JoinmeCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); }else{ player.connect(server); } } else { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7."); + Message.send("JOINME_SYNTAX", player); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 644a8a26..5b7094dc 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -4,6 +4,7 @@ SPACER= UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. INVALID_TIME=§cUngültige Zeitangabe. +JOIN_PLAYER_BLOCK=§cDu kannst diesem Spieler derzeit nicht folgen. #ModLoader blocker MODLOADER_INSTALLED=§7Du hast §e{0} §7installiert. Daher kannst du keinen Arenen beitreten. @@ -212,4 +213,11 @@ CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von #HistoricCommand HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! -HISTORIC_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen \ No newline at end of file +HISTORIC_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen + +#JoinmeCommand +JOINME_SYNTAX=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7. +JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! +JOINME_BROADCAST_HOVER=§aSpieler folgen +JOINME_PLAYER_OFFLINE=§cDieser Spieler ist offline. +JOINME_PLAYER_SELF=§cSei eins mit dir selbst! \ No newline at end of file From 67fb884bc16e2c823a1e26e58bb93e5fa43bf7d0 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:09:32 +0100 Subject: [PATCH 035/108] Add KickCommand MultiLang --- src/de/steamwar/bungeecore/commands/KickCommand.java | 9 +++++---- src/de/steamwar/messages/BungeeCore.properties | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/KickCommand.java b/src/de/steamwar/bungeecore/commands/KickCommand.java index 5d8569f9..68b315f8 100644 --- a/src/de/steamwar/bungeecore/commands/KickCommand.java +++ b/src/de/steamwar/bungeecore/commands/KickCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -35,18 +36,18 @@ public class KickCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length == 0){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/kick [Spieler] [Nachricht]"); + Message.send("KICK_SYNTAX", sender); return; } ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!"); + Message.send("KICK_OFFLINE", sender); return; } if(args.length == 1){ - target.disconnect(BungeeCore.stringToText(BungeeCore.CHAT_PREFIX + "§cDu wurdest gekickt.")); + Message.send("KICK_NORMAL", target); }else{ StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append(BungeeCore.CHAT_PREFIX).append("§c"); @@ -55,7 +56,7 @@ public class KickCommand extends BasicCommand { } target.disconnect(BungeeCore.stringToText(msgBuilder.toString())); } - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Der Spieler " + target.getName() + " wurde gekickt."); + Message.send("KICK_CONFIRM", sender, target.getName()); } @Override diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 5b7094dc..33a19c67 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -220,4 +220,10 @@ JOINME_SYNTAX=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler f JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! JOINME_BROADCAST_HOVER=§aSpieler folgen JOINME_PLAYER_OFFLINE=§cDieser Spieler ist offline. -JOINME_PLAYER_SELF=§cSei eins mit dir selbst! \ No newline at end of file +JOINME_PLAYER_SELF=§cSei eins mit dir selbst! + +#KickCommand +KICK_SYNTAX=/kick [Spieler] [Nachricht] +KICK_OFFLINE=§cDieser Spieler ist derzeit nicht online! +KICK_CONFIRM=Der Spieler {0} wurde gekickt. +KICK_NORMAL=§cDu wurdest gekickt. \ No newline at end of file From 417902f49d493b65ba1238c402459738a0f904d4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:16:15 +0100 Subject: [PATCH 036/108] Add MsgCommand MultiLang --- .../bungeecore/commands/MsgCommand.java | 19 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 10 +++++++++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index 5d5baba3..e2a1841d 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -42,7 +43,7 @@ public class MsgCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if (args.length < 2) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "/msg [Benutzer] [Nachricht]"); + Message.send("MSG_SYNTAX", player); return; } @@ -54,28 +55,26 @@ public class MsgCommand extends BasicCommand { ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!"); + Message.send("MSG_OFFLINE", player); return; }else if (IgnoreSystem.isIgnored(target, player)) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat dich geblockt!"); + Message.send("MSG_IGNORED", player); return; }else if(target.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler empfängt derzeit keine Chatnachrichten!"); + Message.send("MSG_NOMESSAGE", player); return; }else if(target.equals(player)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cNachrichten an dich selbst hast du wirklich nicht nötig!"); + Message.send("MSG_SELF", player); return; } StringBuilder msgBuilder = new StringBuilder(); - msgBuilder.append("§e").append(player.getName()).append("§8»§e").append(target.getName()).append(" §r§7"); for (int i = 1; i < args.length; i++){ msgBuilder.append(args[i]).append(" "); } - String msg = msgBuilder.toString(); - BungeeCore.send(player, msg); - BungeeCore.send(target, msg); - BungeeCore.log(msg); + Message.send("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString()); + Message.send("MSG_FORMAT", target, player.getName(), target.getName(), msgBuilder.toString()); + BungeeCore.log(Message.parse("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString())); lastChats.put(player, target); lastChats.put(target, player); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 33a19c67..8354a3be 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -226,4 +226,12 @@ JOINME_PLAYER_SELF=§cSei eins mit dir selbst! KICK_SYNTAX=/kick [Spieler] [Nachricht] KICK_OFFLINE=§cDieser Spieler ist derzeit nicht online! KICK_CONFIRM=Der Spieler {0} wurde gekickt. -KICK_NORMAL=§cDu wurdest gekickt. \ No newline at end of file +KICK_NORMAL=§cDu wurdest gekickt. + +#MsgCommand +MSG_SYNTAX=/msg [Benutzer] [Nachricht] +MSG_OFFLINE=§cDieser Spieler ist derzeit nicht online! +MSG_IGNORED=§cDieser Spieler hat dich geblockt! +MSG_NOMESSAGE=§cDieser Spieler empfängt derzeit keine Chatnachrichten! +MSG_SELF=§cNachrichten an dich selbst hast du wirklich nicht nötig! +MSG_FORMAT=§e{0}§8»§e{1} §r§7{2} \ No newline at end of file From 34a4030f80ced22d256e6e56da5dd2e6650a0f16 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:17:28 +0100 Subject: [PATCH 037/108] Add PingCommand MultiLang --- src/de/steamwar/bungeecore/commands/PingCommand.java | 4 ++-- src/de/steamwar/messages/BungeeCore.properties | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PingCommand.java b/src/de/steamwar/bungeecore/commands/PingCommand.java index 4975f76f..014a6df1 100644 --- a/src/de/steamwar/bungeecore/commands/PingCommand.java +++ b/src/de/steamwar/bungeecore/commands/PingCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -33,7 +33,7 @@ public class PingCommand extends BasicCommand { public void execute(CommandSender sender, String[] args) { if(sender instanceof ProxiedPlayer){ ProxiedPlayer player = (ProxiedPlayer) sender; - player.sendMessage(BungeeCore.CHAT_PREFIX + "§7Dein Ping beträgt §c" + player.getPing() + "§r§7 ms!"); + Message.send("PING_RESPONSE", player, player.getPing()); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8354a3be..8355371b 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -234,4 +234,7 @@ MSG_OFFLINE=§cDieser Spieler ist derzeit nicht online! MSG_IGNORED=§cDieser Spieler hat dich geblockt! MSG_NOMESSAGE=§cDieser Spieler empfängt derzeit keine Chatnachrichten! MSG_SELF=§cNachrichten an dich selbst hast du wirklich nicht nötig! -MSG_FORMAT=§e{0}§8»§e{1} §r§7{2} \ No newline at end of file +MSG_FORMAT=§e{0}§8»§e{1} §r§7{2} + +#PingCommand +PING_RESPONSE=§7Dein Ping beträgt §c{0}§r§7 ms! \ No newline at end of file From 25885bd65ce90e64c734123f014a4ece6a6973d9 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:20:22 +0100 Subject: [PATCH 038/108] Add PollCommand MultiLang --- src/de/steamwar/bungeecore/commands/PollCommand.java | 10 +++++----- src/de/steamwar/messages/BungeeCore.properties | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PollCommand.java b/src/de/steamwar/bungeecore/commands/PollCommand.java index 7daf7c9a..3a84f50b 100644 --- a/src/de/steamwar/bungeecore/commands/PollCommand.java +++ b/src/de/steamwar/bungeecore/commands/PollCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.listeners.PollSystem; import de.steamwar.bungeecore.sql.PollAnswer; import de.steamwar.bungeecore.sql.SteamwarUser; @@ -40,7 +40,7 @@ public class PollCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(PollSystem.noCurrentPoll()){ - BungeeCore.send(player, "§cDerzeit läuft keine Umfrage."); + Message.send("POLL_NO_POLL", player); return; } @@ -55,15 +55,15 @@ public class PollCommand extends BasicCommand { if(answer < 1 || answer > PollSystem.answers()) throw new NumberFormatException(); }catch(NumberFormatException e){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDas ist keine Antwortmöglichkeit!"); + Message.send("POLL_NO_ANSWER", player); return; } PollAnswer pollAnswer = PollAnswer.get(SteamwarUser.get(player.getUniqueId()).getId()); if(pollAnswer.hasAnswered()) - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDeine Antwort wurde aktualisiert"); + Message.send("POLL_ANSWER_REFRESH", player); else - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDeine Antwort wurde registriert"); + Message.send("POLL_ANSWER_NEW", player); pollAnswer.setAnswer(answer); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8355371b..21e9a4dd 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -237,4 +237,10 @@ MSG_SELF=§cNachrichten an dich selbst hast du wirklich nicht nötig! MSG_FORMAT=§e{0}§8»§e{1} §r§7{2} #PingCommand -PING_RESPONSE=§7Dein Ping beträgt §c{0}§r§7 ms! \ No newline at end of file +PING_RESPONSE=§7Dein Ping beträgt §c{0}§r§7 ms! + +#PollCommand +POLL_NO_POLL=§cDerzeit läuft keine Umfrage. +POLL_NO_ANSWER=§cDas ist keine Antwortmöglichkeit! +POLL_ANSWER_REFRESH=§aDeine Antwort wurde aktualisiert +POLL_ANSWER_NEW=§aDeine Antwort wurde registriert \ No newline at end of file From f80829fc46555dab6de94ed957737e0bc15068ad Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:24:19 +0100 Subject: [PATCH 039/108] Add RankCommand MultiLang --- src/de/steamwar/bungeecore/commands/RankCommand.java | 8 ++++---- src/de/steamwar/messages/BungeeCore.properties | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/RankCommand.java b/src/de/steamwar/bungeecore/commands/RankCommand.java index d4dcb579..71510034 100644 --- a/src/de/steamwar/bungeecore/commands/RankCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankCommand.java @@ -20,7 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.ArenaMode; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Elo; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -40,7 +40,7 @@ public class RankCommand extends BasicCommand { return; ProxiedPlayer player = (ProxiedPlayer) sender; - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7§lPlatzierungen"); + Message.send("RANK_HEADER", player); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); for(ArenaMode mode : ArenaMode.getAllModes()){ if(!mode.isRanked()) @@ -49,9 +49,9 @@ public class RankCommand extends BasicCommand { int placement = Elo.getPlacement(elo, mode.getSchemType()); if(placement == -1) - BungeeCore.send(player, "§7" + mode.getChatName() + "§8: §eunplatziert"); + Message.send("RANK_UNPLACED", player, mode.getChatName()); else - BungeeCore.send(player, "§7" + mode.getChatName() + "§8: §e" + ++placement + "§8. §7mit §e" + elo + " §7Elo§8."); + Message.send("RANK_PLACED", player, mode.getChatName(), placement, elo); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 21e9a4dd..46745ac4 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -243,4 +243,9 @@ PING_RESPONSE=§7Dein Ping beträgt §c{0}§r§7 ms! POLL_NO_POLL=§cDerzeit läuft keine Umfrage. POLL_NO_ANSWER=§cDas ist keine Antwortmöglichkeit! POLL_ANSWER_REFRESH=§aDeine Antwort wurde aktualisiert -POLL_ANSWER_NEW=§aDeine Antwort wurde registriert \ No newline at end of file +POLL_ANSWER_NEW=§aDeine Antwort wurde registriert + +#RankCommand +RANK_HEADER=§7§lPlatzierungen +RANK_UNPLACED=§7{0}§8: §eunplatziert +RANK_PLACED=§7{0}§8: §e{1}§8. §7mit §e{2} §7Elo§8. \ No newline at end of file From 33c45dd3f22c43913b1c4fd323bd730a025c7026 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:37:01 +0100 Subject: [PATCH 040/108] Add RankedCommand MultiLang & Multiple Bug Fixes --- src/de/steamwar/bungeecore/Message.java | 2 +- .../bungeecore/commands/ChallengeCommand.java | 2 +- .../bungeecore/commands/FightCommand.java | 2 +- .../bungeecore/commands/HistoricCommand.java | 2 +- .../bungeecore/commands/JoinmeCommand.java | 5 +---- .../bungeecore/commands/RankedCommand.java | 19 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 15 ++++++++++++--- 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index b2c471a8..6fd03783 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -103,7 +103,7 @@ public class Message { public static void broadcast(String message, boolean prefixed, String onHover, ClickEvent onClick, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) - send(message, player, parse(onHover, prefixed, player), onClick, params); + send(message, player, parse(onHover, prefixed, player, params), onClick, params); } public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){ diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index b09a5b1f..59de2b1c 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -80,7 +80,7 @@ public class ChallengeCommand extends BasicCommand { arena.sendPlayer(player); arena.sendPlayer(target); - Message.broadcast("CHALLENGE_BROADCAST", sender, true, Message.parse("CHALLENGE_BROADCAST_HOVER", player), //TODO Needs BanSystemRework for Loading from Message File + Message.broadcast("CHALLENGE_BROADCAST", sender, true, "CHALLENGE_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getDisplayName(), target.getDisplayName()); }else{ if(!challenges.containsKey(player)){ diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 2009ded2..793ee843 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -166,7 +166,7 @@ public class FightCommand extends BasicCommand { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - Message.broadcast("FIGHT_BROADCAST", true, Message.parse("FIGHT_BROADCAST_HOVER", player, player.getName()) //TODO Needs Message Object + Message.broadcast("FIGHT_BROADCAST", true, "FIGHT_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index 113f0f6d..d98a1351 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -35,7 +35,7 @@ public class HistoricCommand extends BasicCommand { FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - Message.broadcast("HISTORIC_BROADCAST", true, Message.parse("HISTORIC_BROADCAST_HOVER", player, player.getName()) //TODO Needs Message Object + Message.broadcast("HISTORIC_BROADCAST", true, "HISTORIC_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index cb338d33..593015f7 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -24,9 +24,6 @@ import de.steamwar.bungeecore.sql.BauweltMember; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -44,7 +41,7 @@ public class JoinmeCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { - Message.broadcast("JOINME_BROADCAST", true, Message.parse("JOINME_BROADCAST_HOVER", player) //TODO Needs Message Object + Message.broadcast("JOINME_BROADCAST", true, "JOINME_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); } else if (args.length == 1) { ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); diff --git a/src/de/steamwar/bungeecore/commands/RankedCommand.java b/src/de/steamwar/bungeecore/commands/RankedCommand.java index 3f0914a4..3e70966c 100644 --- a/src/de/steamwar/bungeecore/commands/RankedCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankedCommand.java @@ -59,7 +59,7 @@ public class RankedCommand extends BasicCommand { if(mode == null) return; else if(!mode.isRanked()){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDieser Spielmodus ist nicht für Ranglistenspiele freigeschalten"); + Message.send("RANKED_NO_RANKED_MODE", sender); return; } @@ -114,14 +114,14 @@ public class RankedCommand extends BasicCommand { private void togglePlayer(ProxiedPlayer player){ for(WaitingPlayer wp : players){ if(wp.player == player){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cRanglistenspiel-Warteschlange verlassen"); + Message.send("RANKED_QUEUE_LEFT", player); players.remove(wp); return; } } - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aRanglistenspiel-Warteschlange betreten"); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Wiederhole den Befehl zum Verlassen der Warteschlange"); + Message.send("RANKED_QUEUE_JOINED", player); + Message.send("RANKED_QUEUE_HOW_TO_LEAVE", player); players.add(new WaitingPlayer(player, mode.getSchemType())); } @@ -160,8 +160,8 @@ public class RankedCommand extends BasicCommand { for(Map.Entry entry : inRange.entrySet()){ WaitingPlayer wp1 = entry.getKey(); WaitingPlayer wp2 = entry.getValue(); - BungeeCore.send(wp1.player, BungeeCore.CHAT_PREFIX + "§eGegner gefunden! Ranglistenspiel startet."); - BungeeCore.send(wp2.player, BungeeCore.CHAT_PREFIX + "§eGegner gefunden! Ranglistenspiel startet."); + Message.send("RANKED_ENEMY_SPOTTED", wp1.player); + Message.send("RANKED_ENEMY_SPOTTED", wp2.player); removeFromAll(wp1.player); removeFromAll(wp2.player); @@ -169,9 +169,8 @@ public class RankedCommand extends BasicCommand { arena.sendPlayer(wp1.player); arena.sendPlayer(wp2.player); - BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7" + mode.getDisplayName() + "§8-§7Ranglistenspiel§8: §e" + wp1.player.getName() + " vs " + wp2.player.getName(), - "§aZuschauen", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + wp1.player.getName())); + Message.broadcast("RANKED_BROADCAST", true, "RANKED_BROADCAST_HOVER", + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + wp1.player.getName()), mode.getDisplayName(), wp1.player.getName(), wp2.player.getName()); } } } @@ -204,7 +203,7 @@ public class RankedCommand extends BasicCommand { if(subserver == null) return true; if(subserver.getType() == Servertype.ARENA){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cRanglistenspiel-Warteschlange verlassen"); + Message.send("RANKED_QUEUE_LEFT", player); return false; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 46745ac4..e8c38c4a 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -182,7 +182,7 @@ FIGHT_UNKNOWN_ARENA=§cDie gewünschte Arena gibt es nicht. FIGHT_ARENA_RANDOM=Random FIGHT_IN_ARENA=§cDu befindest dich bereits in einer Arena. FIGHT_BROADCAST=§7Klicke §ehier§7, um §e{0} §7gegen §e{1} §7zu §7kämpfen! -FIGHT_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen +FIGHT_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! @@ -213,7 +213,7 @@ CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von #HistoricCommand HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! -HISTORIC_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen +HISTORIC_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen #JoinmeCommand JOINME_SYNTAX=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7. @@ -248,4 +248,13 @@ POLL_ANSWER_NEW=§aDeine Antwort wurde registriert #RankCommand RANK_HEADER=§7§lPlatzierungen RANK_UNPLACED=§7{0}§8: §eunplatziert -RANK_PLACED=§7{0}§8: §e{1}§8. §7mit §e{2} §7Elo§8. \ No newline at end of file +RANK_PLACED=§7{0}§8: §e{1}§8. §7mit §e{2} §7Elo§8. + +#RankedCommand +RANKED_NO_RANKED_MODE=§cDieser Spielmodus ist nicht für Ranglistenspiele freigeschalten +RANKED_QUEUE_JOINED=§aRanglistenspiel-Warteschlange betreten +RANKED_QUEUE_HOW_TO_LEAVE=§7Wiederhole den Befehl zum Verlassen der Warteschlange +RANKED_QUEUE_LEFT=§cRanglistenspiel-Warteschlange verlassen +RANKED_ENEMY_SPOTTED=§eGegner gefunden! Ranglistenspiel startet. +RANKED_BROADCAST=§7{0}§8-§7Ranglistenspiel§8: §e{1} vs {2} +RANKED_BROADCAST_HOVER=§aZuschauen \ No newline at end of file From 5098bf8282dc4595ab62ee982ac1c9eda7eeef87 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:41:00 +0100 Subject: [PATCH 041/108] Add RCommand MultiLang --- .../bungeecore/commands/RCommand.java | 19 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 9 ++++++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index 566dbcf8..e8440f83 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -38,7 +39,7 @@ public class RCommand extends BasicCommand { if(sender instanceof ProxiedPlayer){ ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length == 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "/r [Antwort]"); + Message.send("R_SYNTAX", player); return; } @@ -50,29 +51,27 @@ public class RCommand extends BasicCommand { ProxiedPlayer target = lastChats.get(player); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu hast bisher mit niemandem geschrieben!"); + Message.send("R_NOTHING", player); return; }else if(!target.isConnected()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist derzeit nicht online!"); + Message.send("R_OFFLINE", player); lastChats.remove(player); return; }else if (IgnoreSystem.isIgnored(target, player)) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat dich geblockt!"); + Message.send("R_BLOCKED", player); return; }else if(target.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler empfängt derzeit keine Chatnachrichten!"); + Message.send("R_NO_CHAT", player); return; } StringBuilder msgBuilder = new StringBuilder(); - msgBuilder.append("§e").append(player.getName()).append("§8»§e").append(target.getName()).append(" §r§7"); for (String arg : args){ msgBuilder.append(arg).append(" "); } - String msg = msgBuilder.toString(); - BungeeCore.send(player, msg); - BungeeCore.send(target, msg); - BungeeCore.log(msg); + Message.send("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString()); + Message.send("MSG_FORMAT", target, player.getName(), target.getName(), msgBuilder.toString()); + BungeeCore.log(Message.parse("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString())); lastChats.put(target, player); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e8c38c4a..f01e27ad 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -257,4 +257,11 @@ RANKED_QUEUE_HOW_TO_LEAVE=§7Wiederhole den Befehl zum Verlassen der Warteschlan RANKED_QUEUE_LEFT=§cRanglistenspiel-Warteschlange verlassen RANKED_ENEMY_SPOTTED=§eGegner gefunden! Ranglistenspiel startet. RANKED_BROADCAST=§7{0}§8-§7Ranglistenspiel§8: §e{1} vs {2} -RANKED_BROADCAST_HOVER=§aZuschauen \ No newline at end of file +RANKED_BROADCAST_HOVER=§aZuschauen + +#RCommand +R_SYNTAX=/r [Antwort] +R_NOTHING=§cDu hast bisher mit niemandem geschrieben! +R_OFFLINE=§cDieser Spieler ist derzeit nicht online! +R_BLOCKED=§cDieser Spieler hat dich geblockt! +R_NO_CHAT=§cDieser Spieler empfängt derzeit keine Chatnachrichten! \ No newline at end of file From c15f4a8e62dd776af6a48eb36644cae603b0781a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:51:36 +0100 Subject: [PATCH 042/108] Add RegelnCommand MultiLang --- .../bungeecore/commands/RegelnCommand.java | 12 ++++++------ src/de/steamwar/messages/BungeeCore.properties | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/RegelnCommand.java b/src/de/steamwar/bungeecore/commands/RegelnCommand.java index 7ba02b9f..37755f4e 100644 --- a/src/de/steamwar/bungeecore/commands/RegelnCommand.java +++ b/src/de/steamwar/bungeecore/commands/RegelnCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -35,10 +35,10 @@ public class RegelnCommand extends BasicCommand { return; ProxiedPlayer player = (ProxiedPlayer) sender; - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7§lRegelwerke"); - BungeeCore.send(player, "§eAirShip§8-§7Regelwerk", "§7https://steamwar.de/spielmodi/airship-regelwerk/", new ClickEvent(ClickEvent.Action.OPEN_URL, "https://steamwar.de/spielmodi/airship-regelwerk/")); - BungeeCore.send(player, "§eMiniWarGear§8-§7Regelwerk", "§7https://steamwar.de/spielmodi/miniwargear-regelwerk/", new ClickEvent(ClickEvent.Action.OPEN_URL, "https://steamwar.de/spielmodi/miniwargear-regelwerk/")); - BungeeCore.send(player, "§eWarGear§8-§7Regelwerk", "§7https://steamwar.de/spielmodi/wargear-regelwerk/", new ClickEvent(ClickEvent.Action.OPEN_URL, "https://steamwar.de/spielmodi/wargear-regelwerk/")); - BungeeCore.send(player, "§eWarShip§8-§7Regelwerk", "§7https://steamwar.de/spielmodi/warship-regelwerk/", new ClickEvent(ClickEvent.Action.OPEN_URL, "https://steamwar.de/spielmodi/warship-regelwerk/")); + Message.send("REGELN_RULES", player); + Message.sendPrefixless("REGELN_AS", player, Message.parse("REGELN_AS_HOVER", player), new ClickEvent(ClickEvent.Action.OPEN_URL, Message.parse("REGELN_AS_URL", player))); + Message.sendPrefixless("REGELN_MWG", player, Message.parse("REGELN_MWG_HOVER", player), new ClickEvent(ClickEvent.Action.OPEN_URL, Message.parse("REGELN_MWG_URL", player))); + Message.sendPrefixless("REGELN_WG", player, Message.parse("REGELN_WG_HOVER", player), new ClickEvent(ClickEvent.Action.OPEN_URL, Message.parse("REGELN_WG_URL", player))); + Message.sendPrefixless("REGELN_WS", player, Message.parse("REGELN_WS_HOVER", player), new ClickEvent(ClickEvent.Action.OPEN_URL, Message.parse("REGELN_WS_URL", player))); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index f01e27ad..2d0bd42d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -264,4 +264,19 @@ R_SYNTAX=/r [Antwort] R_NOTHING=§cDu hast bisher mit niemandem geschrieben! R_OFFLINE=§cDieser Spieler ist derzeit nicht online! R_BLOCKED=§cDieser Spieler hat dich geblockt! -R_NO_CHAT=§cDieser Spieler empfängt derzeit keine Chatnachrichten! \ No newline at end of file +R_NO_CHAT=§cDieser Spieler empfängt derzeit keine Chatnachrichten! + +#RegelnCommand +REGELN_RULES=§7§lRegelwerke +REGELN_AS=§eAirShip§8-§7Regelwerk +REGELN_AS_HOVER=§7https://steamwar.de/spielmodi/airship-regelwerk/ +REGELN_AS_URL=https://steamwar.de/spielmodi/airship-regelwerk/ +REGELN_MWG=§eMiniWarGear§8-§7Regelwerk +REGELN_MWG_HOVER=§7https://steamwar.de/spielmodi/miniwargear-regelwerk/ +REGELN_MWG_URL=https://steamwar.de/spielmodi/miniwargear-regelwerk/ +REGELN_WG=§eWarGear§8-§7Regelwerk +REGELN_WG_HOVER=§7https://steamwar.de/spielmodi/wargear-regelwerk/ +REGELN_WG_URL=https://steamwar.de/spielmodi/wargear-regelwerk/ +REGELN_WS=§eWarShip§8-§7Regelwerk +REGELN_WS_HOVER=§7https://steamwar.de/spielmodi/warship-regelwerk/ +REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ \ No newline at end of file From 0d6eecbbd4353fdd1bc00e0932f6a60bbce24cde Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:54:50 +0100 Subject: [PATCH 043/108] Add ServerTeamchatCommand MultiLang --- src/de/steamwar/bungeecore/BungeeCore.java | 1 - .../bungeecore/commands/ServerTeamchatCommand.java | 11 +++++------ src/de/steamwar/messages/BungeeCore.properties | 6 +++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 05a55883..a14d668f 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -53,7 +53,6 @@ import java.util.logging.Level; public class BungeeCore extends Plugin { - public static final String SERVER_TEAMCHAT_PREFIX = "§8STC §e"; public static final String TEAMCHAT_PREFIX = "§8TC §e"; public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy"); diff --git a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java index 5afb0325..c90b6081 100644 --- a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; @@ -37,27 +37,26 @@ public class ServerTeamchatCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length == 0){ - player.sendMessage(BungeeCore.CHAT_PREFIX + "/stc [Nachricht an das Team]"); + Message.sendPrefixless("STC_SYNTAX", player); return; } StringBuilder msgBuilder = new StringBuilder(); - msgBuilder.append(BungeeCore.SERVER_TEAMCHAT_PREFIX).append(sender.getName()).append("» §r"); for (String arg : args){ msgBuilder.append(arg).append(" "); } String msg = msgBuilder.toString(); msg = ChatColor.translateAlternateColorCodes('&', msg); - sendToTeam(msg); + sendToTeam(msg, player); } } - public static void sendToTeam(String message){ + public static void sendToTeam(String message, ProxiedPlayer sender){ for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ if ((target.hasPermission("bungeecore.teamchat")) && target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){ - BungeeCore.send(target, message); + Message.send("STC_FORMAT", target, sender.getName(), message); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 2d0bd42d..9793eec1 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -279,4 +279,8 @@ REGELN_WG_HOVER=§7https://steamwar.de/spielmodi/wargear-regelwerk/ REGELN_WG_URL=https://steamwar.de/spielmodi/wargear-regelwerk/ REGELN_WS=§eWarShip§8-§7Regelwerk REGELN_WS_HOVER=§7https://steamwar.de/spielmodi/warship-regelwerk/ -REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ \ No newline at end of file +REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ + +#ServerTeamchatCommand +STC_SYNTAX=/stc [Nachricht an das Team] +STC_FORMAT=§8STC §e{0}» §r{1} \ No newline at end of file From d470a56ffa7f79cf9bd3548e80a42a8419188d84 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:58:25 +0100 Subject: [PATCH 044/108] Add TeamchatCommand MultiLang --- src/de/steamwar/bungeecore/BungeeCore.java | 1 - .../steamwar/bungeecore/commands/TeamchatCommand.java | 10 ++++------ src/de/steamwar/messages/BungeeCore.properties | 7 ++++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index a14d668f..2f5fc946 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -53,7 +53,6 @@ import java.util.logging.Level; public class BungeeCore extends Plugin { - public static final String TEAMCHAT_PREFIX = "§8TC §e"; public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("dd.MM.yyyy"); public static String CHAT_PREFIX; diff --git a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java index d33c06fd..7b34998a 100644 --- a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java @@ -19,10 +19,9 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -40,17 +39,16 @@ public class TeamchatCommand extends BasicCommand { SteamwarUser user = SteamwarUser.get(player.getUniqueId()); if(user.getTeam() == 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist in keinem Team"); + Message.send("TC_NO_TEAM", player); return; } if(args.length == 0){ - BungeeCore.send(player, BungeeCore.TEAMCHAT_PREFIX + "/teamchat [Nachricht an das Team]"); + Message.send("TC_SYNTAX", player); return; } StringBuilder msgBuilder = new StringBuilder(); - msgBuilder.append(BungeeCore.TEAMCHAT_PREFIX).append(sender.getName()).append("§8» §r"); for (String arg : args){ msgBuilder.append(arg).append(" "); } @@ -61,7 +59,7 @@ public class TeamchatCommand extends BasicCommand { SteamwarUser targetuser = SteamwarUser.get(target.getUniqueId()); if (targetuser.getTeam() == user.getTeam() && target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){ - BungeeCore.send(target, ChatMessageType.CHAT, msg); + Message.send("TC_FORMAT", target, player.getName(), msg); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9793eec1..e3e6ba32 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -283,4 +283,9 @@ REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ #ServerTeamchatCommand STC_SYNTAX=/stc [Nachricht an das Team] -STC_FORMAT=§8STC §e{0}» §r{1} \ No newline at end of file +STC_FORMAT=§8STC §e{0}» §r{1} + +#TeamchatCommand +TC_SYNTAX=/teamchat [Nachricht an das Team] +TC_NO_TEAM=§cDu bist in keinem Team +TC_FORMAT=§8TC §e{0}§8» §r{1} \ No newline at end of file From c0ff508f3d0496938ad8bc14a90fe6eaffc39d9c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 02:39:05 +0100 Subject: [PATCH 045/108] Add First part of TeamCommand MultiLang --- .../bungeecore/commands/TeamCommand.java | 94 ++++++++++--------- .../steamwar/messages/BungeeCore.properties | 67 ++++++++++++- 2 files changed, 114 insertions(+), 47 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 0d503cec..649cf755 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.sql.Event; @@ -38,6 +39,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.time.Instant; import java.util.*; +import static de.steamwar.bungeecore.Storage.sessions; import static de.steamwar.bungeecore.Storage.teamInvitations; public class TeamCommand extends BasicCommand { @@ -72,30 +74,30 @@ public class TeamCommand extends BasicCommand { } private void help(CommandSender sender){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§7Mit §e/team §7verwaltest du dein Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam list §8- §7Liste alle Teams auf"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam info §8- §7Informiere dich über ein Team"); + Message.send("TEAM_HELP_HEADER", sender); + Message.send("TEAM_HELP_LIST", sender); + Message.send("TEAM_HELP_INFO", sender); if(!(sender instanceof ProxiedPlayer)) return; ProxiedPlayer player = (ProxiedPlayer) sender; SteamwarUser user = SteamwarUser.get(player.getUniqueId()); if(user.getTeam() == 0) { - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8- §7Erstelle dein eigenes Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8- §7Trete einem Team bei"); + Message.send("TEAM_HELP_CREATE", sender); + Message.send("TEAM_HELP_JOIN", sender); }else{ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteamchat §8- §7Sende Nachrichten an dein Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam event §8- §7Nehme an Events teil"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam leave §8- §7Verlasse dein Team"); + Message.send("TEAM_HELP_CHAT", sender); + Message.send("TEAM_HELP_EVENT", sender); + Message.send("TEAM_HELP_LEAVE", sender); Team team = Team.get(user.getTeam()); if(team.getTeamLeader() == user.getId()){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8- §7Lade jemanden in dein Team ein"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8- §7Entferne jemanden aus deinem Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8- §7Ändere deinen Teamnamen"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changecolor §8- §7Ändere deine Teamfarbe"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader"); + Message.send("TEAM_HELP_INVITE", sender); + Message.send("TEAM_HELP_REMOVE", sender); + Message.send("TEAM_HELP_KUERZEL", sender); + Message.send("TEAM_HELP_NAME", sender); + Message.send("TEAM_HELP_COLOR", sender); + Message.send("TEAM_HELP_LEADER", sender); } } } @@ -161,7 +163,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 3){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8]"); + Message.send("TEAM_CREATE_SYNTAX", player); return; } @@ -173,7 +175,7 @@ public class TeamCommand extends BasicCommand { Team.create(args[1], args[2], user.getId()); user.setTeam(Team.get(args[1]).getTeamId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Team §e" + args[2] + " §7gegründet!"); + Message.send("TEAM_CREATE_CREATED", player, args[2]); } private void join(ProxiedPlayer player, SteamwarUser user, String[] args){ @@ -184,7 +186,7 @@ public class TeamCommand extends BasicCommand { return; if(!teamInvitations.containsKey(user.getId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast keine Einladungen erhalten."); + Message.send("TEAM_JOIN_NO_INVITE", player); return; } @@ -195,13 +197,13 @@ public class TeamCommand extends BasicCommand { t = invs.get(0); }else{ if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8[§eTeam§8]"); - StringBuilder sb = new StringBuilder().append("§7Du wurdest von diesen Teams eingeladen§8: §e"); + Message.send("TEAM_JOIN_SYNTAX", player); + StringBuilder sb = new StringBuilder(); for(int inv : invs){ Team team = Team.get(inv); sb.append(team.getTeamName()).append(" "); } - BungeeCore.send(player, sb.toString()); + Message.send("TEAM_JOIN_INVITED", player, sb.toString()); return; } @@ -214,14 +216,14 @@ public class TeamCommand extends BasicCommand { } if(t == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cVon diesem Team wurdest du nicht eingeladen"); + Message.send("TEAM_JOIN_NOT_BY_TEAM", player); return; } } user.setTeam(t); teamInvitations.remove(user.getId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du bist dem Team §e" + Team.get(t).getTeamName() + " §7beigetreten!"); + Message.send("TEAM_JOIN_JOINED", player, Team.get(t).getTeamName()); } private void leave(ProxiedPlayer player, SteamwarUser user, Team team){ @@ -229,7 +231,7 @@ public class TeamCommand extends BasicCommand { return; if(team.getTeamLeader() == user.getId() && team.size() > 1){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte ernenne zunächst ein anderes Teammitglied zum Leader"); + Message.send("TEAM_LEAVE_OTHER_LEADER", player); return; } @@ -239,7 +241,7 @@ public class TeamCommand extends BasicCommand { team.disband(); } - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast dein Team verlassen!"); + Message.send("TEAM_LEAVE_LEFT", player); } @@ -251,16 +253,16 @@ public class TeamCommand extends BasicCommand { return; if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8[§eSpieler§8]"); + Message.send("TEAM_INVITE_SYNTAX", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht"); + Message.send("TEAM_INVITE_NO_PLAYER", player); return; }else if(target.getTeam() != 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist bereits in einem Team"); + Message.send("TEAM_INVITE_IN_TEAM", player); return; } @@ -268,16 +270,16 @@ public class TeamCommand extends BasicCommand { teamInvitations.put(target.getId(), new LinkedList<>()); if(teamInvitations.get(target.getId()).contains(team.getTeamId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu hast diesen Spieler bereits eingeladen"); + Message.send("TEAM_INVITE_ALREADY_INVITED", player); return; } teamInvitations.get(target.getId()).add(team.getTeamId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast §e" + args[1] + " §7in das Team eingeladen!"); + Message.send("TEAM_INVITE_INVITED", player, args[1]); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); if(p != null) - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du wurdest in das Team §e" + team.getTeamName() + " §7eingeladen!"); + Message.send("TEAM_INVITE_INVITED_TARGET", player, team.getTeamColor(), team.getTeamName()); } private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -285,43 +287,43 @@ public class TeamCommand extends BasicCommand { return; if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8[§eSpieler§8]"); + Message.send("TEAM_REMOVE_SYNTAX", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht"); + Message.send("TEAM_REMOVE_NOT_PLAYER", player); return; } if (team.getTeamLeader() == target.getId()) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cLeader entfernen sich nicht selbst"); + Message.send("TEAM_REMOVE_NOT_LEADER", player); return; } if(teamInvitations.containsKey(target.getId())){ if(teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Die Einladung wurde zurückgezogen"); + Message.send("TEAM_REMOVE_INVITE", player); if(teamInvitations.get(target.getId()).isEmpty()) teamInvitations.remove(target.getId()); }else{ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat keine Einladung erhalten"); + Message.send("TEAM_REMOVE_NO_INVITE", player); } return; } if(target.getTeam() != user.getTeam()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist nicht in deinem Team"); + Message.send("TEAM_REMOVE_NOT_IN_TEAM", player); return; } target.setTeam(0); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Der Spieler wurde aus dem Team entfernt"); + Message.send("TEAM_REMOVE_REMOVED", player); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); if(p != null) - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu wurdest aus dem Team entfernt"); + Message.send("TEAM_REMOVE_REMOVED_TARGET", player); } private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -332,7 +334,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8[§eTeamkürzel§8]"); + Message.send("TEAM_KUERZEL_SYNTAX", player); return; } @@ -340,7 +342,7 @@ public class TeamCommand extends BasicCommand { return; team.setTeamKuerzel(args[1]); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Kürzel des Teams geändert!"); + Message.send("TEAM_KUERZEL_CHANGED", player); } private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -351,7 +353,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8[§eTeamname§8]"); + Message.send("TEAM_NAME_SYNTAX", player); return; } @@ -359,7 +361,7 @@ public class TeamCommand extends BasicCommand { return; team.setTeamName(args[1]); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Team umbenannt!"); + Message.send("TEAM_NAME_CHANGED", player); } private void changeleader(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -370,23 +372,23 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte gib ein Teammitglied an"); + Message.send("TEAM_LEADER_SYNTAX", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDen Spieler " + args[1] + " gibt es nicht"); + Message.send("TEAM_LEADER_NOT_USER", player, args[1]); return; } if(target.getTeam() != user.getTeam()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDer Spieler ist nicht in deinem Team"); + Message.send("TEAM_LEADER_NOT_MEMBER", player); return; } team.setTeamLeader(target.getId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast den Spieler §e" + args[1] + " §7zum Leader gemacht!"); + Message.send("TEAM_LEADER_CHANGED", player, args[0]); } private String playerName(SteamwarUser user){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e3e6ba32..578715d2 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -288,4 +288,69 @@ STC_FORMAT=§8STC §e{0}» §r{1} #TeamchatCommand TC_SYNTAX=/teamchat [Nachricht an das Team] TC_NO_TEAM=§cDu bist in keinem Team -TC_FORMAT=§8TC §e{0}§8» §r{1} \ No newline at end of file +TC_FORMAT=§8TC §e{0}§8» §r{1} + +#TeamCommand +TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team +TEAM_HELP_LIST=§8/§eteam list §8- §7Liste alle Teams auf +TEAM_HELP_INFO=§8/§eteam info §8- §7Informiere dich über ein Team +TEAM_HELP_CREATE=§8/§eteam create §8- §7Erstelle dein eigenes Team +TEAM_HELP_JOIN=§8/§eteam join §8- §7Trete einem Team bei +TEAM_HELP_CHAT=§8/§eteamchat §8- §7Sende Nachrichten an dein Team +TEAM_HELP_EVENT=§8/§eteam event §8- §7Nehme an Events teil +TEAM_HELP_LEAVE=§8/§eteam leave §8- §7Verlasse dein Team +TEAM_HELP_INVITE=§8/§eteam invite §8- §7Lade jemanden in dein Team ein +TEAM_HELP_REMOVE=§8/§eteam remove §8- §7Entferne jemanden aus deinem Team +TEAM_HELP_KUERZEL=§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel +TEAM_HELP_NAME=§8/§eteam changename §8- §7Ändere deinen Teamnamen +TEAM_HELP_COLOR=§8/§eteam changecolor §8- §7Ändere deine Teamfarbe +TEAM_HELP_LEADER=§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader + +#Team Create +TEAM_CREATE_SYNTAX=§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8] +TEAM_CREATE_CREATED=§7Du hast das Team §e{0} §7gegründet! + +#Team Join +TEAM_JOIN_NO_INVITE=§7Du hast keine Einladungen erhalten. +TEAM_JOIN_SYNTAX=§8/§eteam join §8[§eTeam§8] +TEAM_JOIN_INVITED=§7Du wurdest von diesen Teams eingeladen§8: §e{0} +TEAM_JOIN_NOT_BY_TEAM=§cVon diesem Team wurdest du nicht eingeladen +TEAM_JOIN_JOINED=§7Du bist dem Team §e{0} §7beigetreten! + +#Team Leave +TEAM_LEAVE_OTHER_LEADER=§cBitte ernenne zunächst ein anderes Teammitglied zum Leader +TEAM_LEAVE_LEFT=§7Du hast dein Team verlassen! + +#Team Invite +TEAM_INVITE_SYNTAX=§8/§eteam invite §8[§eSpieler§8] +TEAM_INVITE_NO_PLAYER=§cDiesen Spieler gibt es nicht +TEAM_INVITE_IN_TEAM=§cDieser Spieler ist bereits in einem Team +TEAM_INVITE_ALREADY_INVITED=§cDu hast diesen Spieler bereits eingeladen +TEAM_INVITE_INVITED=§7Du hast §e{0} §7in das Team eingeladen! +TEAM_INVITE_INVITED_TARGET=§7Du wurdest in das Team §{0}{1} §7eingeladen! + +#Team Remove +TEAM_REMOVE_SYNTAX=§8/§eteam remove §8[§eSpieler§8] +TEAM_REMOVE_NOT_PLAYER=§cDiesen Spieler gibt es nicht +TEAM_REMOVE_NOT_LEADER=§cLeader entfernen sich nicht selbst +TEAM_REMOVE_INVITE=§7Die Einladung wurde zurückgezogen +TEAM_REMOVE_NO_INVITE=§cDieser Spieler hat keine Einladung erhalten +TEAM_REMOVE_NOT_IN_TEAM=§cDieser Spieler ist nicht in deinem Team +TEAM_REMOVE_REMOVED=§7Der Spieler wurde aus dem Team entfernt +TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt + +#Team Kuerzel +TEAM_KUERZEL_SYNTAX=§8/§eteam changekuerzel §8[§eTeamkürzel§8] +TEAM_KUERZEL_CHANGED=§7Du hast das Kürzel des Teams geändert! + +#Team Name +TEAM_NAME_SYNTAX=§8/§eteam changename §8[§eTeamname§8] +TEAM_NAME_CHANGED=§7Du hast das Team umbenannt! + +#Team Leader +TEAM_LEADER_SYNTAX=§cBitte gib ein Teammitglied an +TEAM_LEADER_NOT_USER=§cDen Spieler {0} gibt es nicht +TEAM_LEADER_NOT_MEMBER=§cDer Spieler ist nicht in deinem Team +TEAM_LEADER_CHANGED=§7Du hast den Spieler §e{0} §7zum Leader gemacht! + +#Team Info \ No newline at end of file From d20efc1a2f9b33c2b744583b4599a61e2c5e37cc Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 15:03:23 +0100 Subject: [PATCH 046/108] Add TeamCommand MultiLang --- .../bungeecore/commands/TeamCommand.java | 70 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 39 ++++++++++- 2 files changed, 73 insertions(+), 36 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 649cf755..77013331 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -37,6 +37,7 @@ import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.time.Instant; +import java.time.format.DateTimeFormatter; import java.util.*; import static de.steamwar.bungeecore.Storage.sessions; @@ -397,38 +398,37 @@ public class TeamCommand extends BasicCommand { private void info(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ if(args.length == 1 && user.getTeam() == 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam info §8[§eTeamname§8]"); + Message.send("TEAM_INFO_SYNTAX", player); return; }else if(user.getTeam() == 0 || args.length == 2){ team = Team.get(args[1]); } if(team == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Team gibt es nicht"); + Message.send("UNKNOWN_TEAM", player); return; } - BungeeCore.send(player, "§7Team §e" + team.getTeamName() + " §8[§" + team.getTeamColor() + team.getTeamKuerzel() + "§8]"); - BungeeCore.send(player, "§7Leader§8: " + playerName(SteamwarUser.get(team.getTeamLeader()))); + Message.sendPrefixless("TEAM_INFO_TEAM", player, team.getTeamName(), team.getTeamColor(), team.getTeamKuerzel()); + Message.sendPrefixless("TEAM_INFO_LEADER", player, playerName(SteamwarUser.get(team.getTeamLeader()))); if(team.getMembers().size() > 1) { StringBuilder sb = new StringBuilder(); - sb.append("§7Member§8: "); List members = team.getMembers(); for (int i : members) { if (i == team.getTeamLeader()) continue; sb.append(playerName(SteamwarUser.get(i))).append(" "); } - BungeeCore.send(player, sb.toString()); + Message.sendPrefixless("TEAM_INFO_MEMBER", player, sb.toString()); } Set events = TeamTeilnahme.getEvents(team.getTeamId()); if(!events.isEmpty()){ - StringBuilder sb = new StringBuilder("§7Events§8: §e"); + StringBuilder sb = new StringBuilder(); for(Event e : events) sb.append(e.getEventName()).append(" "); - BungeeCore.send(player, sb.toString()); + Message.sendPrefixless("TEAM_INFO_EVENTS", player, sb.toString()); } } @@ -441,7 +441,7 @@ public class TeamCommand extends BasicCommand { try{ page = Integer.parseInt(args[1]); }catch(NumberFormatException e){ - BungeeCore.send(player, "§cKeine Seitenzahl angegeben"); + Message.send("TEAM_LIST_NOT_PAGE", player); return; } }else @@ -450,32 +450,31 @@ public class TeamCommand extends BasicCommand { List all = Team.getAll(); final int lastPage = ((all.size() - 1) / 10) + 1; if(page < 1 || page > lastPage){ - BungeeCore.send(player, "§cUngültige Seitenzahl angegeben"); + Message.send("TEAM_LIST_UNKNOWN_PAGE", player); return; } - BungeeCore.send(player, "§7§lTeamliste §7" + page + "§8/§7" + lastPage); + Message.sendPrefixless("TEAM_LIST_HEADER", player, page, lastPage); for(int i = (page-1) * TEAMS_PER_PAGE; i < (page-1) * TEAMS_PER_PAGE + TEAMS_PER_PAGE && i < all.size(); i++){ Team tm = all.get(i); - BungeeCore.send(player, - "§" + tm.getTeamColor() + tm.getTeamKuerzel() + " §e" + tm.getTeamName() + " §8[§7" + SteamwarUser.get(tm.getTeamLeader()).getUserName() + "§8]", - "§7Teaminfo", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + tm.getTeamKuerzel())); + + Message.sendPrefixless("TEAM_LIST_TEAM", player, Message.parse("TEAM_LIST_TEAM_HOVER", player), + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team info " + tm.getTeamKuerzel()), tm.getTeamColor(), tm.getTeamKuerzel(), tm.getTeamName(), SteamwarUser.get(tm.getTeamLeader()).getUserName()); } TextComponent beforePage = new TextComponent("««"); if(page > 1){ beforePage.setColor(ChatColor.YELLOW); - beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eVorherige Seite").create())); + beforePage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("TEAM_LIST_PREV", player)).create())); beforePage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team list " + (page - 1))); }else beforePage.setColor(ChatColor.DARK_GRAY); - TextComponent nextPage = new TextComponent(" Seite »»"); + TextComponent nextPage = new TextComponent(" " + Message.parse("TEAM_LIST_PAGE", player) +" »»"); if(page < lastPage){ nextPage.setColor(ChatColor.YELLOW); - nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eNächste Seite").create())); + nextPage.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("TEAM_LIST_NEXT", player)).create())); nextPage.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team list " + (page + 1))); }else nextPage.setColor(ChatColor.DARK_GRAY); @@ -489,12 +488,13 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen"); + Message.send("TEAM_EVENT_SYNTAX", player); Set events = TeamTeilnahme.getEvents(team.getTeamId()); if(!events.isEmpty()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Team nimmt an folgenden Events teil§8:"); + Message.send("TEAM_EVENT_HEADER", player); + DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); for(Event e : events) - BungeeCore.send(player, "§7" + e.getStart().toLocalDateTime().format(EventCommand.DATE_FORMAT) + "§8: §e" + e.getEventName()); + Message.sendPrefixless("TEAM_EVENT_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEventName()); } return; } @@ -507,22 +507,22 @@ public class TeamCommand extends BasicCommand { Event event = Event.get(args[1]); if(event == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Event gibt es nicht"); + Message.send("TEAM_EVENT_NO_EVENT", player); return; } if(Instant.now().isAfter(event.getEnd().toInstant())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieses Event ist bereits vorbei"); + Message.send("TEAM_EVENT_OVER", player); return; } if(TeamTeilnahme.nimmtTeil(team.getTeamId(), event.getEventID())){ TeamTeilnahme.notTeilnehmen(team.getTeamId(), event.getEventID()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Team nimmt nicht mehr am Event teil"); + Message.send("TEAM_EVENT_LEFT", player); }else{ TeamTeilnahme.teilnehmen(team.getTeamId(), event.getEventID()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Team nimmt nun am Event §e" + event.getEventName() + " §7 teil!"); - BungeeCore.send(player, "§7Um die Teilnahme abzusagen, wiederhole den Befehl"); + Message.send("TEAM_EVENT_JOINED", player, event.getEventName()); + Message.sendPrefixless("TEAM_EVENT_HOW_TO_LEAVE", player); } } @@ -540,7 +540,7 @@ public class TeamCommand extends BasicCommand { colors.add(new SWListInv.SWListEntry<>(item, stringSWListEntry.getObject())); }); - SWListInv inv = new SWListInv<>(player, "§6Farbe wählen", colors, (click, element) -> {}); + SWListInv inv = new SWListInv<>(player, Message.parse("TEAM_COLOR_TITLE", player), colors, (click, element) -> {}); inv.setCallback((click, element) -> { inv.close(); team.setTeamColor(element); @@ -550,13 +550,13 @@ public class TeamCommand extends BasicCommand { private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){ if(arg.length() < 4 || arg.length() > 15){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen"); + Message.send("TEAM_NAME_LENGHT", player); return true; } Team t = Team.get(arg); if(t != null && t.getTeamId() != team.getTeamId()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEs gibt bereits ein Team mit diesem Namen"); + Message.send("TEAM_NAME_TAKEN", player); return true; } return false; @@ -564,13 +564,13 @@ public class TeamCommand extends BasicCommand { private boolean checkTeamKuerzel(ProxiedPlayer player, Team team, String arg){ if(arg.length() < 2 || arg.length() > 4){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen"); + Message.send("TEAM_KUERZEL_LENGHT", player); return true; } Team t = Team.get(arg); if(t != null && (team == null || t.getTeamId() != team.getTeamId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEs gibt bereits ein Team mit diesem Namen"); + Message.send("TEAM_KUERZEL_TAKEN", player); return true; } return false; @@ -578,7 +578,7 @@ public class TeamCommand extends BasicCommand { private boolean unwantedInTeam(ProxiedPlayer player, SteamwarUser user){ if(user.getTeam() != 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist bereits in einem Team"); + Message.send("TEAM_IN_TEAM", player); return true; } return false; @@ -586,7 +586,7 @@ public class TeamCommand extends BasicCommand { private boolean notInTeam(ProxiedPlayer player, SteamwarUser user){ if(user.getTeam() == 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist in keinem Team"); + Message.send("TEAM_NOT_IN_TEAM", player); return true; } return false; @@ -596,7 +596,7 @@ public class TeamCommand extends BasicCommand { if(notInTeam(player, user)) return true; if(team.getTeamLeader() != user.getId()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu bist nicht der Teamleader"); + Message.send("TEAM_NOT_LEADER", player); return true; } return false; @@ -604,7 +604,7 @@ public class TeamCommand extends BasicCommand { private boolean notDuringEvent(ProxiedPlayer player){ if(Event.get() != null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDies ist während eines Events nicht möglich"); + Message.send("TEAM_NOT_IN_EVENT", player); return true; } return false; diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 578715d2..de1f3a1c 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -3,6 +3,7 @@ SPACER= UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. +UNKNOWN_TEAM=§cDieses Team gibt es nicht INVALID_TIME=§cUngültige Zeitangabe. JOIN_PLAYER_BLOCK=§cDu kannst diesem Spieler derzeit nicht folgen. @@ -291,6 +292,10 @@ TC_NO_TEAM=§cDu bist in keinem Team TC_FORMAT=§8TC §e{0}§8» §r{1} #TeamCommand +TEAM_IN_TEAM=§cDu bist bereits in einem Team +TEAM_NOT_IN_TEAM=§cDu bist in keinem Team +TEAM_NOT_LEADER=§cDu bist nicht der Teamleader +TEAM_NOT_IN_EVENT=§cDies ist während eines Events nicht möglich TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team TEAM_HELP_LIST=§8/§eteam list §8- §7Liste alle Teams auf TEAM_HELP_INFO=§8/§eteam info §8- §7Informiere dich über ein Team @@ -342,10 +347,14 @@ TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt #Team Kuerzel TEAM_KUERZEL_SYNTAX=§8/§eteam changekuerzel §8[§eTeamkürzel§8] TEAM_KUERZEL_CHANGED=§7Du hast das Kürzel des Teams geändert! +TEAM_KUERZEL_LENGHT=§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen +TEAM_KUERZEL_TAKEN=§cEs gibt bereits ein Team mit diesem Namen #Team Name TEAM_NAME_SYNTAX=§8/§eteam changename §8[§eTeamname§8] TEAM_NAME_CHANGED=§7Du hast das Team umbenannt! +TEAM_NAME_LENGHT=§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen +TEAM_NAME_TAKEN=§cEs gibt bereits ein Team mit diesem Namen #Team Leader TEAM_LEADER_SYNTAX=§cBitte gib ein Teammitglied an @@ -353,4 +362,32 @@ TEAM_LEADER_NOT_USER=§cDen Spieler {0} gibt es nicht TEAM_LEADER_NOT_MEMBER=§cDer Spieler ist nicht in deinem Team TEAM_LEADER_CHANGED=§7Du hast den Spieler §e{0} §7zum Leader gemacht! -#Team Info \ No newline at end of file +#Team Info +TEAM_INFO_SYNTAX=§8/§eteam info §8[§eTeamname§8] +TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8] +TEAM_INFO_LEADER=§7Leader§8: {0} +TEAM_INFO_MEMBER=§7Member§8: {0} +TEAM_INFO_EVENTS=§7Events§8: §e{0} + +#Team List +TEAM_LIST_NOT_PAGE=§cKeine Seitenzahl angegeben +TEAM_LIST_UNKNOWN_PAGE=§cUngültige Seitenzahl angegeben +TEAM_LIST_HEADER=§7§lTeamliste §7{0}§8/§7{1} +TEAM_LIST_TEAM=§{0}{1} §e{2} §8[§7{3}}§8] +TEAM_LIST_TEAM_HOVER=§7Teaminfo +TEAM_LIST_PAGE=Seite +TEAM_LIST_NEXT=§eNächste Seite +TEAM_LIST_PREV=§eVorherige Seite + +#Team Event +TEAM_EVENT_SYNTAX=§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen +TEAM_EVENT_HEADER=§7Dein Team nimmt an folgenden Events teil§8: +TEAM_EVENT_EVENT=§7{0}§8: §e{1} +TEAM_EVENT_NO_EVENT=§cDieses Event gibt es nicht +TEAM_EVENT_OVER=§cDieses Event ist bereits vorbei +TEAM_EVENT_LEFT=§7Dein Team nimmt nicht mehr am Event teil +TEAM_EVENT_JOINED=§7Dein Team nimmt nun am Event §e{0} §7 teil! +TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl + +#Team Color +TEAM_COLOR_TITLE=§6Farbe wählen \ No newline at end of file From 88ac5a72816fcab7c4b0ef60146d90784edba9a8 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 15:07:34 +0100 Subject: [PATCH 047/108] Add TpCommand MultiLang --- .../steamwar/bungeecore/commands/TpCommand.java | 16 +++++++--------- src/de/steamwar/messages/BungeeCore.properties | 8 +++++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index 26143225..7b8830c5 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -35,8 +35,6 @@ import java.util.Arrays; public class TpCommand extends BasicCommand { - private static final String DENY_MESSAGE = "§cDu kannst diesem Spieler derzeit nicht folgen."; - public static void onTp(ChatEvent e, String[] command){ if(!(e.getSender() instanceof ProxiedPlayer)) return; @@ -53,7 +51,7 @@ public class TpCommand extends BasicCommand { if(!(sender instanceof ProxiedPlayer)) return; if(!onTp((ProxiedPlayer) sender, args)) - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cKonnte das angegebene Ziel nicht finden."); + Message.send("TP_NOT_FOUND", sender); } @Override @@ -67,12 +65,12 @@ public class TpCommand extends BasicCommand { private static boolean onTp(ProxiedPlayer player, String[] args){ if(args.length == 0){ if(Event.get() == null) - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§etp §8[§7Spieler§8]"); + Message.send("TP_SYNTAX", player); else - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§etp §8[§7Spieler §8oder §7Team§8]"); + Message.send("TP_SYNTAX_EVENT", player); return true; }else if(CheckCommand.isChecking(player)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu prüfst gerade eine Schematic!"); + Message.send("CHECK_CHECKING", player); return true; } @@ -128,13 +126,13 @@ public class TpCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); }else{ player.connect(server); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index de1f3a1c..48f45d13 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -6,6 +6,7 @@ UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. UNKNOWN_TEAM=§cDieses Team gibt es nicht INVALID_TIME=§cUngültige Zeitangabe. JOIN_PLAYER_BLOCK=§cDu kannst diesem Spieler derzeit nicht folgen. +CHECK_CHECKING=§cDu prüfst gerade eine Schematic! #ModLoader blocker MODLOADER_INSTALLED=§7Du hast §e{0} §7installiert. Daher kannst du keinen Arenen beitreten. @@ -390,4 +391,9 @@ TEAM_EVENT_JOINED=§7Dein Team nimmt nun am Event §e{0} §7 teil! TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl #Team Color -TEAM_COLOR_TITLE=§6Farbe wählen \ No newline at end of file +TEAM_COLOR_TITLE=§6Farbe wählen + +#TpCommand +TP_SYNTAX=§8/§etp §8[§7Spieler§8] +TP_SYNTAX_EVENT=§8/§etp §8[§7Spieler §8oder §7Team§8] +TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. \ No newline at end of file From 8cdcac73718dcc493272ca0a77ba8a66676c1579 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 15:09:30 +0100 Subject: [PATCH 048/108] Add UnbanCommand MultiLang --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 -- src/de/steamwar/bungeecore/commands/UnbanCommand.java | 6 +++--- src/de/steamwar/messages/BungeeCore.properties | 6 +++++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 77013331..5b6485b9 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; @@ -40,7 +39,6 @@ import java.time.Instant; import java.time.format.DateTimeFormatter; import java.util.*; -import static de.steamwar.bungeecore.Storage.sessions; import static de.steamwar.bungeecore.Storage.teamInvitations; public class TeamCommand extends BasicCommand { diff --git a/src/de/steamwar/bungeecore/commands/UnbanCommand.java b/src/de/steamwar/bungeecore/commands/UnbanCommand.java index 080a8d65..eff7bb4e 100644 --- a/src/de/steamwar/bungeecore/commands/UnbanCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnbanCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -35,7 +35,7 @@ public class UnbanCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/unban [Spieler]"); + Message.send("UNBAN_SYNTAX", sender); return; } @@ -43,7 +43,7 @@ public class UnbanCommand extends BasicCommand { if(target == null) return; - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt."); + Message.send("UNBAN_UNBANNED", sender, target.getUserName()); target.ban(Timestamp.from(new Date().toInstant()), ""); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 48f45d13..58f2f3b5 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -396,4 +396,8 @@ TEAM_COLOR_TITLE=§6Farbe wählen #TpCommand TP_SYNTAX=§8/§etp §8[§7Spieler§8] TP_SYNTAX_EVENT=§8/§etp §8[§7Spieler §8oder §7Team§8] -TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. \ No newline at end of file +TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. + +#UnbanCommand +UNBAN_SYNTAX=/unban [Spieler] +UNBAN_UNBANNED=Du hast {0} entbannt. \ No newline at end of file From 327f09d85e14ea0b5b15efeaca6b09c5d9295bb2 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 15:12:10 +0100 Subject: [PATCH 049/108] Add UnIgnoreCommand MultiLang --- .../steamwar/bungeecore/commands/UnIgnoreCommand.java | 10 +++++----- src/de/steamwar/messages/BungeeCore.properties | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java b/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java index f12861ec..1ebf71ef 100644 --- a/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -34,7 +34,7 @@ public class UnIgnoreCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1) { - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eunignore §8[§7Spieler§8]"); + Message.send("UNIGNORE_SYNTAX", sender); return; } @@ -45,15 +45,15 @@ public class UnIgnoreCommand extends BasicCommand { SteamwarUser target = SteamwarUser.get(args[0]); if(target == null){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht!"); + Message.send("UNIGNORE_NOT_PLAYER", p); return; }else if(!IgnoreSystem.isIgnored(user, target)){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler nicht."); + Message.send("UNIGNORE_NOT_IGNORED", p); return; } IgnoreSystem.unIgnore(user, target); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du empfängst nun wieder Nachrichten von §e" + target.getUserName() + "§8."); + Message.send("UNIGNORE_UNIGNORED", p, target.getUserName()); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 58f2f3b5..a1541d2d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -400,4 +400,10 @@ TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. #UnbanCommand UNBAN_SYNTAX=/unban [Spieler] -UNBAN_UNBANNED=Du hast {0} entbannt. \ No newline at end of file +UNBAN_UNBANNED=Du hast {0} entbannt. + +#UnignoreCommand +UNIGNORE_SYNTAX=§8/§eunignore §8[§7Spieler§8] +UNIGNORE_NOT_PLAYER=§cDiesen Spieler gibt es nicht! +UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht. +UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. \ No newline at end of file From 31eff322ab632285512b64208d5fba5bb9ae953e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 15:17:09 +0100 Subject: [PATCH 050/108] Add WebregisterCommand MultiLang --- .../bungeecore/commands/WebregisterCommand.java | 17 +++++++++-------- src/de/steamwar/messages/BungeeCore.properties | 11 ++++++++++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WebregisterCommand.java b/src/de/steamwar/bungeecore/commands/WebregisterCommand.java index 06ed25d4..4ca733ac 100644 --- a/src/de/steamwar/bungeecore/commands/WebregisterCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebregisterCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SWException; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -41,7 +42,7 @@ public class WebregisterCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length != 1){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "/webregister [E-Mail]"); + Message.send("WEB_SYNTAX", player); return; } @@ -55,20 +56,20 @@ public class WebregisterCommand extends BasicCommand { while((errorLine = reader.readLine()) != null){ switch(errorLine){ case "username_exists": - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu hast bereits einen Webaccount."); + Message.send("WEB_ALREADY", player); break; case "email_exists": - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDie E-Mail hast du bereits für einen anderen Account verwendet..."); + Message.send("WEB_ALREADY_EMAIL", player); // SWException.log("Bungee", "Duplicate E-Mail", player.getName() + " " + args[0]); break; case "invalid_email": - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c[E-Mail], nicht [Freitext]!"); + Message.send("WEB_NOT_EMAIL", player); break; case "email_updated": - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDeine E-Mail-Adresse wurde aktualisiert."); + Message.send("WEB_EMAIL_REFRESH", player); break; default: - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin interner Fehler ist aufgetreten, bitte wende dich an einen Developer."); + Message.send("WEB_INTERNAL_ERROR", player); SWException.log("Bungee", "Unknown Wordpress User Creation Error", errorLine); } error = true; @@ -77,9 +78,9 @@ public class WebregisterCommand extends BasicCommand { if(error) return; - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aEine E-Mail zum Setzen des Passworts wurde gesendet."); + Message.send("WEB_EMAIL_SEND", player); } catch (IOException e) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cEin interner Fehler ist aufgetreten, bitte wende dich an einen Developer."); + Message.send("WEB_INTERNAL_ERROR", player); throw new SecurityException("Could not create webaccount", e); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index a1541d2d..d202657d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -406,4 +406,13 @@ UNBAN_UNBANNED=Du hast {0} entbannt. UNIGNORE_SYNTAX=§8/§eunignore §8[§7Spieler§8] UNIGNORE_NOT_PLAYER=§cDiesen Spieler gibt es nicht! UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht. -UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. \ No newline at end of file +UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. + +#WebregisterCommand +WEB_SYNTAX=/webregister [E-Mail] +WEB_ALREADY=§cDu hast bereits einen Webaccount. +WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwendet... +WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]! +WEB_EMAIL_REFRESH=§aDeine E-Mail-Adresse wurde aktualisiert. +WEB_INTERNAL_ERROR=§cEin interner Fehler ist aufgetreten, bitte wende dich an einen Developer. +WEB_EMAIL_SEND=§aEine E-Mail zum Setzen des Passworts wurde gesendet. \ No newline at end of file From 6b469b6da1e009fd323904ee415e449096bc16c6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 16:16:37 +0100 Subject: [PATCH 051/108] Add ChatListener MultiLang --- .../bungeecore/listeners/ChatListener.java | 40 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 18 ++++++++- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 878ea45e..3470ea62 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.listeners; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.commands.BauCommand; @@ -28,10 +29,7 @@ import de.steamwar.bungeecore.comms.packets.PingPacket; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; import de.steamwar.bungeecore.sql.UserGroup; -import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.Title; +import net.md_5.bungee.api.*; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.ChatEvent; @@ -73,7 +71,7 @@ public class ChatListener extends BasicListener { String [] command = e.getMessage().split(" "); if(command[0].contains(":")){ if(e.getSender() instanceof ProxiedPlayer) - BungeeCore.send((ProxiedPlayer) e.getSender(), BungeeCore.CHAT_PREFIX + "§cUnbekannter Befehl."); + Message.send("UNKNOWN_COMMAND", (CommandSender) e.getSender()); e.setCancelled(true); return; } @@ -99,25 +97,23 @@ public class ChatListener extends BasicListener { private void lixfelAlert(ProxiedPlayer sender) { LIXFEL.send(sender); - final String l = "§eLixfel§8»§e" + sender.getName() + " §c"; - BungeeCore.send(sender, ChatMessageType.ACTION_BAR, "§4§lTechnische Probleme?"); + Message.send("CHAT_LIXFEL_ACTION_BAR", sender, ChatMessageType.ACTION_BAR); TaskScheduler scheduler = ProxyServer.getInstance().getScheduler(); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Du hast mich gerufen!"), 3, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Leider bin ich nur ein Mensch und höre nicht alles."), 6, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Daher bitte ich dich, das Problem bzw. den Fehler im Forum in der Kategorie §eFehler melden §cmit einer ausreichenden Beschreibung zu hinterlegen."), 11, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Vielen Dank."), 12, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis."), 15, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "Lixfel", sender.getDisplayName(), Message.parse("CHAT_LIXFEL_1", sender)), 3, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "Lixfel", sender.getDisplayName(), Message.parse("CHAT_LIXFEL_2", sender)), 6, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "Lixfel", sender.getDisplayName(), Message.parse("CHAT_LIXFEL_3", sender)), 11, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "Lixfel", sender.getDisplayName(), Message.parse("CHAT_LIXFEL_4", sender)), 12, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "Lixfel", sender.getDisplayName(), Message.parse("CHAT_LIXFEL_5", sender)), 15, TimeUnit.SECONDS); } private void yoyonowAlert(ProxiedPlayer sender) { YOYONOW.send(sender); - final String l = "§eYoyoNow§8»§e" + sender.getName() + " §c"; - BungeeCore.send(sender, ChatMessageType.ACTION_BAR, "§4§lTechnische Probleme?"); + Message.send("CHAT_LIXFEL_ACTION_BAR", sender, ChatMessageType.ACTION_BAR); TaskScheduler scheduler = ProxyServer.getInstance().getScheduler(); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Du hast mich gerufen!"), 3, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Ich würde dir gerne den Befehl \"/bug \" ans Herz legen."), 10, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Vielen Dank."), 12, TimeUnit.SECONDS); - scheduler.schedule(BungeeCore.get(), () -> BungeeCore.send(sender, l + "Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis."), 15, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "YoyoNow", sender.getDisplayName(), Message.parse("CHAT_YOYONOW_1", sender)), 3, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "YoyoNow", sender.getDisplayName(), Message.parse("CHAT_YOYONOW_2", sender)), 6, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "YoyoNow", sender.getDisplayName(), Message.parse("CHAT_YOYONOW_3", sender)), 11, TimeUnit.SECONDS); + scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "YoyoNow", sender.getDisplayName(), Message.parse("CHAT_YOYONOW_4", sender)), 12, TimeUnit.SECONDS); } private void onChat(ChatEvent e){ @@ -130,7 +126,7 @@ public class ChatListener extends BasicListener { yoyonowAlert(sender); if(sender.getChatMode() != ProxiedPlayer.ChatMode.SHOWN){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen!"); + Message.send("CHAT_RECEIVE", sender); e.setCancelled(true); return; } @@ -143,7 +139,7 @@ public class ChatListener extends BasicListener { } if(!sender.hasPermission(ConnectionListener.TEAM_GROUP) && (e.getMessage().contains("http") || e.getMessage().contains("www"))){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDu darfst keine Links versenden."); + Message.send("CHAT_NO_LINKS", sender); e.setCancelled(true); return; } @@ -194,7 +190,7 @@ public class ChatListener extends BasicListener { ProxiedPlayer sender = (ProxiedPlayer) e.getSender(); BungeeCore.log(sender, e.getMessage()); if(command.length == 1){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§e" + command[0].substring(1) + " §8[§7Nachricht§8]"); + Message.send("CHAT_BC_SYNTAX", sender, command[0].substring(1)); e.setCancelled(true); return; } @@ -207,7 +203,7 @@ public class ChatListener extends BasicListener { } if(command[1].startsWith("/")){ - BungeeCore.send(sender, "§cKeine Befehle mit /local möglich."); + Message.send("CHAT_BC_NO_COMMANDS", sender); e.setCancelled(true); return; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index d202657d..6e934d6f 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -415,4 +415,20 @@ WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwe WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]! WEB_EMAIL_REFRESH=§aDeine E-Mail-Adresse wurde aktualisiert. WEB_INTERNAL_ERROR=§cEin interner Fehler ist aufgetreten, bitte wende dich an einen Developer. -WEB_EMAIL_SEND=§aEine E-Mail zum Setzen des Passworts wurde gesendet. \ No newline at end of file +WEB_EMAIL_SEND=§aEine E-Mail zum Setzen des Passworts wurde gesendet. + +#ChatListener +CHAT_LIXFEL_ACTION_BAR=§4§lTechnische Probleme? +CHAT_LIXFEL_1=Du hast mich gerufen! +CHAT_LIXFEL_2=Leider bin ich nur ein Mensch und höre nicht alles. +CHAT_LIXFEL_3=Daher bitte ich dich, das Problem bzw. den Fehler im Forum in der Kategorie §eFehler melden §cmit einer ausreichenden Beschreibung zu hinterlegen. +CHAT_LIXFEL_4=Vielen Dank. +CHAT_LIXFEL_5=Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis. +CHAT_YOYONOW_1=Du hast mich gerufen! +CHAT_YOYONOW_2=Ich würde dir gerne den Befehl "/bug " ans Herz legen. +CHAT_YOYONOW_3=Vielen Dank. +CHAT_YOYONOW_4=Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis. +CHAT_RECEIVE=§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen! +CHAT_NO_LINKS=§cDu darfst keine Links versenden. +CHAT_BC_SYNTAX=§8/§e{0} §8[§7Nachricht§8] +CHAT_BC_NO_COMMANDS=§cKeine Befehle mit /local möglich. \ No newline at end of file From 85bc8aa3ec68a5493e4e86f5c8a367a7ab6fc28b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 16:19:32 +0100 Subject: [PATCH 052/108] Add CheckListener MultiLang --- src/de/steamwar/bungeecore/listeners/CheckListener.java | 7 ++----- src/de/steamwar/messages/BungeeCore.properties | 5 ++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/CheckListener.java b/src/de/steamwar/bungeecore/listeners/CheckListener.java index 133f9150..f4aec741 100644 --- a/src/de/steamwar/bungeecore/listeners/CheckListener.java +++ b/src/de/steamwar/bungeecore/listeners/CheckListener.java @@ -19,10 +19,7 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.Bauserver; -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.Servertype; -import de.steamwar.bungeecore.Subserver; +import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.commands.CheckCommand; import de.steamwar.bungeecore.sql.Schematic; import de.steamwar.bungeecore.sql.SchematicType; @@ -50,7 +47,7 @@ public class CheckListener extends BasicListener { } if(!uncheckedSchematics.isEmpty()) - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast noch §e" + uncheckedSchematics.size() + " §7ungeprüfte Schematic§8(§7s§8)!"); + Message.send("CHECK_UNCHECKED", player, uncheckedSchematics.size()); } @EventHandler diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6e934d6f..b60c1974 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -431,4 +431,7 @@ CHAT_YOYONOW_4=Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis. CHAT_RECEIVE=§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen! CHAT_NO_LINKS=§cDu darfst keine Links versenden. CHAT_BC_SYNTAX=§8/§e{0} §8[§7Nachricht§8] -CHAT_BC_NO_COMMANDS=§cKeine Befehle mit /local möglich. \ No newline at end of file +CHAT_BC_NO_COMMANDS=§cKeine Befehle mit /local möglich. + +#CheckListner +CHECK_UNCHECKED=§7Du hast noch §e{0} §7ungeprüfte Schematic§8(§7s§8)! \ No newline at end of file From fa9f4f7e793d241c2fd7e31206bdf8304cb117fc Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 16:25:03 +0100 Subject: [PATCH 053/108] Add ConnectionListener MultiLang --- .../bungeecore/listeners/ConnectionListener.java | 9 ++++----- src/de/steamwar/messages/BungeeCore.properties | 7 ++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index 0deb4687..7f0f88f9 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.listeners; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.commands.ChallengeCommand; @@ -83,16 +84,14 @@ public class ConnectionListener extends BasicListener { if(subserver.getType() == Servertype.ARENA){ Iterator it = subserver.getServer().getPlayers().iterator(); if(it.hasNext()){ - TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§7, um §e" + subserver.getServer().getName() + " §7beizutreten"); - tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§eArena beitreten").create())); - tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + it.next().getName())); - player.sendMessage(tc); + Message.send("JOIN_ARENA", player, Message.parse("JOIN_ARENA_HOVER", player), + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + it.next().getName()), subserver.getServer().getName()); } } } if(newPlayers.contains(player.getUniqueId())){ - BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7Begrüßt alle mal §e" + player.getName() + " §7auf dem Server§8!"); + Message.broadcast("JOIN_FIRST", player.getName()); newPlayers.remove(player.getUniqueId()); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index b60c1974..6df61ecb 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -434,4 +434,9 @@ CHAT_BC_SYNTAX=§8/§e{0} §8[§7Nachricht§8] CHAT_BC_NO_COMMANDS=§cKeine Befehle mit /local möglich. #CheckListner -CHECK_UNCHECKED=§7Du hast noch §e{0} §7ungeprüfte Schematic§8(§7s§8)! \ No newline at end of file +CHECK_UNCHECKED=§7Du hast noch §e{0} §7ungeprüfte Schematic§8(§7s§8)! + +#ConnectionListener +JOIN_ARENA=§7Klicke §ehier§7, um §e{0} §7beizutreten +JOIN_ARENA_HOVER=§eArena beitreten +JOIN_FIRST=§7Begrüßt alle mal §e{0} §7auf dem Server§8! \ No newline at end of file From 11a339f785a5772ab434ce0b27f99f683fcd9f85 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 16:26:59 +0100 Subject: [PATCH 054/108] Add EventModeListener MultiLang --- .../steamwar/bungeecore/listeners/EventModeListener.java | 8 +++----- src/de/steamwar/messages/BungeeCore.properties | 5 ++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/EventModeListener.java b/src/de/steamwar/bungeecore/listeners/EventModeListener.java index c5bc2561..852703ce 100644 --- a/src/de/steamwar/bungeecore/listeners/EventModeListener.java +++ b/src/de/steamwar/bungeecore/listeners/EventModeListener.java @@ -1,25 +1,23 @@ package de.steamwar.bungeecore.listeners; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.TeamTeilnahme; -import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.event.EventHandler; public class EventModeListener extends BasicListener { - private static final BaseComponent[] nonParticipant = TextComponent.fromLegacyText("§cDu bist kein Eventteilnehmer."); - @EventHandler public void onPostLogin(PostLoginEvent e) { SteamwarUser user = SteamwarUser.get(e.getPlayer().getUniqueId()); Event event = Event.get(); if(event == null){ - e.getPlayer().disconnect(nonParticipant); + e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.parse("EVENTMODE_KICK", e.getPlayer()))); return; } @@ -31,6 +29,6 @@ public class EventModeListener extends BasicListener { return; } - e.getPlayer().disconnect(nonParticipant); + e.getPlayer().disconnect(TextComponent.fromLegacyText(Message.parse("EVENTMODE_KICK", e.getPlayer()))); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6df61ecb..9a49501a 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -439,4 +439,7 @@ CHECK_UNCHECKED=§7Du hast noch §e{0} §7ungeprüfte Schematic§8(§7s§8)! #ConnectionListener JOIN_ARENA=§7Klicke §ehier§7, um §e{0} §7beizutreten JOIN_ARENA_HOVER=§eArena beitreten -JOIN_FIRST=§7Begrüßt alle mal §e{0} §7auf dem Server§8! \ No newline at end of file +JOIN_FIRST=§7Begrüßt alle mal §e{0} §7auf dem Server§8! + +#EventModeListener +EVENTMODE_KICK=§cDu bist kein Eventteilnehmer. \ No newline at end of file From 1b69057eead86518a79e2b788a2a16d874bed6b6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 16:38:30 +0100 Subject: [PATCH 055/108] Add PollSystem MultiLang --- .../steamwar/bungeecore/listeners/PollSystem.java | 13 ++++++------- src/de/steamwar/messages/BungeeCore.properties | 9 ++++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/PollSystem.java b/src/de/steamwar/bungeecore/listeners/PollSystem.java index 3dcca630..85ca553b 100644 --- a/src/de/steamwar/bungeecore/listeners/PollSystem.java +++ b/src/de/steamwar/bungeecore/listeners/PollSystem.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.PollAnswer; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.chat.ClickEvent; @@ -56,14 +56,13 @@ public class PollSystem extends BasicListener { } public static void sendPoll(ProxiedPlayer player){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§e§lUmfrage"); - BungeeCore.send(player, "§7Klicke die Antwort an, die dir gefällt!"); - BungeeCore.send(player, "§e" + question); + Message.send("POLL_HEADER", player); + Message.sendPrefixless("POLL_HEADER2", player); + Message.sendPrefixless("POLL_QUESTION", player, question); for(int i = 1; i <= answers.size(); i++){ - BungeeCore.send(player, "§7" + answers.get(i-1), - "§e" + answers.get(i-1) + " §ewählen", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + i)); + Message.send("POLL_ANWSER", player, Message.parse("POLL_ANWSER_HOVER", player, answers.get(i-1)), + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/poll " + i), answers.get(i-1)); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9a49501a..f9c6f7c9 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -442,4 +442,11 @@ JOIN_ARENA_HOVER=§eArena beitreten JOIN_FIRST=§7Begrüßt alle mal §e{0} §7auf dem Server§8! #EventModeListener -EVENTMODE_KICK=§cDu bist kein Eventteilnehmer. \ No newline at end of file +EVENTMODE_KICK=§cDu bist kein Eventteilnehmer. + +#PollSystem +POLL_HEADER=§e§lUmfrage +POLL_HEADER2=§7Klicke die Antwort an, die dir gefällt! +POLL_QUESTION=§e{0} +POLL_ANWSER=§7{0} +POLL_ANWSER_HOVER=§e{0} §ewählen \ No newline at end of file From 6bd9cd6fddcfc11e2686c633ed7430f899f9230d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 17:39:51 +0100 Subject: [PATCH 056/108] Add TablistManager MultiLang --- .../bungeecore/listeners/TablistManager.java | 48 +++++++++---------- .../steamwar/messages/BungeeCore.properties | 9 +++- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index 123ef946..a7dbc03e 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -23,6 +23,7 @@ import codecrafter47.bungeetablistplus.api.bungee.BungeeTabListPlusAPI; import codecrafter47.bungeetablistplus.api.bungee.Icon; import codecrafter47.bungeetablistplus.tablist.DefaultCustomTablist; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.sql.SteamwarUser; @@ -49,7 +50,6 @@ public class TablistManager extends BasicListener { private Icon darkGray; private Icon gray; - private String header; private int size; private TreeMap> playerMap = new TreeMap<>(); @@ -67,25 +67,25 @@ public class TablistManager extends BasicListener { } } - private void calcHeader(){ - if(seconds % 4 == 0){ - int phase = (seconds % 16) / 4; - switch(phase){ - case 0: - header = "§8Spieler online: §e" + ProxyServer.getInstance().getPlayers().size(); - break; - case 1: - header = "§8Teamspeak: §eSteam§8War.de"; - break; - case 2: - header = "§8Discord: §8https://discord.gg/J4NtQmM"; - break; - case 3: - default: - header = "§8Website: https://§eSteam§8War.de"; - break; - } + private String calcHeader(ProxiedPlayer player){ + String header; + int phase = (seconds % 16) / 4; + switch(phase){ + case 0: + header = Message.parse("TABLIST_PHASE_0", player, ProxyServer.getInstance().getPlayers().size()); + break; + case 1: + header = Message.parse("TABLIST_PHASE_1", player); + break; + case 2: + header = Message.parse("TABLIST_PHASE_2", player); + break; + case 3: + default: + header = Message.parse("TABLIST_PHASE_DEFAULT", player); + break; } + return header; } private void calculateSize(){ @@ -100,8 +100,6 @@ public class TablistManager extends BasicListener { } private synchronized void updateCustomTablist(){ - calcHeader(); - //Calculate server-player-map playerMap.clear(); for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ @@ -115,9 +113,9 @@ public class TablistManager extends BasicListener { Subserver subserver = Subserver.getSubserver(server); List players; if(subserver != null && subserver.getType() == Servertype.BAUSERVER){ - players = playerMap.getOrDefault("Bau", new ArrayList<>()); + players = playerMap.getOrDefault("%bauserverplaceholder%", new ArrayList<>()); players.add(player); - playerMap.putIfAbsent("Bau", players); + playerMap.putIfAbsent("%bauserverplaceholder%", players); }else{ players = playerMap.getOrDefault(serverName, new ArrayList<>()); players.add(player); @@ -168,7 +166,7 @@ public class TablistManager extends BasicListener { try { ServerInfo currentServer = player.getServer().getInfo(); - setHeader(header); + setHeader(calcHeader(player)); setFooter("§e" + currentServer.getName() + " " + getPing() + "§8ms"); setSize(size, 20); @@ -178,6 +176,8 @@ public class TablistManager extends BasicListener { setSlot(i%20, i/20, darkGray, "", 1000); i++; } + if(server.equals("%bauserverplaceholder%")) + server = Message.parse("TABLIST_BAU", player); setSlot(i%20, i/20, gray, "§7§l" + server, 1000); i++; for (ProxiedPlayer p : playerMap.get(server)){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index f9c6f7c9..259253d9 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -449,4 +449,11 @@ POLL_HEADER=§e§lUmfrage POLL_HEADER2=§7Klicke die Antwort an, die dir gefällt! POLL_QUESTION=§e{0} POLL_ANWSER=§7{0} -POLL_ANWSER_HOVER=§e{0} §ewählen \ No newline at end of file +POLL_ANWSER_HOVER=§e{0} §ewählen + +#TablistManager +TABLIST_PHASE_0=§8Spieler online: §e{0} +TABLIST_PHASE_1=§8Teamspeak: §eSteam§8War.de +TABLIST_PHASE_2=§8Discord: §8https://§eSteam§8War.de/discord +TABLIST_PHASE_DEFAULT=§8Website: https://§eSteam§8War.de +TABLIST_BAU=Bau \ No newline at end of file From 7f54c75ae4f3414e8d3cd35954f5c4e4726ae554 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 17:51:48 +0100 Subject: [PATCH 057/108] Add EventStarter MultiLang --- src/de/steamwar/bungeecore/EventStarter.java | 5 ++--- src/de/steamwar/messages/BungeeCore.properties | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/EventStarter.java b/src/de/steamwar/bungeecore/EventStarter.java index 5271eccc..3d466fdc 100644 --- a/src/de/steamwar/bungeecore/EventStarter.java +++ b/src/de/steamwar/bungeecore/EventStarter.java @@ -73,9 +73,8 @@ public class EventStarter implements Runnable { eventServer.put(blue.getTeamId(), subserver); eventServer.put(red.getTeamId(), subserver); - BungeeCore.broadcast(BungeeCore.CHAT_PREFIX + "§7Hier §eklicken §7für den Kampf §" + blue.getTeamColor() + blue.getTeamName() + " §8vs §" + red.getTeamColor() + red.getTeamName(), - "§eEvent beitreten", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel())); + Message.broadcast("EVENT_FIGHT_BROADCAST", true, "EVENT_FIGHT_BROADCAST_HOVER", + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 259253d9..c92da4c4 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -456,4 +456,8 @@ TABLIST_PHASE_0=§8Spieler online: §e{0} TABLIST_PHASE_1=§8Teamspeak: §eSteam§8War.de TABLIST_PHASE_2=§8Discord: §8https://§eSteam§8War.de/discord TABLIST_PHASE_DEFAULT=§8Website: https://§eSteam§8War.de -TABLIST_BAU=Bau \ No newline at end of file +TABLIST_BAU=Bau + +#EventStarter +EVENT_FIGHT_BROADCAST=§7Hier §eklicken §7für den Kampf §{0}{1} §8vs §{2}{3} +EVENT_FIGHT_BROADCAST_HOVER=§eEvent beitreten \ No newline at end of file From 93d1249713789383e4d9e27a7d0cfa2daf9cfea9 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 20:18:14 +0100 Subject: [PATCH 058/108] Add SubserverSystem MultiLang --- src/de/steamwar/bungeecore/SubserverSystem.java | 14 +++++++------- src/de/steamwar/messages/BungeeCore.properties | 9 ++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index 962ea793..cf00ae24 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -29,6 +29,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.io.File; import java.io.IOException; +import java.time.format.DateTimeFormatter; import java.util.*; public class SubserverSystem { @@ -163,7 +164,7 @@ public class SubserverSystem { eventFight.getFightID(), 0, serverName, - serverName.replace(' ', '_') + eventFight.getStartTime().toLocalDateTime().format(EventCommand.TIME_FORMAT), + serverName.replace(' ', '_') + eventFight.getStartTime().toLocalDateTime().format(DateTimeFormatter.ISO_TIME), null, null); } @@ -223,13 +224,12 @@ public class SubserverSystem { if(o == null) return; if(IgnoreSystem.isIgnored(o, p)){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat dich geblockt!"); + Message.send("SERVER_IGNORED", p); return; } - BungeeCore.send(o, BungeeCore.CHAT_PREFIX + "§e" + p.getName() + " §7möchte auf deine Bauwelt."); - BungeeCore.send(o, "§7Klicke §ehier§7, wenn du das erlauben möchtest.", - "§e/bau addmember " + p.getName(), + Message.send("SERVER_ADD_MEMBER", o, p.getName()); + Message.sendPrefixless("SERVER_ADD_MESSAGE", o, Message.parse("SERVER_ADD_MESSAGE_HOVER", o, p.getName()), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau addmember " + p.getName())); } @@ -281,11 +281,11 @@ public class SubserverSystem { pr = pb.start(); pr.waitFor(); } catch (IOException e) { - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen."); + Message.send("SERVER_WORLD_ERROR", p); throw new SecurityException("Could not create Bauwelt", e); } catch (InterruptedException e){ BungeeCore.log("Could not create Bauwelt", e); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDas Erstellen der Welt ist fehlgeschlagen."); + Message.send("SERVER_WORLD_ERROR", p); Thread.currentThread().interrupt(); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index c92da4c4..c06e4993 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -460,4 +460,11 @@ TABLIST_BAU=Bau #EventStarter EVENT_FIGHT_BROADCAST=§7Hier §eklicken §7für den Kampf §{0}{1} §8vs §{2}{3} -EVENT_FIGHT_BROADCAST_HOVER=§eEvent beitreten \ No newline at end of file +EVENT_FIGHT_BROADCAST_HOVER=§eEvent beitreten + +#SubserverSystem +SERVER_IGNORED=§cDieser Spieler hat dich geblockt! +SERVER_ADD_MEMBER=§e{0} §7möchte auf deine Bauwelt. +SERVER_ADD_MESSAGE=§7Klicke §ehier§7, wenn du das erlauben möchtest. +SERVER_ADD_MESSAGE_HOVER=§e/bau addmember {0} +SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen. \ No newline at end of file From 64d115bd30d898bdece194b17e38fe867248ee2c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 20:19:10 +0100 Subject: [PATCH 059/108] Add SubserverSystem MultiLang --- src/de/steamwar/bungeecore/SubserverSystem.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index cf00ae24..50d55526 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore; -import de.steamwar.bungeecore.commands.EventCommand; import de.steamwar.bungeecore.sql.EventFight; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.SteamwarUser; From bef39c7cc2a4fd1038acaa88ba568014497fb308 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 22 Jan 2021 10:41:57 +0100 Subject: [PATCH 060/108] Fixing... --- .../bungeecore/commands/BanCommand.java | 2 +- .../bungeecore/commands/MuteCommand.java | 2 +- .../bungeecore/commands/WhoisCommand.java | 2 +- .../bungeecore/listeners/BanListener.java | 2 +- .../steamwar/bungeecore/sql/Punishment.java | 21 ++++++++++---- .../steamwar/bungeecore/sql/SteamwarUser.java | 28 +++++-------------- .../steamwar/messages/BungeeCore.properties | 10 +++---- 7 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index e977fefe..293b3f1c 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -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){ diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 0ab8d29f..ea778885 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -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); } } diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index c774ac1f..f30e8fed 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -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; } diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index c62a17d0..80f666eb 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -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; } diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 2e14a2a9..09a5fd12 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -43,12 +43,15 @@ public class Punishment { } public static Map getPunishmentsOfPlayer(int user) { - Map 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); - return punishments; + ResultSet set = SQL.select("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) WHERE UserId = ? GROUP BY Type)", user); + try { + Map punishments = new HashMap<>(); + 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 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; diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 3f926a66..4c5b562a 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -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)); - } - - private boolean isCurrent(Punishment punishment) { - return punishment.isPerma() || punishment.getEndTime().after(new Date()); + if(!punishments.get(Punishment.PunishmentType.Mute).isCurrent()) { + punishments.remove(Punishment.PunishmentType.Mute); + return false; + } + 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; diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 0b8b8309..5f6c5a6b 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -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 From 7f802c7a8a057757b732ff65dbe620ee76cca28f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 22 Jan 2021 11:02:40 +0100 Subject: [PATCH 061/108] Minor Changes --- src/de/steamwar/bungeecore/commands/WhoisCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index f30e8fed..5bcb2b6e 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -84,7 +84,7 @@ public class WhoisCommand extends BasicCommand { 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()); + 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()); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 5f6c5a6b..c5b0e66f 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -105,10 +105,10 @@ MOD_YELLOW_PLUR=§7Deaktiviere die Mods\n§e{0}\n§7um weiter auf §eSteam§8War ALERT=§f{0} #Ban&Mute-Command -BAN_TEAM_BANNED={0}§c{1} wurde von {2} {3} gebannt. §f§lGrund: §f{4} +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={0}§c{1} wurde von {2} {3} gemuted. §f§lGrund: §f{4} +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} @@ -173,4 +173,4 @@ 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. \ No newline at end of file +WHOIS_NO_PUNISHMENT=§a✓ §7Der Spieler hat noch nichts getan. \ No newline at end of file From d0fdeea038263056195785b5b55053cca3770a3e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 22 Jan 2021 13:55:03 +0100 Subject: [PATCH 062/108] Syntax to Usage --- .../bungeecore/commands/BauCommand.java | 8 +-- .../bungeecore/commands/ChallengeCommand.java | 2 +- .../bungeecore/commands/EventCommand.java | 2 +- .../commands/EventRescheduleCommand.java | 2 +- .../bungeecore/commands/JoinmeCommand.java | 2 +- .../bungeecore/commands/KickCommand.java | 2 +- .../bungeecore/commands/MsgCommand.java | 2 +- .../bungeecore/commands/RCommand.java | 2 +- .../commands/ServerTeamchatCommand.java | 2 +- .../bungeecore/commands/TeamCommand.java | 18 +++--- .../bungeecore/commands/TeamchatCommand.java | 2 +- .../bungeecore/commands/TpCommand.java | 4 +- .../bungeecore/commands/UnIgnoreCommand.java | 2 +- .../bungeecore/commands/UnbanCommand.java | 2 +- .../commands/WebregisterCommand.java | 3 +- .../bungeecore/listeners/ChatListener.java | 2 +- .../steamwar/messages/BungeeCore.properties | 56 +++++++++---------- 17 files changed, 56 insertions(+), 57 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 87fd8dbc..3c388366 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -113,7 +113,7 @@ public class BauCommand { private static void addmember(ProxiedPlayer p, String[] command){ if (command.length == 2) { - Message.send("BAU_ADDMEMBER_SYNTAX", p); + Message.send("BAU_ADDMEMBER_USAGE", p); return; } @@ -139,7 +139,7 @@ public class BauCommand { private static void teleport(ProxiedPlayer p, String[] command){ if (command.length == 2) { - Message.send("BAU_TP_SYNTAX", p); + Message.send("BAU_TP_USAGE", p); return; } @@ -212,7 +212,7 @@ public class BauCommand { private static void delmember(ProxiedPlayer p, String[] command){ if (command.length == 2) { - Message.send("BAU_DELMEMBER_SYNTAX", p); + Message.send("BAU_DELMEMBER_USAGE", p); return; } @@ -303,7 +303,7 @@ public class BauCommand { private static BauweltMember toggle(ProxiedPlayer p, String[] command, String subcommand){ if (command.length == 2) { - Message.send("BAU_MEMBER_TOGGLE_SYNTAX", p, subcommand); + Message.send("BAU_MEMBER_TOGGLE_USAGE", p, subcommand); return null; } diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 59de2b1c..9d293871 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -40,7 +40,7 @@ public class ChallengeCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1){ - Message.send("CHALLENGE_SYNTAX", sender); + Message.send("CHALLENGE_USAGE", sender); return; } diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index a81d075c..6ac39f48 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -97,7 +97,7 @@ public class EventCommand extends BasicCommand { } private void eventOverview(ProxiedPlayer player, Event currentEvent){ - Message.send("EVENT_SYNTAX", player); + Message.send("EVENT_USAGE", player); List fights = EventFight.getEvent(currentEvent.getEventID()); Instant now = Instant.now(); diff --git a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java index 8cb3689a..06934f37 100644 --- a/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventRescheduleCommand.java @@ -44,7 +44,7 @@ public class EventRescheduleCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length != 2){ - Message.send("EVENTRESCHEDULE_SYNTAX", player); + Message.send("EVENTRESCHEDULE_USAGE", player); return; } diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 593015f7..ef9f4254 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -78,7 +78,7 @@ public class JoinmeCommand extends BasicCommand { player.connect(server); } } else { - Message.send("JOINME_SYNTAX", player); + Message.send("JOINME_USAGE", player); } } } diff --git a/src/de/steamwar/bungeecore/commands/KickCommand.java b/src/de/steamwar/bungeecore/commands/KickCommand.java index 68b315f8..44b5b977 100644 --- a/src/de/steamwar/bungeecore/commands/KickCommand.java +++ b/src/de/steamwar/bungeecore/commands/KickCommand.java @@ -36,7 +36,7 @@ public class KickCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length == 0){ - Message.send("KICK_SYNTAX", sender); + Message.send("KICK_USAGE", sender); return; } diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index e2a1841d..1cbd45bc 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -43,7 +43,7 @@ public class MsgCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if (args.length < 2) { - Message.send("MSG_SYNTAX", player); + Message.send("MSG_USAGE", player); return; } diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index e8440f83..c3f0c082 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -39,7 +39,7 @@ public class RCommand extends BasicCommand { if(sender instanceof ProxiedPlayer){ ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length == 0){ - Message.send("R_SYNTAX", player); + Message.send("R_USAGE", player); return; } diff --git a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java index c90b6081..96cf0def 100644 --- a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java @@ -37,7 +37,7 @@ public class ServerTeamchatCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length == 0){ - Message.sendPrefixless("STC_SYNTAX", player); + Message.sendPrefixless("STC_USAGE", player); return; } diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 5b6485b9..1abcdfcd 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -162,7 +162,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 3){ - Message.send("TEAM_CREATE_SYNTAX", player); + Message.send("TEAM_CREATE_USAGE", player); return; } @@ -196,7 +196,7 @@ public class TeamCommand extends BasicCommand { t = invs.get(0); }else{ if(args.length != 2){ - Message.send("TEAM_JOIN_SYNTAX", player); + Message.send("TEAM_JOIN_USAGE", player); StringBuilder sb = new StringBuilder(); for(int inv : invs){ Team team = Team.get(inv); @@ -252,7 +252,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length != 2){ - Message.send("TEAM_INVITE_SYNTAX", player); + Message.send("TEAM_INVITE_USAGE", player); return; } @@ -286,7 +286,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length != 2){ - Message.send("TEAM_REMOVE_SYNTAX", player); + Message.send("TEAM_REMOVE_USAGE", player); return; } @@ -333,7 +333,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - Message.send("TEAM_KUERZEL_SYNTAX", player); + Message.send("TEAM_KUERZEL_USAGE", player); return; } @@ -352,7 +352,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - Message.send("TEAM_NAME_SYNTAX", player); + Message.send("TEAM_NAME_USAGE", player); return; } @@ -371,7 +371,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - Message.send("TEAM_LEADER_SYNTAX", player); + Message.send("TEAM_LEADER_USAGE", player); return; } @@ -396,7 +396,7 @@ public class TeamCommand extends BasicCommand { private void info(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ if(args.length == 1 && user.getTeam() == 0){ - Message.send("TEAM_INFO_SYNTAX", player); + Message.send("TEAM_INFO_USAGE", player); return; }else if(user.getTeam() == 0 || args.length == 2){ team = Team.get(args[1]); @@ -486,7 +486,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - Message.send("TEAM_EVENT_SYNTAX", player); + Message.send("TEAM_EVENT_USAGE", player); Set events = TeamTeilnahme.getEvents(team.getTeamId()); if(!events.isEmpty()){ Message.send("TEAM_EVENT_HEADER", player); diff --git a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java index 7b34998a..6abdace3 100644 --- a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java @@ -44,7 +44,7 @@ public class TeamchatCommand extends BasicCommand { } if(args.length == 0){ - Message.send("TC_SYNTAX", player); + Message.send("TC_USAGE", player); return; } diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index 7b8830c5..ae2f9a99 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -65,9 +65,9 @@ public class TpCommand extends BasicCommand { private static boolean onTp(ProxiedPlayer player, String[] args){ if(args.length == 0){ if(Event.get() == null) - Message.send("TP_SYNTAX", player); + Message.send("TP_USAGE", player); else - Message.send("TP_SYNTAX_EVENT", player); + Message.send("TP_USAGE_EVENT", player); return true; }else if(CheckCommand.isChecking(player)){ Message.send("CHECK_CHECKING", player); diff --git a/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java b/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java index 1ebf71ef..d7350ff2 100644 --- a/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnIgnoreCommand.java @@ -34,7 +34,7 @@ public class UnIgnoreCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1) { - Message.send("UNIGNORE_SYNTAX", sender); + Message.send("UNIGNORE_USAGE", sender); return; } diff --git a/src/de/steamwar/bungeecore/commands/UnbanCommand.java b/src/de/steamwar/bungeecore/commands/UnbanCommand.java index eff7bb4e..464ac05d 100644 --- a/src/de/steamwar/bungeecore/commands/UnbanCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnbanCommand.java @@ -35,7 +35,7 @@ public class UnbanCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1){ - Message.send("UNBAN_SYNTAX", sender); + Message.send("UNBAN_USAGE", sender); return; } diff --git a/src/de/steamwar/bungeecore/commands/WebregisterCommand.java b/src/de/steamwar/bungeecore/commands/WebregisterCommand.java index 4ca733ac..b26883c3 100644 --- a/src/de/steamwar/bungeecore/commands/WebregisterCommand.java +++ b/src/de/steamwar/bungeecore/commands/WebregisterCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SWException; import net.md_5.bungee.api.CommandSender; @@ -42,7 +41,7 @@ public class WebregisterCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if(args.length != 1){ - Message.send("WEB_SYNTAX", player); + Message.send("WEB_USAGE", player); return; } diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index 3470ea62..27bb54a2 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -190,7 +190,7 @@ public class ChatListener extends BasicListener { ProxiedPlayer sender = (ProxiedPlayer) e.getSender(); BungeeCore.log(sender, e.getMessage()); if(command.length == 1){ - Message.send("CHAT_BC_SYNTAX", sender, command[0].substring(1)); + Message.send("CHAT_BC_USAGE", sender, command[0].substring(1)); e.setCancelled(true); return; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index c06e4993..3fc5d068 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -119,14 +119,14 @@ POLLRESULT_HEADER=§eEs haben {0} abgestimmt auf die Frage: §7{1} POLLRESULT_LIST=§e{0}§8: §7{1} #BauCommand -BAU_ADDMEMBER_SYNTAX=/bau addmember +BAU_ADDMEMBER_USAGE=/bau addmember BAU_ADDMEMBER_SELFADD=§cDu brauchst dich nicht selbst hinzufügen! BAU_ADDMEMBER_ISADDED=§cDieser Spieler ist bereits Mitglied auf deiner Welt BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §6{0} §ahinzugefügt -BAU_TP_SYNTAX=/bau tp +BAU_TP_USAGE=/bau tp BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren -BAU_DELMEMBER_SYNTAX=/bau delmember +BAU_DELMEMBER_USAGE=/bau delmember BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! BAU_DELMEMBER_DELETED=§cDer Spieler wurde entfernt. BAU_DELMEMBER_DELETED_TARGET=§cDu wurdest von der Welt von §6{0} §centfernt. @@ -136,14 +136,14 @@ BAU_DELETE_GUI_CANCEL=§cAbbrechen BAU_DELETE_GUI_DELETE=§aLöschen BAU_START_ALREADY=§cDer Server startet bereits. BAU_MEMBER_NOMEMBER=§cDer Spieler ist kein Mitglied deiner Welt! -BAU_MEMBER_TOGGLE_SYNTAX=/bau {0} +BAU_MEMBER_TOGGLE_USAGE=/bau {0} BAU_MEMBER_TOGGLE_TARGET=§aDu kannst nun auf der Welt von §e{0}§a {1} BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0} BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1} BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0} #ChallengeCommand -CHALLENGE_SYNTAX=§8/§echallenge §8[§7Spieler§8] +CHALLENGE_USAGE=§8/§echallenge §8[§7Spieler§8] CHALLENGE_OFFLINE=§cDer Herausgeforderte ist nicht online. CHALLENGE_SELF=§cSchizophren? CHALLENGE_IGNORED=§cDer Herausgeforderte hat dich geblockt. @@ -159,7 +159,7 @@ CHALLENGE_ACCEPT_HOVER=§aHerausforderung annehmen #EventCommand EVENT_TIME_FORMAT=HH:mm EVENT_DATE_FORMAT=dd.MM. -EVENT_SYNTAX=§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren +EVENT_USAGE=§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren EVENT_NO_TEAM=§cDieses Team gibt es nicht EVENT_NO_FIGHT_TEAM=§cDas Team kämpft derzeit nicht EVENT_NO_CURRENT=§cDerzeit findet kein Event statt @@ -173,7 +173,7 @@ EVENT_CURRENT_FIGHT_WIN=§8: §7Sieg §{0}{1} EVENT_CURRENT_FIGHT_DRAW=§8: §7Unentschieden #EventRescheduleCommand -EVENTRESCHEDULE_SYNTAX=§c/eventreschedule [Team1 (Blue)] [Team2 (Red)] +EVENTRESCHEDULE_USAGE=§c/eventreschedule [Team1 (Blue)] [Team2 (Red)] EVENTRESCHEDULE_UNKNOWN_TEAM=§cEin Team ist unbekannt / Derzeit kein Event EVENTRESCHEDULE_NO_FIGHT="§cKein Kampf zwischen den Teams gefunden" EVENTRESCHEDULE_STARTING=§aKampf startet in 30s @@ -218,20 +218,20 @@ HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! HISTORIC_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen #JoinmeCommand -JOINME_SYNTAX=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7. +JOINME_USAGE=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7. JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! JOINME_BROADCAST_HOVER=§aSpieler folgen JOINME_PLAYER_OFFLINE=§cDieser Spieler ist offline. JOINME_PLAYER_SELF=§cSei eins mit dir selbst! #KickCommand -KICK_SYNTAX=/kick [Spieler] [Nachricht] +KICK_USAGE=/kick [Spieler] [Nachricht] KICK_OFFLINE=§cDieser Spieler ist derzeit nicht online! KICK_CONFIRM=Der Spieler {0} wurde gekickt. KICK_NORMAL=§cDu wurdest gekickt. #MsgCommand -MSG_SYNTAX=/msg [Benutzer] [Nachricht] +MSG_USAGE=/msg [Benutzer] [Nachricht] MSG_OFFLINE=§cDieser Spieler ist derzeit nicht online! MSG_IGNORED=§cDieser Spieler hat dich geblockt! MSG_NOMESSAGE=§cDieser Spieler empfängt derzeit keine Chatnachrichten! @@ -262,7 +262,7 @@ RANKED_BROADCAST=§7{0}§8-§7Ranglistenspiel§8: §e{1} vs {2} RANKED_BROADCAST_HOVER=§aZuschauen #RCommand -R_SYNTAX=/r [Antwort] +R_USAGE=/r [Antwort] R_NOTHING=§cDu hast bisher mit niemandem geschrieben! R_OFFLINE=§cDieser Spieler ist derzeit nicht online! R_BLOCKED=§cDieser Spieler hat dich geblockt! @@ -284,11 +284,11 @@ REGELN_WS_HOVER=§7https://steamwar.de/spielmodi/warship-regelwerk/ REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ #ServerTeamchatCommand -STC_SYNTAX=/stc [Nachricht an das Team] +STC_USAGE=/stc [Nachricht an das Team] STC_FORMAT=§8STC §e{0}» §r{1} #TeamchatCommand -TC_SYNTAX=/teamchat [Nachricht an das Team] +TC_USAGE=/teamchat [Nachricht an das Team] TC_NO_TEAM=§cDu bist in keinem Team TC_FORMAT=§8TC §e{0}§8» §r{1} @@ -313,12 +313,12 @@ TEAM_HELP_COLOR=§8/§eteam changecolor §8- §7Ändere deine Teamfarbe TEAM_HELP_LEADER=§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader #Team Create -TEAM_CREATE_SYNTAX=§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8] +TEAM_CREATE_USAGE=§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8] TEAM_CREATE_CREATED=§7Du hast das Team §e{0} §7gegründet! #Team Join TEAM_JOIN_NO_INVITE=§7Du hast keine Einladungen erhalten. -TEAM_JOIN_SYNTAX=§8/§eteam join §8[§eTeam§8] +TEAM_JOIN_USAGE=§8/§eteam join §8[§eTeam§8] TEAM_JOIN_INVITED=§7Du wurdest von diesen Teams eingeladen§8: §e{0} TEAM_JOIN_NOT_BY_TEAM=§cVon diesem Team wurdest du nicht eingeladen TEAM_JOIN_JOINED=§7Du bist dem Team §e{0} §7beigetreten! @@ -328,7 +328,7 @@ TEAM_LEAVE_OTHER_LEADER=§cBitte ernenne zunächst ein anderes Teammitglied zum TEAM_LEAVE_LEFT=§7Du hast dein Team verlassen! #Team Invite -TEAM_INVITE_SYNTAX=§8/§eteam invite §8[§eSpieler§8] +TEAM_INVITE_USAGE=§8/§eteam invite §8[§eSpieler§8] TEAM_INVITE_NO_PLAYER=§cDiesen Spieler gibt es nicht TEAM_INVITE_IN_TEAM=§cDieser Spieler ist bereits in einem Team TEAM_INVITE_ALREADY_INVITED=§cDu hast diesen Spieler bereits eingeladen @@ -336,7 +336,7 @@ TEAM_INVITE_INVITED=§7Du hast §e{0} §7in das Team eingeladen! TEAM_INVITE_INVITED_TARGET=§7Du wurdest in das Team §{0}{1} §7eingeladen! #Team Remove -TEAM_REMOVE_SYNTAX=§8/§eteam remove §8[§eSpieler§8] +TEAM_REMOVE_USAGE=§8/§eteam remove §8[§eSpieler§8] TEAM_REMOVE_NOT_PLAYER=§cDiesen Spieler gibt es nicht TEAM_REMOVE_NOT_LEADER=§cLeader entfernen sich nicht selbst TEAM_REMOVE_INVITE=§7Die Einladung wurde zurückgezogen @@ -346,25 +346,25 @@ TEAM_REMOVE_REMOVED=§7Der Spieler wurde aus dem Team entfernt TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt #Team Kuerzel -TEAM_KUERZEL_SYNTAX=§8/§eteam changekuerzel §8[§eTeamkürzel§8] +TEAM_KUERZEL_USAGE=§8/§eteam changekuerzel §8[§eTeamkürzel§8] TEAM_KUERZEL_CHANGED=§7Du hast das Kürzel des Teams geändert! TEAM_KUERZEL_LENGHT=§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen TEAM_KUERZEL_TAKEN=§cEs gibt bereits ein Team mit diesem Namen #Team Name -TEAM_NAME_SYNTAX=§8/§eteam changename §8[§eTeamname§8] +TEAM_NAME_USAGE=§8/§eteam changename §8[§eTeamname§8] TEAM_NAME_CHANGED=§7Du hast das Team umbenannt! TEAM_NAME_LENGHT=§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen TEAM_NAME_TAKEN=§cEs gibt bereits ein Team mit diesem Namen #Team Leader -TEAM_LEADER_SYNTAX=§cBitte gib ein Teammitglied an +TEAM_LEADER_USAGE=§cBitte gib ein Teammitglied an TEAM_LEADER_NOT_USER=§cDen Spieler {0} gibt es nicht TEAM_LEADER_NOT_MEMBER=§cDer Spieler ist nicht in deinem Team TEAM_LEADER_CHANGED=§7Du hast den Spieler §e{0} §7zum Leader gemacht! #Team Info -TEAM_INFO_SYNTAX=§8/§eteam info §8[§eTeamname§8] +TEAM_INFO_USAGE=§8/§eteam info §8[§eTeamname§8] TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8] TEAM_INFO_LEADER=§7Leader§8: {0} TEAM_INFO_MEMBER=§7Member§8: {0} @@ -381,7 +381,7 @@ TEAM_LIST_NEXT=§eNächste Seite TEAM_LIST_PREV=§eVorherige Seite #Team Event -TEAM_EVENT_SYNTAX=§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen +TEAM_EVENT_USAGE=§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen TEAM_EVENT_HEADER=§7Dein Team nimmt an folgenden Events teil§8: TEAM_EVENT_EVENT=§7{0}§8: §e{1} TEAM_EVENT_NO_EVENT=§cDieses Event gibt es nicht @@ -394,22 +394,22 @@ TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl TEAM_COLOR_TITLE=§6Farbe wählen #TpCommand -TP_SYNTAX=§8/§etp §8[§7Spieler§8] -TP_SYNTAX_EVENT=§8/§etp §8[§7Spieler §8oder §7Team§8] +TP_USAGE=§8/§etp §8[§7Spieler§8] +TP_USAGE_EVENT=§8/§etp §8[§7Spieler §8oder §7Team§8] TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. #UnbanCommand -UNBAN_SYNTAX=/unban [Spieler] +UNBAN_USAGE=/unban [Spieler] UNBAN_UNBANNED=Du hast {0} entbannt. #UnignoreCommand -UNIGNORE_SYNTAX=§8/§eunignore §8[§7Spieler§8] +UNIGNORE_USAGE=§8/§eunignore §8[§7Spieler§8] UNIGNORE_NOT_PLAYER=§cDiesen Spieler gibt es nicht! UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht. UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. #WebregisterCommand -WEB_SYNTAX=/webregister [E-Mail] +WEB_USAGE=/webregister [E-Mail] WEB_ALREADY=§cDu hast bereits einen Webaccount. WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwendet... WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]! @@ -430,7 +430,7 @@ CHAT_YOYONOW_3=Vielen Dank. CHAT_YOYONOW_4=Ich wünsche dir noch weiterhin ein reibungsloses Spielerlebnis. CHAT_RECEIVE=§cUm Chatnachrichten versenden zu können, musst du auch welche empfangen! CHAT_NO_LINKS=§cDu darfst keine Links versenden. -CHAT_BC_SYNTAX=§8/§e{0} §8[§7Nachricht§8] +CHAT_BC_USAGE=§8/§e{0} §8[§7Nachricht§8] CHAT_BC_NO_COMMANDS=§cKeine Befehle mit /local möglich. #CheckListner From d2db4af4ebcf7823f3c01c76a63cf564abb47bc4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 22 Jan 2021 16:31:21 +0100 Subject: [PATCH 063/108] Remove Empty Line --- src/de/steamwar/bungeecore/Message.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 88f2b7f3..94392075 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -42,7 +42,6 @@ public class Message { return parse(message, true, sender, params); } - public static String parse(String message, CommandSender sender, Object... params){ return parse(message, false, sender, params); } From df5b40020a1d635a252652645951e7330f744d8d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 22 Jan 2021 16:42:15 +0100 Subject: [PATCH 064/108] Fixing Typo --- src/de/steamwar/bungeecore/sql/Punishment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 09a5fd12..40a2f4e7 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -139,7 +139,7 @@ public class Punishment { public String getBantime(Timestamp endTime, boolean perma) { if(perma) - return "Permanent"; + return "permanent"; else return endTime.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm")); } From 812b0a73b7134d5653bf30e9f2c055a3ad28ba04 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 27 Jan 2021 10:31:14 +0100 Subject: [PATCH 065/108] May the spam begin Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ErrorLogger.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index 60df5ce2..09100952 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -71,7 +71,7 @@ public class ErrorLogger extends Handler implements Filter { @Override public void publish(LogRecord record) { - if(record.getLevel() != Level.SEVERE) + if(record.getLevel() != Level.SEVERE && record.getLevel() != Level.WARNING) return; StringBuilder stacktrace = new StringBuilder(record.getSourceClassName() + "\n" + record.getSourceMethodName()); From 99aab1bd17b8de1a26205b243c58ef1a60d3f43d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 27 Jan 2021 12:03:52 +0100 Subject: [PATCH 066/108] Fixing Typos and Messages --- src/de/steamwar/bungeecore/EventStarter.java | 2 +- src/de/steamwar/bungeecore/Message.java | 2 +- .../bungeecore/commands/FightCommand.java | 2 +- .../bungeecore/commands/HistoricCommand.java | 2 +- .../bungeecore/commands/JoinmeCommand.java | 2 +- .../bungeecore/commands/RankedCommand.java | 2 +- .../bungeecore/listeners/TablistManager.java | 14 +- .../steamwar/messages/BungeeCore.properties | 212 +++++++++--------- 8 files changed, 116 insertions(+), 122 deletions(-) diff --git a/src/de/steamwar/bungeecore/EventStarter.java b/src/de/steamwar/bungeecore/EventStarter.java index 3d466fdc..b1738285 100644 --- a/src/de/steamwar/bungeecore/EventStarter.java +++ b/src/de/steamwar/bungeecore/EventStarter.java @@ -73,7 +73,7 @@ public class EventStarter implements Runnable { eventServer.put(blue.getTeamId(), subserver); eventServer.put(red.getTeamId(), subserver); - Message.broadcast("EVENT_FIGHT_BROADCAST", true, "EVENT_FIGHT_BROADCAST_HOVER", + Message.broadcast("EVENT_FIGHT_BROADCAST", "EVENT_FIGHT_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/event " + blue.getTeamKuerzel()), blue.getTeamColor(), blue.getTeamName(), red.getTeamColor(), red.getTeamName()); } } diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 6fd03783..cc1f9db5 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -108,7 +108,7 @@ public class Message { public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) - send(message, player, parse(onHover, false, player), onClick, params); + send(message, player, parse(onHover, true, player), onClick, params); } public static void broadcast(String message, Object... params){ diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 793ee843..44e9cf10 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -166,7 +166,7 @@ public class FightCommand extends BasicCommand { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - Message.broadcast("FIGHT_BROADCAST", true, "FIGHT_BROADCAST_HOVER" + Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index d98a1351..c7d64deb 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -35,7 +35,7 @@ public class HistoricCommand extends BasicCommand { FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); arena.sendPlayer(player); - Message.broadcast("HISTORIC_BROADCAST", true, "HISTORIC_BROADCAST_HOVER" + Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); }); } diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index ef9f4254..10f435ed 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -41,7 +41,7 @@ public class JoinmeCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { - Message.broadcast("JOINME_BROADCAST", true, "JOINME_BROADCAST_HOVER" + Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); } else if (args.length == 1) { ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); diff --git a/src/de/steamwar/bungeecore/commands/RankedCommand.java b/src/de/steamwar/bungeecore/commands/RankedCommand.java index 3e70966c..c70fff93 100644 --- a/src/de/steamwar/bungeecore/commands/RankedCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankedCommand.java @@ -169,7 +169,7 @@ public class RankedCommand extends BasicCommand { arena.sendPlayer(wp1.player); arena.sendPlayer(wp2.player); - Message.broadcast("RANKED_BROADCAST", true, "RANKED_BROADCAST_HOVER", + Message.broadcast("RANKED_BROADCAST", "RANKED_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + wp1.player.getName()), mode.getDisplayName(), wp1.player.getName(), wp2.player.getName()); } } diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index a7dbc03e..eb491b3e 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -68,24 +68,18 @@ public class TablistManager extends BasicListener { } private String calcHeader(ProxiedPlayer player){ - String header; int phase = (seconds % 16) / 4; switch(phase){ case 0: - header = Message.parse("TABLIST_PHASE_0", player, ProxyServer.getInstance().getPlayers().size()); - break; + return Message.parse("TABLIST_PHASE_0", player, ProxyServer.getInstance().getPlayers().size()); case 1: - header = Message.parse("TABLIST_PHASE_1", player); - break; + return Message.parse("TABLIST_PHASE_1", player); case 2: - header = Message.parse("TABLIST_PHASE_2", player); - break; + return Message.parse("TABLIST_PHASE_2", player); case 3: default: - header = Message.parse("TABLIST_PHASE_DEFAULT", player); - break; + return Message.parse("TABLIST_PHASE_DEFAULT", player); } - return header; } private void calculateSize(){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 3fc5d068..05a13fce 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -3,7 +3,7 @@ SPACER= UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. -UNKNOWN_TEAM=§cDieses Team gibt es nicht +UNKNOWN_TEAM=§cDieses Team gibt es nicht. INVALID_TIME=§cUngültige Zeitangabe. JOIN_PLAYER_BLOCK=§cDu kannst diesem Spieler derzeit nicht folgen. CHECK_CHECKING=§cDu prüfst gerade eine Schematic! @@ -32,31 +32,31 @@ HELP_JOIN_HOVER=§eSpieler beitreten HELP_LOCAL=§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server! HELP_LOCAL_HOVER=§eLokaler Chat -HELP_TNT=§8/§etnt §8- §7(de)aktiviert Explosionsschaden -HELP_FIRE=§8/§efire §8- §7(de)aktiviert Feuerschaden -HELP_TESTBLOCK=§8/§etestblock §8- §7Erneuert den nächsten Testblock -HELP_RESET=§8/§ereset §8- §7Setzt die derzeitige Region zurück -HELP_SPEED=§8/§espeed §8- §7Ändert deine Fluggeschwindigkeit -HELP_NV=§8/§env §8- §7(de)aktiviert Nachtsicht -HELP_WV=§8/§ewv §8- §7(de)aktiviert Unterwassersicht -HELP_TRACE=§8/§etrace §8- §7Gibt einen Überblick über den TNT-Tracer -HELP_TPSLIMIT=§8/§etpslimit §8- §7Gibt einen Überblick über den TPS-Limiter -HELP_LOADER=§8/§eloader §8- §7Nutze den automatischen Kanonenlader -HELP_PROTECT=§8/§eprotect §8- §7Schützt den Boden der (M)WG-Region -HELP_FREEZE=§8/§efreeze §8- §7Unterbindet Blockupdates -HELP_SKULL=§8/§eskull §8- §7Gibt dir den Kopf eines Spielers -HELP_DEBUGSTICK=§8/§edebugstick §8- §7Gibt dir einen Debugstick (nur 1.15) -HELP_BAUINFO=§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver +HELP_TNT=§8/§7tnt §8- §7(de)aktiviert Explosionsschaden +HELP_FIRE=§8/§7fire §8- §7(de)aktiviert Feuerschaden +HELP_TESTBLOCK=§8/§7testblock §8- §7Erneuert den nächsten Testblock +HELP_RESET=§8/§7reset §8- §7Setzt die derzeitige Region zurück +HELP_SPEED=§8/§7speed §8- §7Ändert deine Fluggeschwindigkeit +HELP_NV=§8/§7nv §8- §7(de)aktiviert Nachtsicht +HELP_WV=§8/§7wv §8- §7(de)aktiviert Unterwassersicht +HELP_TRACE=§8/§7trace §8- §7Gibt einen Überblick über den TNT-Tracer +HELP_TPSLIMIT=§8/§7tpslimit §8- §7Gibt einen Überblick über den TPS-Limiter +HELP_LOADER=§8/§7loader §8- §7Nutze den automatischen Kanonenlader +HELP_PROTECT=§8/§7protect §8- §7Schützt den Boden der (M)WG-Region +HELP_FREEZE=§8/§7freeze §8- §7Unterbindet Blockupdates +HELP_SKULL=§8/§7skull §8- §7Gibt dir den Kopf eines Spielers +HELP_DEBUGSTICK=§8/§7debugstick §8- §7Gibt dir einen Debugstick (nur 1.15) +HELP_BAUINFO=§8/§7bauinfo §8- §7Gibt dir Informationen über den Bauserver -HELP_WE_POS1=§8//§e1 §7» §8//§epos1 -HELP_WE_POS2=§8//§e2 §7» §8//§epos2 -HELP_WE_COPY=§8//§ec §7» §8//§ecopy -HELP_WE_PASTE=§8//§ep §7» §8//§epaste -HELP_WE_FLOPY=§8//§eflopy §7» §8//§ecopy §7& §8//§eflip -HELP_WE_FLOPYP=§8//§eflopyp §7» §8//§ecopy §7& §8//§eflip §7& §8//§epaste -HELP_WE_ROTATE_90=§8//§e90 §7» §8//§erotate 90 -HELP_WE_ROTATE_180=§8//§e180 §7» §8//§erotate 180 -HELP_WE_ROTATE_N90=§8//§e-90 §7» §8//§erotate -90 +HELP_WE_POS1=§8//§71 §7» §8//§7pos1 +HELP_WE_POS2=§8//§72 §7» §8//§7pos2 +HELP_WE_COPY=§8//§7c §7» §8//§7copy +HELP_WE_PASTE=§8//§7p §7» §8//§7paste +HELP_WE_FLOPY=§8//§7flopy §7» §8//§7copy §7& §8//§7flip +HELP_WE_FLOPYP=§8//§7flopyp §7» §8//§7copy §7& §8//§7flip §7& §8//§7paste +HELP_WE_ROTATE_90=§8//§790 §7» §8//§7rotate §e90 +HELP_WE_ROTATE_180=§8//§7180 §7» §8//§7rotate §e180 +HELP_WE_ROTATE_N90=§8//§7-90 §7» §8//§7rotate §e-90 HELP_BAU_GROUP_ADMIN=§7Bauserver-Verwaltungsbefehle HELP_BAU_GROUP_ADMIN_HOVER=§eAlle Verwaltungsbefehle @@ -119,14 +119,14 @@ POLLRESULT_HEADER=§eEs haben {0} abgestimmt auf die Frage: §7{1} POLLRESULT_LIST=§e{0}§8: §7{1} #BauCommand -BAU_ADDMEMBER_USAGE=/bau addmember +BAU_ADDMEMBER_USAGE=§8/§7bau addmember §8[§eSpieler§8] BAU_ADDMEMBER_SELFADD=§cDu brauchst dich nicht selbst hinzufügen! BAU_ADDMEMBER_ISADDED=§cDieser Spieler ist bereits Mitglied auf deiner Welt BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §6{0} §ahinzugefügt -BAU_TP_USAGE=/bau tp +BAU_TP_USAGE=§8/§7bau tp §8[§eSpieler§8] BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren -BAU_DELMEMBER_USAGE=/bau delmember +BAU_DELMEMBER_USAGE=§8/§7bau delmember §8[§eSpieler] BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! BAU_DELMEMBER_DELETED=§cDer Spieler wurde entfernt. BAU_DELMEMBER_DELETED_TARGET=§cDu wurdest von der Welt von §6{0} §centfernt. @@ -136,19 +136,19 @@ BAU_DELETE_GUI_CANCEL=§cAbbrechen BAU_DELETE_GUI_DELETE=§aLöschen BAU_START_ALREADY=§cDer Server startet bereits. BAU_MEMBER_NOMEMBER=§cDer Spieler ist kein Mitglied deiner Welt! -BAU_MEMBER_TOGGLE_USAGE=/bau {0} -BAU_MEMBER_TOGGLE_TARGET=§aDu kannst nun auf der Welt von §e{0}§a {1} -BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0} -BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1} -BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0} +BAU_MEMBER_TOGGLE_USAGE=§8/§7bau {0} §8[§eSpieler] +BAU_MEMBER_TOGGLE_TARGET=§aDu kannst nun auf der Welt von §e{0}§a {1}. +BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0}. +BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1}. +BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0}. #ChallengeCommand -CHALLENGE_USAGE=§8/§echallenge §8[§7Spieler§8] +CHALLENGE_USAGE=§8/§7challenge §8[§eSpieler§8] CHALLENGE_OFFLINE=§cDer Herausgeforderte ist nicht online. CHALLENGE_SELF=§cSchizophren? CHALLENGE_IGNORED=§cDer Herausgeforderte hat dich geblockt. CHALLENGE_INARENA=§cDer Herausgeforderte ist bereits in einer Arena. -CHALLENGE_BROADCAST=§e{0}§7-§eDuell§7: {1} vs {2} +CHALLENGE_BROADCAST=§e{0}§7-§eDuell§7: §e{1} §7vs §e{2} CHALLENGE_BROADCAST_HOVER=§aZuschauen CHALLENGE_CHALLENGED=§7Du hast §e{0} §7zu einem §e{1}-Kampf §7herausgefordert! CHALLENGE_CHALLENGED_TARGET=§e{0} §7 hat dich zu einem §e{1}-Kampf §7{2}herausgefordert! @@ -159,7 +159,7 @@ CHALLENGE_ACCEPT_HOVER=§aHerausforderung annehmen #EventCommand EVENT_TIME_FORMAT=HH:mm EVENT_DATE_FORMAT=dd.MM. -EVENT_USAGE=§8/§eevent §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren +EVENT_USAGE=§8/§7event §8[§eTeam§8] - §7Um dich zum Kampf zu teleportieren EVENT_NO_TEAM=§cDieses Team gibt es nicht EVENT_NO_FIGHT_TEAM=§cDas Team kämpft derzeit nicht EVENT_NO_CURRENT=§cDerzeit findet kein Event statt @@ -173,7 +173,7 @@ EVENT_CURRENT_FIGHT_WIN=§8: §7Sieg §{0}{1} EVENT_CURRENT_FIGHT_DRAW=§8: §7Unentschieden #EventRescheduleCommand -EVENTRESCHEDULE_USAGE=§c/eventreschedule [Team1 (Blue)] [Team2 (Red)] +EVENTRESCHEDULE_USAGE=§8/§7eventreschedule §8[§eTeam1 (Blue)§8] [§eTeam2 (Red)§8] EVENTRESCHEDULE_UNKNOWN_TEAM=§cEin Team ist unbekannt / Derzeit kein Event EVENTRESCHEDULE_NO_FIGHT="§cKein Kampf zwischen den Teams gefunden" EVENTRESCHEDULE_STARTING=§aKampf startet in 30s @@ -189,10 +189,10 @@ FIGHT_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. -CHECK_HELP_LIST=§8/§echeck list §8- §7Zeigt die Liste der ungeprüften Schematics -CHECK_HELP_NEXT=§8/§echeck next §8- §7Nächste Prüffrage§8/§7freigeben -CHECK_HELP_DECLINE=§8/§echeck decline §8[§eGrund§8] - §7Schematic ablehnen -CHECK_HELP_CANCEL=§8/§echeck cancel §8- §7Bricht den Prüfvorgang ab +CHECK_HELP_LIST=§8/§7check list §8- §7Zeigt die Liste der ungeprüften Schematics +CHECK_HELP_NEXT=§8/§7check next §8- §7Nächste Prüffrage§8/§7freigeben +CHECK_HELP_DECLINE=§8/§7check decline §8[§eGrund§8] - §7Schematic ablehnen +CHECK_HELP_CANCEL=§8/§7check cancel §8- §7Bricht den Prüfvorgang ab CHECK_LIST_HEADER=§e§lZu prüfen sind {0} Schematics CHECK_LIST_TO_CHECK=§8{0} §7{1} §e{2} CHECK_LIST_TO_CHECK_HOVER=§eSchematic prüfen @@ -218,20 +218,20 @@ HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! HISTORIC_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen #JoinmeCommand -JOINME_USAGE=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7. +JOINME_USAGE=§8/§7join §8[§eSpieler§8]. JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! JOINME_BROADCAST_HOVER=§aSpieler folgen JOINME_PLAYER_OFFLINE=§cDieser Spieler ist offline. JOINME_PLAYER_SELF=§cSei eins mit dir selbst! #KickCommand -KICK_USAGE=/kick [Spieler] [Nachricht] +KICK_USAGE=§8/§7kick §8[§eSpieler§8] [§eNachricht§8] KICK_OFFLINE=§cDieser Spieler ist derzeit nicht online! KICK_CONFIRM=Der Spieler {0} wurde gekickt. KICK_NORMAL=§cDu wurdest gekickt. #MsgCommand -MSG_USAGE=/msg [Benutzer] [Nachricht] +MSG_USAGE=§8/§7msg §8[§eBenutzer§8] [§eNachricht§8] MSG_OFFLINE=§cDieser Spieler ist derzeit nicht online! MSG_IGNORED=§cDieser Spieler hat dich geblockt! MSG_NOMESSAGE=§cDieser Spieler empfängt derzeit keine Chatnachrichten! @@ -239,13 +239,13 @@ MSG_SELF=§cNachrichten an dich selbst hast du wirklich nicht nötig! MSG_FORMAT=§e{0}§8»§e{1} §r§7{2} #PingCommand -PING_RESPONSE=§7Dein Ping beträgt §c{0}§r§7 ms! +PING_RESPONSE=§7Dein Ping beträgt §c{0}§7 ms! #PollCommand POLL_NO_POLL=§cDerzeit läuft keine Umfrage. POLL_NO_ANSWER=§cDas ist keine Antwortmöglichkeit! -POLL_ANSWER_REFRESH=§aDeine Antwort wurde aktualisiert -POLL_ANSWER_NEW=§aDeine Antwort wurde registriert +POLL_ANSWER_REFRESH=§aDeine Antwort wurde aktualisiert. +POLL_ANSWER_NEW=§aDeine Antwort wurde registriert. #RankCommand RANK_HEADER=§7§lPlatzierungen @@ -253,16 +253,16 @@ RANK_UNPLACED=§7{0}§8: §eunplatziert RANK_PLACED=§7{0}§8: §e{1}§8. §7mit §e{2} §7Elo§8. #RankedCommand -RANKED_NO_RANKED_MODE=§cDieser Spielmodus ist nicht für Ranglistenspiele freigeschalten -RANKED_QUEUE_JOINED=§aRanglistenspiel-Warteschlange betreten -RANKED_QUEUE_HOW_TO_LEAVE=§7Wiederhole den Befehl zum Verlassen der Warteschlange -RANKED_QUEUE_LEFT=§cRanglistenspiel-Warteschlange verlassen +RANKED_NO_RANKED_MODE=§cDieser Spielmodus ist nicht für Ranglistenspiele freigeschalten. +RANKED_QUEUE_JOINED=§aRanglistenspiel-Warteschlange betreten. +RANKED_QUEUE_HOW_TO_LEAVE=§7Wiederhole den Befehl zum Verlassen der Warteschlange. +RANKED_QUEUE_LEFT=§cRanglistenspiel-Warteschlange verlassen. RANKED_ENEMY_SPOTTED=§eGegner gefunden! Ranglistenspiel startet. RANKED_BROADCAST=§7{0}§8-§7Ranglistenspiel§8: §e{1} vs {2} RANKED_BROADCAST_HOVER=§aZuschauen #RCommand -R_USAGE=/r [Antwort] +R_USAGE=§8/§7r §8[§eAntwort§8] R_NOTHING=§cDu hast bisher mit niemandem geschrieben! R_OFFLINE=§cDieser Spieler ist derzeit nicht online! R_BLOCKED=§cDieser Spieler hat dich geblockt! @@ -284,87 +284,87 @@ REGELN_WS_HOVER=§7https://steamwar.de/spielmodi/warship-regelwerk/ REGELN_WS_URL=https://steamwar.de/spielmodi/warship-regelwerk/ #ServerTeamchatCommand -STC_USAGE=/stc [Nachricht an das Team] +STC_USAGE=§8/§7stc §8[§eNachricht an das Team§8] STC_FORMAT=§8STC §e{0}» §r{1} #TeamchatCommand -TC_USAGE=/teamchat [Nachricht an das Team] -TC_NO_TEAM=§cDu bist in keinem Team +TC_USAGE=§8/§7tc §8[§eNachricht an das Team§8] +TC_NO_TEAM=§cDu bist in keinem Team. TC_FORMAT=§8TC §e{0}§8» §r{1} #TeamCommand -TEAM_IN_TEAM=§cDu bist bereits in einem Team -TEAM_NOT_IN_TEAM=§cDu bist in keinem Team -TEAM_NOT_LEADER=§cDu bist nicht der Teamleader -TEAM_NOT_IN_EVENT=§cDies ist während eines Events nicht möglich -TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team -TEAM_HELP_LIST=§8/§eteam list §8- §7Liste alle Teams auf -TEAM_HELP_INFO=§8/§eteam info §8- §7Informiere dich über ein Team -TEAM_HELP_CREATE=§8/§eteam create §8- §7Erstelle dein eigenes Team -TEAM_HELP_JOIN=§8/§eteam join §8- §7Trete einem Team bei -TEAM_HELP_CHAT=§8/§eteamchat §8- §7Sende Nachrichten an dein Team -TEAM_HELP_EVENT=§8/§eteam event §8- §7Nehme an Events teil -TEAM_HELP_LEAVE=§8/§eteam leave §8- §7Verlasse dein Team -TEAM_HELP_INVITE=§8/§eteam invite §8- §7Lade jemanden in dein Team ein -TEAM_HELP_REMOVE=§8/§eteam remove §8- §7Entferne jemanden aus deinem Team -TEAM_HELP_KUERZEL=§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel -TEAM_HELP_NAME=§8/§eteam changename §8- §7Ändere deinen Teamnamen -TEAM_HELP_COLOR=§8/§eteam changecolor §8- §7Ändere deine Teamfarbe -TEAM_HELP_LEADER=§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader +TEAM_IN_TEAM=§cDu bist bereits in einem Team. +TEAM_NOT_IN_TEAM=§cDu bist in keinem Team. +TEAM_NOT_LEADER=§cDu bist nicht der Teamleader. +TEAM_NOT_IN_EVENT=§cDies ist während eines Events nicht möglich. +TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team. +TEAM_HELP_LIST=§8/§7team list §8- §7Liste alle Teams auf. +TEAM_HELP_INFO=§8/§7team info §8- §7Informiere dich über ein Team. +TEAM_HELP_CREATE=§8/§7team create §8- §7Erstelle dein eigenes Team. +TEAM_HELP_JOIN=§8/§7team join §8- §7Trete einem Team bei. +TEAM_HELP_CHAT=§8/§7teamchat §8- §7Sende Nachrichten an dein Team. +TEAM_HELP_EVENT=§8/§7team event §8- §7Nehme an Events teil. +TEAM_HELP_LEAVE=§8/§7team leave §8- §7Verlasse dein Team. +TEAM_HELP_INVITE=§8/§7team invite §8- §7Lade jemanden in dein Team ein. +TEAM_HELP_REMOVE=§8/§7team remove §8- §7Entferne jemanden aus deinem Team. +TEAM_HELP_KUERZEL=§8/§7team changekuerzel §8- §7Ändere dein Teamkürzel. +TEAM_HELP_NAME=§8/§7team changename §8- §7Ändere deinen Teamnamen. +TEAM_HELP_COLOR=§8/§7eteam changecolor §8- §7Ändere deine Teamfarbe. +TEAM_HELP_LEADER=§8/§7eteam changeleader §8- §7Ernenne jemanden zum Teamleader. #Team Create -TEAM_CREATE_USAGE=§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8] +TEAM_CREATE_USAGE=§8/§7team create §8[§eTeamkürzel§8] §8[§eTeamname§8] TEAM_CREATE_CREATED=§7Du hast das Team §e{0} §7gegründet! #Team Join TEAM_JOIN_NO_INVITE=§7Du hast keine Einladungen erhalten. -TEAM_JOIN_USAGE=§8/§eteam join §8[§eTeam§8] +TEAM_JOIN_USAGE=§8/§7team join §8[§eTeam§8] TEAM_JOIN_INVITED=§7Du wurdest von diesen Teams eingeladen§8: §e{0} -TEAM_JOIN_NOT_BY_TEAM=§cVon diesem Team wurdest du nicht eingeladen +TEAM_JOIN_NOT_BY_TEAM=§cVon diesem Team wurdest du nicht eingeladen. TEAM_JOIN_JOINED=§7Du bist dem Team §e{0} §7beigetreten! #Team Leave -TEAM_LEAVE_OTHER_LEADER=§cBitte ernenne zunächst ein anderes Teammitglied zum Leader +TEAM_LEAVE_OTHER_LEADER=§cBitte ernenne zunächst ein anderes Teammitglied zum Leader! TEAM_LEAVE_LEFT=§7Du hast dein Team verlassen! #Team Invite -TEAM_INVITE_USAGE=§8/§eteam invite §8[§eSpieler§8] -TEAM_INVITE_NO_PLAYER=§cDiesen Spieler gibt es nicht -TEAM_INVITE_IN_TEAM=§cDieser Spieler ist bereits in einem Team -TEAM_INVITE_ALREADY_INVITED=§cDu hast diesen Spieler bereits eingeladen +TEAM_INVITE_USAGE=§8/§7team invite §8[§eSpieler§8] +TEAM_INVITE_NO_PLAYER=§cDiesen Spieler gibt es nicht. +TEAM_INVITE_IN_TEAM=§cDieser Spieler ist bereits in einem Team. +TEAM_INVITE_ALREADY_INVITED=§cDu hast diesen Spieler bereits eingeladen. TEAM_INVITE_INVITED=§7Du hast §e{0} §7in das Team eingeladen! TEAM_INVITE_INVITED_TARGET=§7Du wurdest in das Team §{0}{1} §7eingeladen! #Team Remove -TEAM_REMOVE_USAGE=§8/§eteam remove §8[§eSpieler§8] -TEAM_REMOVE_NOT_PLAYER=§cDiesen Spieler gibt es nicht -TEAM_REMOVE_NOT_LEADER=§cLeader entfernen sich nicht selbst -TEAM_REMOVE_INVITE=§7Die Einladung wurde zurückgezogen -TEAM_REMOVE_NO_INVITE=§cDieser Spieler hat keine Einladung erhalten -TEAM_REMOVE_NOT_IN_TEAM=§cDieser Spieler ist nicht in deinem Team -TEAM_REMOVE_REMOVED=§7Der Spieler wurde aus dem Team entfernt -TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt +TEAM_REMOVE_USAGE=§8/§7team remove §8[§eSpieler§8] +TEAM_REMOVE_NOT_PLAYER=§cDiesen Spieler gibt es nicht. +TEAM_REMOVE_NOT_LEADER=§cLeader entfernen sich nicht selbst. +TEAM_REMOVE_INVITE=§7Die Einladung wurde zurückgezogen. +TEAM_REMOVE_NO_INVITE=§cDieser Spieler hat keine Einladung erhalten. +TEAM_REMOVE_NOT_IN_TEAM=§cDieser Spieler ist nicht in deinem Team. +TEAM_REMOVE_REMOVED=§7Der Spieler wurde aus dem Team entfernt. +TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt. #Team Kuerzel -TEAM_KUERZEL_USAGE=§8/§eteam changekuerzel §8[§eTeamkürzel§8] +TEAM_KUERZEL_USAGE=§8/§7team changekuerzel §8[§eTeamkürzel§8] TEAM_KUERZEL_CHANGED=§7Du hast das Kürzel des Teams geändert! -TEAM_KUERZEL_LENGHT=§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen -TEAM_KUERZEL_TAKEN=§cEs gibt bereits ein Team mit diesem Namen +TEAM_KUERZEL_LENGHT=§cEin Teamkürzel muss aus 2 bis 4 Buchstaben bestehen. +TEAM_KUERZEL_TAKEN=§cEs gibt bereits ein Team mit diesem Namen. #Team Name -TEAM_NAME_USAGE=§8/§eteam changename §8[§eTeamname§8] +TEAM_NAME_USAGE=§8/§7team changename §8[§eTeamname§8] TEAM_NAME_CHANGED=§7Du hast das Team umbenannt! -TEAM_NAME_LENGHT=§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen -TEAM_NAME_TAKEN=§cEs gibt bereits ein Team mit diesem Namen +TEAM_NAME_LENGHT=§cEin Teamname muss aus 4 bis 15 Buchstaben bestehen. +TEAM_NAME_TAKEN=§cEs gibt bereits ein Team mit diesem Namen. #Team Leader -TEAM_LEADER_USAGE=§cBitte gib ein Teammitglied an -TEAM_LEADER_NOT_USER=§cDen Spieler {0} gibt es nicht -TEAM_LEADER_NOT_MEMBER=§cDer Spieler ist nicht in deinem Team +TEAM_LEADER_USAGE=§8/§7team changeleader §8[§eMember§8] +TEAM_LEADER_NOT_USER=§cDen Spieler {0} gibt es nicht. +TEAM_LEADER_NOT_MEMBER=§cDer Spieler ist nicht in deinem Team. TEAM_LEADER_CHANGED=§7Du hast den Spieler §e{0} §7zum Leader gemacht! #Team Info -TEAM_INFO_USAGE=§8/§eteam info §8[§eTeamname§8] +TEAM_INFO_USAGE=§8/§7team info §8[§eTeamname§8] TEAM_INFO_TEAM=§7Team §e{0} §8[§{1}{2}§8] TEAM_INFO_LEADER=§7Leader§8: {0} TEAM_INFO_MEMBER=§7Member§8: {0} @@ -381,7 +381,7 @@ TEAM_LIST_NEXT=§eNächste Seite TEAM_LIST_PREV=§eVorherige Seite #Team Event -TEAM_EVENT_USAGE=§8/§eteam event §8[§eEvent§8] - §7um daran teilzunehmen +TEAM_EVENT_USAGE=§8/§7team event §8[§eEvent§8] - §7um daran teilzunehmen TEAM_EVENT_HEADER=§7Dein Team nimmt an folgenden Events teil§8: TEAM_EVENT_EVENT=§7{0}§8: §e{1} TEAM_EVENT_NO_EVENT=§cDieses Event gibt es nicht @@ -394,22 +394,22 @@ TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl TEAM_COLOR_TITLE=§6Farbe wählen #TpCommand -TP_USAGE=§8/§etp §8[§7Spieler§8] -TP_USAGE_EVENT=§8/§etp §8[§7Spieler §8oder §7Team§8] +TP_USAGE=§8/§7tp §8[§eSpieler§8] +TP_USAGE_EVENT=§8/§7tp §8[§eSpieler §7oder §eTeam§8] TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. #UnbanCommand -UNBAN_USAGE=/unban [Spieler] +UNBAN_USAGE=§8/§7unban §8[§eSpieler§8] UNBAN_UNBANNED=Du hast {0} entbannt. #UnignoreCommand -UNIGNORE_USAGE=§8/§eunignore §8[§7Spieler§8] +UNIGNORE_USAGE=§8/§7unignore §8[§eSpieler§8] UNIGNORE_NOT_PLAYER=§cDiesen Spieler gibt es nicht! UNIGNORE_NOT_IGNORED=§cDu ignorierst diesen Spieler nicht. UNIGNORE_UNIGNORED=§7Du empfängst nun wieder Nachrichten von §e{0}§8. #WebregisterCommand -WEB_USAGE=/webregister [E-Mail] +WEB_USAGE=§8/§7webregister §8[§eE-Mail§8] WEB_ALREADY=§cDu hast bereits einen Webaccount. WEB_ALREADY_EMAIL=§cDie E-Mail hast du bereits für einen anderen Account verwendet... WEB_NOT_EMAIL=§c[E-Mail], nicht [Freitext]! @@ -466,5 +466,5 @@ EVENT_FIGHT_BROADCAST_HOVER=§eEvent beitreten SERVER_IGNORED=§cDieser Spieler hat dich geblockt! SERVER_ADD_MEMBER=§e{0} §7möchte auf deine Bauwelt. SERVER_ADD_MESSAGE=§7Klicke §ehier§7, wenn du das erlauben möchtest. -SERVER_ADD_MESSAGE_HOVER=§e/bau addmember {0} +SERVER_ADD_MESSAGE_HOVER=§8/§7bau addmember §e{0} SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen. \ No newline at end of file From b7aa3d3d8b3ef88ae521c83eb819a5984fedcaa9 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 27 Jan 2021 12:07:03 +0100 Subject: [PATCH 067/108] Remove Unused Method --- src/de/steamwar/bungeecore/Message.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index cc1f9db5..b0d1e7a3 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -101,11 +101,6 @@ public class Message { sender.sendMessage(msg); } - public static void broadcast(String message, boolean prefixed, String onHover, ClickEvent onClick, Object... params){ - for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) - send(message, player, parse(onHover, prefixed, player, params), onClick, params); - } - public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) send(message, player, parse(onHover, true, player), onClick, params); From f0eed3e94e14fb48bb9b9d10f58786fa6d30cf68 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Wed, 27 Jan 2021 12:09:47 +0100 Subject: [PATCH 068/108] Fix Typo --- src/de/steamwar/messages/BungeeCore.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 05a13fce..b985e745 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -121,11 +121,11 @@ POLLRESULT_LIST=§e{0}§8: §7{1} #BauCommand BAU_ADDMEMBER_USAGE=§8/§7bau addmember §8[§eSpieler§8] BAU_ADDMEMBER_SELFADD=§cDu brauchst dich nicht selbst hinzufügen! -BAU_ADDMEMBER_ISADDED=§cDieser Spieler ist bereits Mitglied auf deiner Welt -BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt -BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §6{0} §ahinzugefügt +BAU_ADDMEMBER_ISADDED=§cDieser Spieler ist bereits Mitglied auf deiner Welt. +BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt. +BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §6{0} §ahinzugefügt. BAU_TP_USAGE=§8/§7bau tp §8[§eSpieler§8] -BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren +BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren. BAU_DELMEMBER_USAGE=§8/§7bau delmember §8[§eSpieler] BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! BAU_DELMEMBER_DELETED=§cDer Spieler wurde entfernt. From 42adba4adc6bb3a2f140c2defdd6fd67f75e176e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 28 Jan 2021 20:14:05 +0100 Subject: [PATCH 069/108] Add Check if user is Banned in Unban Command --- src/de/steamwar/bungeecore/commands/UnbanCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/UnbanCommand.java b/src/de/steamwar/bungeecore/commands/UnbanCommand.java index c21561a9..8b17a270 100644 --- a/src/de/steamwar/bungeecore/commands/UnbanCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnbanCommand.java @@ -22,7 +22,6 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.connection.ProxiedPlayer; import java.sql.Timestamp; import java.util.Date; @@ -44,6 +43,11 @@ public class UnbanCommand extends BasicCommand { if(target == null) return; + if(!target.isBanned()) { + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Der Spieler ist nicht gebannt."); + return; + } + BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " entbannt."); target.ban(Timestamp.from(new Date().toInstant()), "Unban", SteamwarUser.get(sender.getName()).getId(), false); } From 46efab09c2d0bba8b7493cd58c0d803b943ad36f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 29 Jan 2021 20:51:35 +0100 Subject: [PATCH 070/108] Fix Colorscheme --- src/de/steamwar/messages/BungeeCore.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index b985e745..8e647989 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -123,13 +123,13 @@ BAU_ADDMEMBER_USAGE=§8/§7bau addmember §8[§eSpieler§8] BAU_ADDMEMBER_SELFADD=§cDu brauchst dich nicht selbst hinzufügen! BAU_ADDMEMBER_ISADDED=§cDieser Spieler ist bereits Mitglied auf deiner Welt. BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt. -BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §6{0} §ahinzugefügt. +BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §e{0} §ahinzugefügt. BAU_TP_USAGE=§8/§7bau tp §8[§eSpieler§8] BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren. BAU_DELMEMBER_USAGE=§8/§7bau delmember §8[§eSpieler] BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! BAU_DELMEMBER_DELETED=§cDer Spieler wurde entfernt. -BAU_DELMEMBER_DELETED_TARGET=§cDu wurdest von der Welt von §6{0} §centfernt. +BAU_DELMEMBER_DELETED_TARGET=§cDu wurdest von der Welt von §e{0} §centfernt. BAU_DELETE_DELETED=§aDeine Welt wird zurückgesetzt. BAU_DELETE_GUI_NAME=§eWirklich Welt löschen? BAU_DELETE_GUI_CANCEL=§cAbbrechen @@ -391,7 +391,7 @@ TEAM_EVENT_JOINED=§7Dein Team nimmt nun am Event §e{0} §7 teil! TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl #Team Color -TEAM_COLOR_TITLE=§6Farbe wählen +TEAM_COLOR_TITLE=Farbe wählen #TpCommand TP_USAGE=§8/§7tp §8[§eSpieler§8] From 47aed8ab8120a356b348fa2be67e8573d5f86262 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 29 Jan 2021 20:53:54 +0100 Subject: [PATCH 071/108] Fix Colorscheme --- src/de/steamwar/messages/BungeeCore.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8e647989..36e622af 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -126,7 +126,7 @@ BAU_ADDMEMBER_ADDED=§aDer Spieler wurde zu deiner Welt hinzugefügt. BAU_ADDMEMBER_ADDED_TARGET=§aDu wurdest zu der Welt von §e{0} §ahinzugefügt. BAU_TP_USAGE=§8/§7bau tp §8[§eSpieler§8] BAU_TP_NOALLOWED=§cDu darfst dich nicht auf diese Welt teleportieren. -BAU_DELMEMBER_USAGE=§8/§7bau delmember §8[§eSpieler] +BAU_DELMEMBER_USAGE=§8/§7bau delmember §8[§eSpieler§8] BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! BAU_DELMEMBER_DELETED=§cDer Spieler wurde entfernt. BAU_DELMEMBER_DELETED_TARGET=§cDu wurdest von der Welt von §e{0} §centfernt. @@ -136,7 +136,7 @@ BAU_DELETE_GUI_CANCEL=§cAbbrechen BAU_DELETE_GUI_DELETE=§aLöschen BAU_START_ALREADY=§cDer Server startet bereits. BAU_MEMBER_NOMEMBER=§cDer Spieler ist kein Mitglied deiner Welt! -BAU_MEMBER_TOGGLE_USAGE=§8/§7bau {0} §8[§eSpieler] +BAU_MEMBER_TOGGLE_USAGE=§8/§7bau {0} §8[§eSpieler§8] BAU_MEMBER_TOGGLE_TARGET=§aDu kannst nun auf der Welt von §e{0}§a {1}. BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0}. BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1}. @@ -173,7 +173,7 @@ EVENT_CURRENT_FIGHT_WIN=§8: §7Sieg §{0}{1} EVENT_CURRENT_FIGHT_DRAW=§8: §7Unentschieden #EventRescheduleCommand -EVENTRESCHEDULE_USAGE=§8/§7eventreschedule §8[§eTeam1 (Blue)§8] [§eTeam2 (Red)§8] +EVENTRESCHEDULE_USAGE=§8/§7eventreschedule §8[§eTeam1§8] [§eTeam2§8] EVENTRESCHEDULE_UNKNOWN_TEAM=§cEin Team ist unbekannt / Derzeit kein Event EVENTRESCHEDULE_NO_FIGHT="§cKein Kampf zwischen den Teams gefunden" EVENTRESCHEDULE_STARTING=§aKampf startet in 30s From d8d4d2d04bc4029aa9608a2f28a3af085701f128 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 30 Jan 2021 11:17:37 +0100 Subject: [PATCH 072/108] Fix Merge Confilcts --- src/de/steamwar/bungeecore/commands/UnbanCommand.java | 5 ++--- src/de/steamwar/messages/BungeeCore.properties | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/UnbanCommand.java b/src/de/steamwar/bungeecore/commands/UnbanCommand.java index acd5a792..58c0a6fb 100644 --- a/src/de/steamwar/bungeecore/commands/UnbanCommand.java +++ b/src/de/steamwar/bungeecore/commands/UnbanCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -45,11 +44,11 @@ public class UnbanCommand extends BasicCommand { return; if(!target.isBanned()) { - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Der Spieler ist nicht gebannt."); + Message.send("UNBAN_NOT_BANNED", sender); return; } Message.send("UNBAN_UNBANNED", sender, target.getUserName()); - target.ban(Timestamp.from(new Date().toInstant()), ""); + target.ban(Timestamp.from(new Date().toInstant()), "Unban", SteamwarUser.get(sender.getName()).getId(), false); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index a32c2518..84038b2a 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -410,6 +410,7 @@ TP_NOT_FOUND=§cKonnte das angegebene Ziel nicht finden. #UnbanCommand UNBAN_USAGE=§8/§7unban §8[§eSpieler§8] +UNBAN_NOT_BANNED=§cDer Spieler ist nicht gebannt. UNBAN_UNBANNED=Du hast {0} entbannt. #UnignoreCommand From a323661bc9e39ab22b6568a9dddcb916bea480f1 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 30 Jan 2021 17:11:27 +0100 Subject: [PATCH 073/108] Remove spam Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ErrorLogger.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index 09100952..5f4ab534 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -88,7 +88,12 @@ public class ErrorLogger extends Handler implements Filter { String stacktraceString = stacktrace.toString(); String message = MessageFormat.format(record.getMessage(), record.getParameters()); - if(message.contains("ServerConnector") || message.contains("InitialHandler") || message.contains("DownstreamBridge")) + if(message.contains("ServerConnector") + || message.contains("InitialHandler") + || message.contains("UpstreamBridge") + || message.contains("DownstreamBridge") + || message.contains(" took ") + || message.contains("No client connected for pending server!")) return; SWException.log("Bungee", message, stacktraceString); From 5d35e08af5c07e4818b7624eb00467dd2bfe772f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 1 Feb 2021 18:42:54 +0100 Subject: [PATCH 074/108] Hotfix ban system Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/sql/Punishment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/sql/Punishment.java b/src/de/steamwar/bungeecore/sql/Punishment.java index 40a2f4e7..e4d90348 100644 --- a/src/de/steamwar/bungeecore/sql/Punishment.java +++ b/src/de/steamwar/bungeecore/sql/Punishment.java @@ -43,7 +43,7 @@ public class Punishment { } public static Map getPunishmentsOfPlayer(int user) { - ResultSet set = SQL.select("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) WHERE UserId = ? GROUP BY Type)", user); + ResultSet set = SQL.select("SELECT * FROM Punishments WHERE PunishmentId IN (SELECT MAX(PunishmentId) FROM Punishments WHERE UserId = ? GROUP BY Type)", user); try { Map punishments = new HashMap<>(); while (set.next()) From 575ef6fb087a67bebab273b39ec1b1a747613b63 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 2 Feb 2021 23:42:00 +0100 Subject: [PATCH 075/108] Fix of Perma ban on Avoiding Alert --- .../bungeecore/listeners/BanListener.java | 16 +++++++++++++--- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index 80f666eb..2daabdef 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -21,6 +21,7 @@ package de.steamwar.bungeecore.listeners; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.BannedUserIPs; +import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; @@ -51,12 +52,21 @@ public class BanListener extends BasicListener { if(!ips.isEmpty()){ Timestamp highestBan = ips.get(0).getTimestamp(); + boolean perma = false; for(BannedUserIPs banned : ips) { - if(highestBan.before(banned.getTimestamp())) - highestBan = banned.getTimestamp(); + SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); + if(bannedUser.isBanned()) { + Punishment ban = bannedUser.getPunishment(Punishment.PunishmentType.Ban); + if(ban.isPerma()) { + perma = true; + break; + } + if(ban.getEndTime().after(highestBan)) + highestBan = ban.getEndTime(); + } } ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " " - + highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")) + + (perma?"perma":highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm"))) + " Bannumgehung"); for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 4c5b562a..1a1aefd7 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -149,6 +149,10 @@ public class SteamwarUser { return team; } + public Punishment getPunishment(Punishment.PunishmentType type) { + return punishments.getOrDefault(type, null); + } + public boolean isBanned() { if(!punishments.containsKey(Punishment.PunishmentType.Ban)) return false; From e1cd7b9c52a9db11c8d087b1d53379de7397a5c7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 5 Feb 2021 07:38:56 +0100 Subject: [PATCH 076/108] Fix team event overview Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/EventCommand.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index 6ac39f48..a60ea0a9 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -87,10 +87,9 @@ public class EventCommand extends BasicCommand { if(!teams.isEmpty()){ StringBuilder tline = new StringBuilder(); for(Team t : teams){ - tline.append(Message.parse("EVENT_COMING_TEAM", player, t.getTeamColor(), t.getTeamKuerzel())); + tline.append(' ').append(Message.parse("EVENT_COMING_TEAM", player, t.getTeamColor(), t.getTeamKuerzel())); } Message.send("EVENT_COMING_TEAMS", player, tline.toString()); - BungeeCore.send(player, tline.toString()); } } } From 18cb65a28b2b3d3d63960fe09de7f91ad26edb1f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 5 Feb 2021 07:54:39 +0100 Subject: [PATCH 077/108] Fix tablist Signed-off-by: Lixfel --- .../bungeecore/listeners/TablistManager.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index eb491b3e..073529be 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -41,6 +41,7 @@ import java.io.File; import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; public class TablistManager extends BasicListener { @@ -51,7 +52,7 @@ public class TablistManager extends BasicListener { private Icon gray; private int size; - private TreeMap> playerMap = new TreeMap<>(); + private final TreeMap> playerMap = new TreeMap<>(); public TablistManager(){ ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), this::updateCustomTablist, 1, 1, TimeUnit.SECONDS); @@ -67,21 +68,6 @@ public class TablistManager extends BasicListener { } } - private String calcHeader(ProxiedPlayer player){ - int phase = (seconds % 16) / 4; - switch(phase){ - case 0: - return Message.parse("TABLIST_PHASE_0", player, ProxyServer.getInstance().getPlayers().size()); - case 1: - return Message.parse("TABLIST_PHASE_1", player); - case 2: - return Message.parse("TABLIST_PHASE_2", player); - case 3: - default: - return Message.parse("TABLIST_PHASE_DEFAULT", player); - } - } - private void calculateSize(){ size = -1; for(Map.Entry> server : playerMap.entrySet()) @@ -107,9 +93,9 @@ public class TablistManager extends BasicListener { Subserver subserver = Subserver.getSubserver(server); List players; if(subserver != null && subserver.getType() == Servertype.BAUSERVER){ - players = playerMap.getOrDefault("%bauserverplaceholder%", new ArrayList<>()); + players = playerMap.getOrDefault("Bau", new ArrayList<>()); players.add(player); - playerMap.putIfAbsent("%bauserverplaceholder%", players); + playerMap.putIfAbsent("Bau", players); }else{ players = playerMap.getOrDefault(serverName, new ArrayList<>()); players.add(player); @@ -145,6 +131,21 @@ public class TablistManager extends BasicListener { BungeeTabListPlusAPI.setCustomTabList(player, this); } + private String calcHeader(ProxiedPlayer player){ + int phase = (seconds % 16) / 4; + switch(phase){ + case 0: + return Message.parse("TABLIST_PHASE_0", player, ProxyServer.getInstance().getPlayers().size()); + case 1: + return Message.parse("TABLIST_PHASE_1", player); + case 2: + return Message.parse("TABLIST_PHASE_2", player); + case 3: + default: + return Message.parse("TABLIST_PHASE_DEFAULT", player); + } + } + private String getPing(){ int ping = player.getPing(); if(ping < 50){ @@ -170,7 +171,7 @@ public class TablistManager extends BasicListener { setSlot(i%20, i/20, darkGray, "", 1000); i++; } - if(server.equals("%bauserverplaceholder%")) + if(server.equals("Bau")) server = Message.parse("TABLIST_BAU", player); setSlot(i%20, i/20, gray, "§7§l" + server, 1000); i++; @@ -186,6 +187,7 @@ public class TablistManager extends BasicListener { i++; } }catch(IndexOutOfBoundsException | NullPointerException e){ + ProxyServer.getInstance().getLogger().log(Level.WARNING, "Whaaa", e); //Ignore IndexOutOfBoundsException //Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting } From cd7ee79cdc07385b77cd7aa77653b91a34b1e3cc Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 5 Feb 2021 07:55:22 +0100 Subject: [PATCH 078/108] Remove debug messages Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/TablistManager.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/TablistManager.java b/src/de/steamwar/bungeecore/listeners/TablistManager.java index 073529be..c0b12fdf 100644 --- a/src/de/steamwar/bungeecore/listeners/TablistManager.java +++ b/src/de/steamwar/bungeecore/listeners/TablistManager.java @@ -41,7 +41,6 @@ import java.io.File; import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; -import java.util.logging.Level; public class TablistManager extends BasicListener { @@ -187,7 +186,6 @@ public class TablistManager extends BasicListener { i++; } }catch(IndexOutOfBoundsException | NullPointerException e){ - ProxyServer.getInstance().getLogger().log(Level.WARNING, "Whaaa", e); //Ignore IndexOutOfBoundsException //Ignore NPE, happens sometimes (only 1s long) when somebody is joining, server switching or disconnecting } From 02e4398301646166c8c58ea5200a9f207d9a19ca Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:22:48 +0100 Subject: [PATCH 079/108] Fix Join not Found --- src/de/steamwar/messages/BungeeCore.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 84038b2a..6b85d535 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -227,6 +227,9 @@ CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! HISTORIC_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen +#JoinCommand +JOIN_PLAYER_BLOCK=§cDieser Spieler hat dich geblockt! + #JoinmeCommand JOINME_USAGE=§8/§7join §8[§eSpieler§8]. JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! From a840671ced66e926b2706ddce224e47ffdb20bfe Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:23:57 +0100 Subject: [PATCH 080/108] Fix Challenge Broadcast --- src/de/steamwar/bungeecore/commands/ChallengeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 9d293871..36f78351 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -80,7 +80,7 @@ public class ChallengeCommand extends BasicCommand { arena.sendPlayer(player); arena.sendPlayer(target); - Message.broadcast("CHALLENGE_BROADCAST", sender, true, "CHALLENGE_BROADCAST_HOVER", + Message.broadcast("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getDisplayName(), target.getDisplayName()); }else{ if(!challenges.containsKey(player)){ From 7e9cc37e2d04df105f171a1bce9928d4371dcf88 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:25:33 +0100 Subject: [PATCH 081/108] Fix Team and ServerTeamchatCommand --- src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java | 2 +- src/de/steamwar/bungeecore/commands/TeamchatCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java index 96cf0def..90a6139d 100644 --- a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java @@ -56,7 +56,7 @@ public class ServerTeamchatCommand extends BasicCommand { for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ if ((target.hasPermission("bungeecore.teamchat")) && target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){ - Message.send("STC_FORMAT", target, sender.getName(), message); + Message.sendPrefixless("STC_FORMAT", target, sender.getName(), message); } } } diff --git a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java index 6abdace3..f5d17f5e 100644 --- a/src/de/steamwar/bungeecore/commands/TeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamchatCommand.java @@ -59,7 +59,7 @@ public class TeamchatCommand extends BasicCommand { SteamwarUser targetuser = SteamwarUser.get(target.getUniqueId()); if (targetuser.getTeam() == user.getTeam() && target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){ - Message.send("TC_FORMAT", target, player.getName(), msg); + Message.sendPrefixless("TC_FORMAT", target, player.getName(), msg); } } } From 11c55d94199f1137b9ebd445d578be1a5c023e49 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:29:34 +0100 Subject: [PATCH 082/108] Fix JoinmeCommand --- src/de/steamwar/bungeecore/commands/JoinmeCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 10f435ed..37fb8061 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -42,7 +42,7 @@ public class JoinmeCommand extends BasicCommand { if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER" - , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); + , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName()); } else if (args.length == 1) { ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null || !target.isConnected()){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6b85d535..6679b9b2 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -232,7 +232,7 @@ JOIN_PLAYER_BLOCK=§cDieser Spieler hat dich geblockt! #JoinmeCommand JOINME_USAGE=§8/§7join §8[§eSpieler§8]. -JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! +JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e{0} §7auf §e{1} §7zu kommen§8! JOINME_BROADCAST_HOVER=§aSpieler folgen JOINME_PLAYER_OFFLINE=§cDieser Spieler ist offline. JOINME_PLAYER_SELF=§cSei eins mit dir selbst! From 5cac4af7a4ed019345673c1e9adeb3b86c775dc2 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:32:46 +0100 Subject: [PATCH 083/108] Fix ChallengeCommand --- src/de/steamwar/bungeecore/commands/ChallengeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 36f78351..2c3d6574 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -81,7 +81,7 @@ public class ChallengeCommand extends BasicCommand { arena.sendPlayer(target); Message.broadcast("CHALLENGE_BROADCAST", "CHALLENGE_BROADCAST_HOVER", - new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getDisplayName(), target.getDisplayName()); + new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName(), target.getName()); }else{ if(!challenges.containsKey(player)){ challenges.put(player, new LinkedList<>()); From cfbf1c08504e2d21006acf315996d7a4cd1fdc4a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:34:55 +0100 Subject: [PATCH 084/108] Fix Fight & Hover Messages --- src/de/steamwar/bungeecore/Message.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 269e7e18..096878af 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -109,7 +109,7 @@ public class Message { public static void broadcast(String message, String onHover, ClickEvent onClick, Object... params){ for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) - send(message, player, parse(onHover, true, player), onClick, params); + send(message, player, parse(onHover, false, player, params), onClick, params); } public static void broadcast(String message, Object... params){ From 61ce5cd860e023fb090c9c69bb19c40bbbd02ec4 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:45:21 +0100 Subject: [PATCH 085/108] Fix MsgCommand and RCommand --- src/de/steamwar/bungeecore/commands/MsgCommand.java | 4 ++-- src/de/steamwar/bungeecore/commands/RCommand.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/MsgCommand.java b/src/de/steamwar/bungeecore/commands/MsgCommand.java index fde3244a..8ec0d386 100644 --- a/src/de/steamwar/bungeecore/commands/MsgCommand.java +++ b/src/de/steamwar/bungeecore/commands/MsgCommand.java @@ -72,8 +72,8 @@ public class MsgCommand extends BasicCommand { for (int i = 1; i < args.length; i++){ msgBuilder.append(args[i]).append(" "); } - Message.send("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString()); - Message.send("MSG_FORMAT", target, player.getName(), target.getName(), msgBuilder.toString()); + Message.sendPrefixless("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString()); + Message.sendPrefixless("MSG_FORMAT", target, player.getName(), target.getName(), msgBuilder.toString()); BungeeCore.log(Message.parse("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString())); lastChats.put(player, target); diff --git a/src/de/steamwar/bungeecore/commands/RCommand.java b/src/de/steamwar/bungeecore/commands/RCommand.java index 17b87b72..fef00317 100644 --- a/src/de/steamwar/bungeecore/commands/RCommand.java +++ b/src/de/steamwar/bungeecore/commands/RCommand.java @@ -69,8 +69,8 @@ public class RCommand extends BasicCommand { for (String arg : args){ msgBuilder.append(arg).append(" "); } - Message.send("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString()); - Message.send("MSG_FORMAT", target, player.getName(), target.getName(), msgBuilder.toString()); + Message.sendPrefixless("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString()); + Message.sendPrefixless("MSG_FORMAT", target, player.getName(), target.getName(), msgBuilder.toString()); BungeeCore.log(Message.parse("MSG_FORMAT", player, player.getName(), target.getName(), msgBuilder.toString())); lastChats.put(target, player); From 8114bb2922b9ce416d6ba1ca407814562cf5356c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:48:37 +0100 Subject: [PATCH 086/108] Fix Bau Add Message --- src/de/steamwar/bungeecore/commands/BauCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 3c388366..f4187fcf 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -134,7 +134,7 @@ public class BauCommand { ProxiedPlayer z = ProxyServer.getInstance().getPlayer(target.getUuid()); if(z != null) - Message.send("BAU_ADDMEMBER_ADDED_TARGET", p, p.getName()); + Message.send("BAU_ADDMEMBER_ADDED_TARGET", z, p.getName()); } private static void teleport(ProxiedPlayer p, String[] command){ From 30cd8c2c7cb1182309dc8df46277fa2d5a117dd6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:49:45 +0100 Subject: [PATCH 087/108] Fix Bau Allowed Message --- src/de/steamwar/bungeecore/commands/BauCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index f4187fcf..a0d120fb 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -316,11 +316,11 @@ public class BauCommand { if(permission){ if(player != null) - Message.send("BAU_MEMBER_TOGGLE_TARGET", p, p.getName(), what); + Message.send("BAU_MEMBER_TOGGLE_TARGET", player, p.getName(), what); Message.send("BAU_MEMBER_TOGGLE", p, what); }else{ if(player != null) - Message.send("BAU_MEMBER_TOGGLE_TARGET_OFF", p, p.getName(), what); + Message.send("BAU_MEMBER_TOGGLE_TARGET_OFF", player, p.getName(), what); Message.send("BAU_MEMBER_TOGGLE_OFF", p, what); } } From d7b784c03ca569177b8344fe9b4e66ef6767a538 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 11:55:20 +0100 Subject: [PATCH 088/108] Fix Team List --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6679b9b2..4ed6107e 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -387,7 +387,7 @@ TEAM_INFO_EVENTS=§7Events§8: §e{0} TEAM_LIST_NOT_PAGE=§cKeine Seitenzahl angegeben TEAM_LIST_UNKNOWN_PAGE=§cUngültige Seitenzahl angegeben TEAM_LIST_HEADER=§7§lTeamliste §7{0}§8/§7{1} -TEAM_LIST_TEAM=§{0}{1} §e{2} §8[§7{3}}§8] +TEAM_LIST_TEAM=§{0}{1} §e{2} §8[§7{3}§8] TEAM_LIST_TEAM_HOVER=§7Teaminfo TEAM_LIST_PAGE=Seite TEAM_LIST_NEXT=§eNächste Seite From e661d876b11cd1ccc8a623c68c20394c0ffa9ab7 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 12:04:06 +0100 Subject: [PATCH 089/108] Temp Tp Fix --- src/de/steamwar/bungeecore/commands/JoinmeCommand.java | 6 +++--- src/de/steamwar/bungeecore/commands/TpCommand.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 37fb8061..97802144 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -67,13 +67,13 @@ public class JoinmeCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - Message.send("JOIN_PLAYER_BLOCK", player); + Message.send("MSG_IGNORED", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - Message.send("JOIN_PLAYER_BLOCK", player); + Message.send("MSG_IGNORED", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - Message.send("JOIN_PLAYER_BLOCK", player); + Message.send("MSG_IGNORED", player); }else{ player.connect(server); } diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index ae2f9a99..28624dfc 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -126,13 +126,13 @@ public class TpCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - Message.send("JOIN_PLAYER_BLOCK", player); + Message.send("MSG_IGNORED", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - Message.send("JOIN_PLAYER_BLOCK", player); + Message.send("MSG_IGNORED", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - Message.send("JOIN_PLAYER_BLOCK", player); + Message.send("MSG_IGNORED", player); }else{ player.connect(server); } From 9ad9a2c83581368f160a7324a174f1a120ef435b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 12:28:35 +0100 Subject: [PATCH 090/108] Add ResourcereloadCommand --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../commands/ResourcereloadCommand.java | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/de/steamwar/bungeecore/commands/ResourcereloadCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 2f5fc946..89a07fc3 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -120,6 +120,7 @@ public class BungeeCore extends Plugin { new IgnoreCommand(); new UnIgnoreCommand(); new PollresultCommand(); + new ResourcereloadCommand(); if(!EVENT_MODE){ new WebregisterCommand(); diff --git a/src/de/steamwar/bungeecore/commands/ResourcereloadCommand.java b/src/de/steamwar/bungeecore/commands/ResourcereloadCommand.java new file mode 100644 index 00000000..0789c487 --- /dev/null +++ b/src/de/steamwar/bungeecore/commands/ResourcereloadCommand.java @@ -0,0 +1,36 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ + +package de.steamwar.bungeecore.commands; + +import net.md_5.bungee.api.CommandSender; + +import java.util.ResourceBundle; + +public class ResourcereloadCommand extends BasicCommand { + + public ResourcereloadCommand() { + super("resourcereload", "bungeecore.softreload", "rr"); + } + + @Override + public void execute(CommandSender commandSender, String[] strings) { + ResourceBundle.clearCache(); + } +} From 6f6327d60f41af3a34813675310b0adfa5610a7a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 12:29:41 +0100 Subject: [PATCH 091/108] Add ResourcereloadCommand --- src/de/steamwar/bungeecore/commands/JoinmeCommand.java | 6 +++--- src/de/steamwar/bungeecore/commands/TpCommand.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index 97802144..37fb8061 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -67,13 +67,13 @@ public class JoinmeCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - Message.send("MSG_IGNORED", player); + Message.send("JOIN_PLAYER_BLOCK", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - Message.send("MSG_IGNORED", player); + Message.send("JOIN_PLAYER_BLOCK", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - Message.send("MSG_IGNORED", player); + Message.send("JOIN_PLAYER_BLOCK", player); }else{ player.connect(server); } diff --git a/src/de/steamwar/bungeecore/commands/TpCommand.java b/src/de/steamwar/bungeecore/commands/TpCommand.java index 28624dfc..ae2f9a99 100644 --- a/src/de/steamwar/bungeecore/commands/TpCommand.java +++ b/src/de/steamwar/bungeecore/commands/TpCommand.java @@ -126,13 +126,13 @@ public class TpCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - Message.send("MSG_IGNORED", player); + Message.send("JOIN_PLAYER_BLOCK", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - Message.send("MSG_IGNORED", player); + Message.send("JOIN_PLAYER_BLOCK", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - Message.send("MSG_IGNORED", player); + Message.send("JOIN_PLAYER_BLOCK", player); }else{ player.connect(server); } From fa60eeb121bbe3b089999a844173b72a0c40b9df Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 5 Feb 2021 13:25:46 +0100 Subject: [PATCH 092/108] Test ttl Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/Message.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 096878af..63d851f6 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -34,6 +34,13 @@ import java.util.ResourceBundle; public class Message { + private static final ResourceBundle.Control CONTROL = new ResourceBundle.Control() { + @Override + public long getTimeToLive(String arg0, Locale arg1) { + return 60000; //Cache only 1 minute + } + }; + public static TextComponent parseToComponent(String message, boolean prefixed, CommandSender sender, Object... params){ return new TextComponent(TextComponent.fromLegacyText(parse(message, prefixed, sender, params))); } @@ -53,7 +60,7 @@ public class Message { if(locale == null) locale = Locale.getDefault(); - ResourceBundle resourceBundle = ResourceBundle.getBundle("de.steamwar.messages.BungeeCore", locale); + ResourceBundle resourceBundle = ResourceBundle.getBundle("de.steamwar.messages.BungeeCore", locale, CONTROL); String pattern = ""; if(prefixed) pattern = resourceBundle.getObject("PREFIX") + " "; From a9982de3db53622ea811b19e5a9b616fbe01a841 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 13:53:14 +0100 Subject: [PATCH 093/108] Fixed Wrong Message --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 4ed6107e..da1692ee 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -228,7 +228,7 @@ HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! HISTORIC_BROADCAST_HOVER=§aGegen §7{1} §ekämpfen #JoinCommand -JOIN_PLAYER_BLOCK=§cDieser Spieler hat dich geblockt! +JOIN_PLAYER_BLOCK=§cDu kannst diesem Spieler derzeit nicht folgen. #JoinmeCommand JOINME_USAGE=§8/§7join §8[§eSpieler§8]. From 2a9a36d53ea7745f231e04a5826390b8e990bac0 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 5 Feb 2021 14:28:21 +0100 Subject: [PATCH 094/108] Fixed UNKNOWN_TEAM Message --- src/de/steamwar/messages/BungeeCore.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index da1692ee..65b14be9 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -3,6 +3,7 @@ SPACER= UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. +UNKNOWN_TEAM=§cDieses Team gibt es nicht. INVALID_TIME=§cUngültige Zeitangabe. #ModLoader blocker From f6a617718550d0342640db4bc5cf868939b123d8 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 11 Feb 2021 17:02:24 +0100 Subject: [PATCH 095/108] Fixing Various thing with new Message System --- src/de/steamwar/bungeecore/commands/KickCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/KickCommand.java b/src/de/steamwar/bungeecore/commands/KickCommand.java index 44b5b977..cb27fab5 100644 --- a/src/de/steamwar/bungeecore/commands/KickCommand.java +++ b/src/de/steamwar/bungeecore/commands/KickCommand.java @@ -47,7 +47,7 @@ public class KickCommand extends BasicCommand { } if(args.length == 1){ - Message.send("KICK_NORMAL", target); + target.disconnect(Message.parseToComponent("KICK_NORMAL", true, target)); }else{ StringBuilder msgBuilder = new StringBuilder(); msgBuilder.append(BungeeCore.CHAT_PREFIX).append("§c"); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 65b14be9..f5844575 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -450,6 +450,7 @@ CHAT_BC_NO_COMMANDS=§cKeine Befehle mit /local möglich. #CheckListner CHECK_UNCHECKED=§7Du hast noch §e{0} §7ungeprüfte Schematic§8(§7s§8)! +CHECK_CHECKING=§cDu prüfst gerade eine Schematic! #ConnectionListener JOIN_ARENA=§7Klicke §ehier§7, um §e{0} §7beizutreten From 8a2d5f315fff2279b27a03bb67b6a158e5d5e11e Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 13 Feb 2021 00:53:09 +0100 Subject: [PATCH 096/108] Expanding Some Things --- src/de/steamwar/messages/BungeeCore.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index f5844575..9c2dc8e5 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -1,5 +1,6 @@ PREFIX=§eSteam§8War» SPACER= +TIMEFORMAT=HH:mm dd.MM.yyyy UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. From 916d228faccc48f8b9d28e8b6cc9c8ec53db2f05 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 14 Feb 2021 00:09:24 +0100 Subject: [PATCH 097/108] Fix Change Leader Message --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 1abcdfcd..e28a8446 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -387,7 +387,7 @@ public class TeamCommand extends BasicCommand { } team.setTeamLeader(target.getId()); - Message.send("TEAM_LEADER_CHANGED", player, args[0]); + Message.send("TEAM_LEADER_CHANGED", player, args[1]); } private String playerName(SteamwarUser user){ From b3bf45846a3a8c71c7a9c526692b8346f78df0d7 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Feb 2021 22:51:02 +0100 Subject: [PATCH 098/108] Fix Error in Team Invite Message --- src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index e28a8446..85093c4d 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -278,7 +278,7 @@ public class TeamCommand extends BasicCommand { Message.send("TEAM_INVITE_INVITED", player, args[1]); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); if(p != null) - Message.send("TEAM_INVITE_INVITED_TARGET", player, team.getTeamColor(), team.getTeamName()); + Message.send("TEAM_INVITE_INVITED_TARGET", p, team.getTeamColor(), team.getTeamName()); } private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ From c795692e7905c39805ace504f257e9a3d43b6e8a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 1 Mar 2021 20:53:32 +0100 Subject: [PATCH 099/108] Event deadline Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/EventCommand.java | 4 ++++ src/de/steamwar/bungeecore/commands/TeamCommand.java | 2 +- src/de/steamwar/bungeecore/sql/Event.java | 5 +++++ src/de/steamwar/messages/BungeeCore.properties | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/EventCommand.java b/src/de/steamwar/bungeecore/commands/EventCommand.java index a60ea0a9..680b0a93 100644 --- a/src/de/steamwar/bungeecore/commands/EventCommand.java +++ b/src/de/steamwar/bungeecore/commands/EventCommand.java @@ -78,12 +78,16 @@ public class EventCommand extends BasicCommand { private void noCurrentEvent(ProxiedPlayer player){ Message.send("EVENT_NO_CURRENT", player); List coming = Event.getComing(); + Instant now = Instant.now(); if(!coming.isEmpty()){ DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern(Message.parse("EVENT_DATE_FORMAT", player)); Message.send("EVENT_COMING", player); for(Event e : coming){ Message.send("EVENT_COMING_EVENT", player, e.getStart().toLocalDateTime().format(dateFormat), e.getEnd().toLocalDateTime().format(dateFormat), e.getEventName()); Set teams = TeamTeilnahme.getTeams(e.getEventID()); + if(now.isBefore(e.getDeadline().toInstant())) { + Message.send("EVENT_COMING_DEADLINE", player, e.getDeadline()); + } if(!teams.isEmpty()){ StringBuilder tline = new StringBuilder(); for(Team t : teams){ diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 85093c4d..a1ca9954 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -509,7 +509,7 @@ public class TeamCommand extends BasicCommand { return; } - if(Instant.now().isAfter(event.getEnd().toInstant())){ + if(Instant.now().isAfter(event.getDeadline().toInstant())){ Message.send("TEAM_EVENT_OVER", player); return; } diff --git a/src/de/steamwar/bungeecore/sql/Event.java b/src/de/steamwar/bungeecore/sql/Event.java index 336128e6..72db0659 100644 --- a/src/de/steamwar/bungeecore/sql/Event.java +++ b/src/de/steamwar/bungeecore/sql/Event.java @@ -37,6 +37,7 @@ public class Event { private final int maximumTeamMembers; private final boolean publicSchemsOnly; private final boolean spectateSystem; + private final Timestamp deadline; private static Event current = null; @@ -48,6 +49,7 @@ public class Event { this.maximumTeamMembers = rs.getInt("MaximumTeamMembers"); this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly"); this.spectateSystem = rs.getBoolean("SpectateSystem"); + this.deadline = rs.getTimestamp("Deadline"); } public static Event get(){ @@ -133,4 +135,7 @@ public class Event { public boolean spectateSystem(){ return spectateSystem; } + public Timestamp getDeadline() { + return deadline; + } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9c2dc8e5..71ff3cad 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -177,6 +177,7 @@ EVENT_NO_FIGHT_TEAM=§cDas Team kämpft derzeit nicht EVENT_NO_CURRENT=§cDerzeit findet kein Event statt EVENT_COMING=§eKommende Events§8: EVENT_COMING_EVENT=§7{0}§8-§7{1}§8: §e{2} +EVENT_COMING_DEADLINE=§7 Anmeldeschluss§8: §7{0} EVENT_COMING_TEAMS=§7 Mit§8:{0} EVENT_COMING_TEAM= §{0}{1} EVENT_CURRENT_EVENT=§e§l{0} @@ -400,7 +401,7 @@ TEAM_EVENT_USAGE=§8/§7team event §8[§eEvent§8] - §7um daran teilzunehmen TEAM_EVENT_HEADER=§7Dein Team nimmt an folgenden Events teil§8: TEAM_EVENT_EVENT=§7{0}§8: §e{1} TEAM_EVENT_NO_EVENT=§cDieses Event gibt es nicht -TEAM_EVENT_OVER=§cDieses Event ist bereits vorbei +TEAM_EVENT_OVER=§cDie Anmeldephase für dieses Event ist bereits vorbei TEAM_EVENT_LEFT=§7Dein Team nimmt nicht mehr am Event teil TEAM_EVENT_JOINED=§7Dein Team nimmt nun am Event §e{0} §7 teil! TEAM_EVENT_HOW_TO_LEAVE=§7Um die Teilnahme abzusagen, wiederhole den Befehl From b5b6a624c60dcd2bf47e7305ddb8af96bdc38c2f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 2 Mar 2021 07:23:07 +0100 Subject: [PATCH 100/108] Test git hooks Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/BungeeCore.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 89a07fc3..23b5e2eb 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -70,7 +70,6 @@ public class BungeeCore extends Plugin { @Override public void onEnable(){ - getProxy().registerChannel("sw:bridge"); setInstance(this); From 3ea273767d5d6193ec2268803d1677da3deead8f Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 4 Mar 2021 21:14:19 +0100 Subject: [PATCH 101/108] Add Static Server Fabric Check --- src/de/steamwar/bungeecore/BungeeCore.java | 3 +++ .../bungeecore/listeners/mods/ModLoaderBlocker.java | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 23b5e2eb..6ca32200 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -263,6 +263,9 @@ public class BungeeCore extends Plugin { serverPermissions.get(serverName), cmds.toArray(new String[0]) ); + if(server.getBoolean("modchecked", false)) { + ModLoaderBlocker.addServer(serverName); + } } } diff --git a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java index 11e8d874..281830cf 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java +++ b/src/de/steamwar/bungeecore/listeners/mods/ModLoaderBlocker.java @@ -29,9 +29,13 @@ import net.md_5.bungee.api.event.ServerSwitchEvent; import net.md_5.bungee.event.EventHandler; import java.nio.charset.StandardCharsets; +import java.util.HashSet; +import java.util.Set; public class ModLoaderBlocker extends BasicListener { + private static final Set BLOCKED_SERVER = new HashSet<>(); + @EventHandler public void onPluginMessageEvent(PluginMessageEvent e){ Connection sender = e.getSender(); @@ -79,8 +83,9 @@ public class ModLoaderBlocker extends BasicListener { @EventHandler public void onServerSwitch(ServerSwitchEvent event) { - if(Subserver.getSubserver(event.getPlayer()) != null - && Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA + if(((Subserver.getSubserver(event.getPlayer()) != null + && Subserver.getSubserver(event.getPlayer()).getType() == Servertype.ARENA) + || BLOCKED_SERVER.contains(event.getPlayer().getServer().getInfo().getName())) && isFabric(event.getPlayer())) { event.getPlayer().connect(BungeeCore.get().getProxy().getServerInfo(BungeeCore.LOBBY_SERVER)); Message.send("MODLOADER_DENIED", event.getPlayer()); @@ -90,4 +95,8 @@ public class ModLoaderBlocker extends BasicListener { public static boolean isFabric(ProxiedPlayer player) { return Storage.fabricPlayers.contains(player); } + + public static void addServer(String server) { + BLOCKED_SERVER.add(server); + } } From a079b25c14813a39fa330dbd34762827f0b2681d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 19:08:09 +0200 Subject: [PATCH 102/108] Adjust config for new fight system Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ArenaMode.java | 21 ++++++++++++++----- .../steamwar/bungeecore/SubserverSystem.java | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index c007a86f..19652ab5 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -73,22 +73,29 @@ public class ArenaMode { private final String internalName; private final String displayName; + private final String folder; private final List chatNames; private final String serverJar; private final List maps; private final boolean historic; + private final boolean ranked; private final String schemType; private ArenaMode(String internalName, Configuration config){ this.internalName = internalName; - this.displayName = config.getString("displayName"); + this.folder = config.getString("folder"); this.serverJar = config.getString("serverJar"); - this.chatNames = config.getStringList("chatNames"); this.maps = config.getStringList("maps"); + this.displayName = config.getString("displayName", internalName); + if(config.contains("chatNames")) + this.chatNames = config.getStringList("chatNames"); + else + this.chatNames = Collections.emptyList(); this.historic = config.getBoolean("historic", false); + this.schemType = config.getString("schemType", "").toLowerCase(); + this.ranked = config.getBoolean("ranked", false); - this.schemType = config.getString("schemType", null); allModes.add(this); byInternal.put(internalName, this); @@ -96,8 +103,8 @@ public class ArenaMode { byChat.put(name.toLowerCase(), this); } - if(config.contains("checkSchemType")) - byCheckSchemType.put(config.getString("checkSchemType").toLowerCase(), this); + if(!this.schemType.equals("")) + byCheckSchemType.put(this.schemType, this); } public String getInternalName() { @@ -120,6 +127,10 @@ public class ArenaMode { return null; } + public String getFolder() { + return folder; + } + public String getRandomMap(){ return maps.get(random.nextInt(maps.size())); } diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index 50d55526..3613febd 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -108,7 +108,7 @@ public class SubserverSystem { //Copy world try { - new ProcessBuilder("cp", "-r", SERVER_PATH + modus.getInternalName() + "/" + map, worldDir + mapName).start().waitFor(); + new ProcessBuilder("cp", "-r", SERVER_PATH + modus.getFolder() + "/" + map, worldDir + mapName).start().waitFor(); } catch (IOException | InterruptedException e) { throw new SecurityException("Could not copy folder", e); } From 5424a739d9d02eec74d4e03d53c267d5e47d5a1d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 19:12:00 +0200 Subject: [PATCH 103/108] Adjust config for new fight system Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ArenaMode.java | 8 ++------ src/de/steamwar/bungeecore/SubserverSystem.java | 4 ++-- src/de/steamwar/bungeecore/commands/FightCommand.java | 2 +- src/de/steamwar/bungeecore/commands/RankedCommand.java | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index 19652ab5..68a27a4e 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -107,10 +107,6 @@ public class ArenaMode { byCheckSchemType.put(this.schemType, this); } - public String getInternalName() { - return internalName; - } - public String getDisplayName() { return displayName; } @@ -143,8 +139,8 @@ public class ArenaMode { return chatNames.get(0); } - public boolean hasChatName(){ - return !chatNames.isEmpty(); + public boolean withoutChatName(){ + return chatNames.isEmpty(); } public boolean isHistoric(){ diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index 3613febd..5751f6ef 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -108,7 +108,7 @@ public class SubserverSystem { //Copy world try { - new ProcessBuilder("cp", "-r", SERVER_PATH + modus.getFolder() + "/" + map, worldDir + mapName).start().waitFor(); + new ProcessBuilder("cp", "-r", SERVER_PATH + modus.getFolder() + "/arenas/" + map, worldDir + mapName).start().waitFor(); } catch (IOException | InterruptedException e) { throw new SecurityException("Could not copy folder", e); } @@ -128,7 +128,7 @@ public class SubserverSystem { //Start server ProcessBuilder process = new ProcessBuilder(cmd); - process.directory(new File(SERVER_PATH, modus.getInternalName())); + process.directory(new File(SERVER_PATH, modus.getFolder())); String finalMapName = mapName; if(eventFightID == -1) diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 44e9cf10..93292de3 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -69,7 +69,7 @@ public class FightCommand extends BasicCommand { TextComponent start = new TextComponent(); TextComponent current = start; for(ArenaMode mode : ArenaMode.getAllModes()){ - if(!mode.hasChatName() || mode.isHistoric() != historic) + if(mode.withoutChatName() || mode.isHistoric() != historic) continue; String command = precommand + mode.getChatName(); current.setBold(true); diff --git a/src/de/steamwar/bungeecore/commands/RankedCommand.java b/src/de/steamwar/bungeecore/commands/RankedCommand.java index c70fff93..5825b48f 100644 --- a/src/de/steamwar/bungeecore/commands/RankedCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankedCommand.java @@ -81,7 +81,7 @@ public class RankedCommand extends BasicCommand { TextComponent start = new TextComponent(); TextComponent current = start; for(ArenaMode mode : ArenaMode.getAllModes()){ - if(!mode.hasChatName() || !mode.isRanked()) + if(mode.withoutChatName() || !mode.isRanked()) continue; String command = precommand + mode.getChatName(); current.setBold(true); From 5ee46a2ca32a38205e7d1adfd74221b2013789a0 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 19:13:35 +0200 Subject: [PATCH 104/108] Adjust config for new fight system Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ArenaMode.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index 68a27a4e..1e33cce9 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -71,7 +71,6 @@ public class ArenaMode { return allModes; } - private final String internalName; private final String displayName; private final String folder; private final List chatNames; @@ -83,7 +82,6 @@ public class ArenaMode { private final String schemType; private ArenaMode(String internalName, Configuration config){ - this.internalName = internalName; this.folder = config.getString("folder"); this.serverJar = config.getString("serverJar"); this.maps = config.getStringList("maps"); From 4c2f4fdbcd121dc2b564272587b5046260c8a11e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 19:47:34 +0200 Subject: [PATCH 105/108] Implement prepare Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ArenaMode.java | 17 ++++----- .../steamwar/bungeecore/SubserverSystem.java | 15 ++++---- .../bungeecore/commands/BauCommand.java | 36 ++++++++++--------- .../bungeecore/commands/ChallengeCommand.java | 2 +- .../bungeecore/commands/CheckCommand.java | 11 ++---- .../bungeecore/commands/FightCommand.java | 2 +- .../bungeecore/commands/HistoricCommand.java | 2 +- .../bungeecore/commands/RankedCommand.java | 2 +- .../bungeecore/comms/PacketIdManager.java | 1 + .../bungeecore/comms/SpigotReceiver.java | 2 ++ .../comms/handlers/PrepareSchemHandler.java | 23 ++++++++++++ 11 files changed, 69 insertions(+), 44 deletions(-) create mode 100644 src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index 1e33cce9..b675b8eb 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -19,17 +19,18 @@ package de.steamwar.bungeecore; +import de.steamwar.bungeecore.sql.SchematicType; import net.md_5.bungee.config.Configuration; import java.util.*; public class ArenaMode { - private static Map byChat = new HashMap<>(); - private static Map byInternal = new HashMap<>(); - private static Map byCheckSchemType = new HashMap<>(); - private static List allModes = new LinkedList<>(); - private static Random random = new Random(); + private static final Map byChat = new HashMap<>(); + private static final Map byInternal = new HashMap<>(); + private static final Map bySchemType = new HashMap<>(); + private static final List allModes = new LinkedList<>(); + private static final Random random = new Random(); static void init(Configuration config){ for(String internalName : config.getKeys()){ @@ -63,8 +64,8 @@ public class ArenaMode { return chatNames; } - public static ArenaMode getByCheckSchemType(String checkSchemType){ - return byCheckSchemType.get(checkSchemType); + public static ArenaMode getBySchemType(SchematicType schemType){ + return bySchemType.get(schemType); } public static List getAllModes(){ @@ -102,7 +103,7 @@ public class ArenaMode { } if(!this.schemType.equals("")) - byCheckSchemType.put(this.schemType, this); + bySchemType.put(SchematicType.fromDB(this.schemType), this); } public String getDisplayName() { diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index 5751f6ef..48985488 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -87,7 +87,7 @@ public class SubserverSystem { * @return * The new started subserver. */ - public static Subserver startArena(ArenaMode modus, String map, int eventFightID, int checkSchemID, String serverName, String mapName, UUID player1, UUID player2, boolean ranked){ + public static Subserver startArena(ArenaMode modus, String map, int eventFightID, int checkSchemID, int prepareSchemID, String serverName, String mapName, UUID player1, UUID player2, boolean ranked){ //Generate missing parameters int port = freePort(firstArenaPort); @@ -123,6 +123,7 @@ public class SubserverSystem { "fightID=" + eventFightID, "ranked=" + ranked, "checkSchemID=" + checkSchemID, + "prepareSchemID=" + prepareSchemID, player1 != null && eventFightID != -1 ? "blueLeader=" + player1.toString() : null, player2 != null ? "redLeader=" + player2.toString() : null); @@ -152,24 +153,22 @@ public class SubserverSystem { }); } - public static Subserver startArena(ArenaMode modus, String map, int eventFightID, int checkSchemID, String serverName, String mapName, UUID player1, UUID player2){ - return startArena(modus, map, eventFightID, checkSchemID, serverName, mapName, player1, player2, false); - } - public static Subserver startEventArena(EventFight eventFight, String serverName){ return startArena( eventFight.getSpielmodus(), eventFight.getMap(), eventFight.getFightID(), 0, + 0, serverName, serverName.replace(' ', '_') + eventFight.getStartTime().toLocalDateTime().format(DateTimeFormatter.ISO_TIME), null, - null); + null, + false); } - public static void startTestServer(ProxiedPlayer p, ArenaMode m, String map, int checkSchemId){ - startArena(m, map, -1, checkSchemId, p.getName() + "s Bau", p.getName(), p.getUniqueId(), null).sendPlayer(p); + public static void startTestServer(ProxiedPlayer p, ArenaMode m, String map, int checkSchemId, int prepareSchemId){ + startArena(m, map, -1, checkSchemId, prepareSchemId, p.getName() + "s Bau", p.getName(), p.getUniqueId(), null, false).sendPlayer(p); } public static void sendToBauServer(ProxiedPlayer p, UUID owner){ diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index a0d120fb..355a82f9 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -266,24 +266,28 @@ public class BauCommand { }); } + public static void stopBauserver(ProxiedPlayer p){ + for (Subserver subserver : Subserver.getServerList()) { + if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { + if(subserver.getServer().getPlayers().isEmpty()){ + Message.send("BAU_START_ALREADY", p); + return; + } + subserver.stop(); + try { + Thread.sleep(200); // Wait until possible testarena-World has been deleted + } catch (InterruptedException e) { + throw new SecurityException("Subserver stop interrupted", e); + } + break; + } + } + } + private static void testarena(ProxiedPlayer p, String[] command){ FightCommand.createArena(p, "/bau testarena ", command, 2, false, (player, mode, map) -> ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { - for (Subserver subserver : Subserver.getServerList()) { - if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(p.getUniqueId())) { - if(subserver.getServer().getPlayers().isEmpty()){ - Message.send("BAU_START_ALREADY", p); - return; - } - subserver.stop(); - try { - Thread.sleep(200); // Wait until possible testarena-World has been deleted - } catch (InterruptedException e) { - throw new SecurityException("Subserver stop interrupted", e); - } - break; - } - } - SubserverSystem.startTestServer(p, mode, map, 0); + stopBauserver(p); + SubserverSystem.startTestServer(p, mode, map, 0, 0); })); } diff --git a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java index 2c3d6574..3d4150d3 100644 --- a/src/de/steamwar/bungeecore/commands/ChallengeCommand.java +++ b/src/de/steamwar/bungeecore/commands/ChallengeCommand.java @@ -75,7 +75,7 @@ public class ChallengeCommand extends BasicCommand { challenges.remove(target); challenges.remove(player); - Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), target.getUniqueId()); + Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), target.getUniqueId(), false); arena.sendPlayer(player); arena.sendPlayer(target); diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index 9aaed515..b121fe94 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -223,15 +223,10 @@ public class CheckCommand extends BasicCommand { this.checkList = checkQuestions.get(schematic.getSchemType()).listIterator(); ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { - for (Subserver subserver : Subserver.getServerList()) { - if (subserver.getType() == Servertype.BAUSERVER && ((Bauserver) subserver).getOwner().equals(checker.getUniqueId())) { - subserver.stop(); - break; - } - } + BauCommand.stopBauserver(checker); - ArenaMode mode = ArenaMode.getByCheckSchemType(schematic.getSchemType().toDB()); - SubserverSystem.startTestServer(checker, mode, FightCommand.getMap(checker, mode, "Random"), schematic.getSchemID()); + ArenaMode mode = ArenaMode.getBySchemType(schematic.getSchemType().fightType()); + SubserverSystem.startTestServer(checker, mode, FightCommand.getMap(checker, mode, "Random"), schematic.getSchemID(), 0); currentCheckers.put(checker.getUniqueId(), this); currentSchems.put(schematic.getSchemID(), this); for(CheckedSchematic previous : CheckedSchematic.previousChecks(schematic.getSchemName(), schematic.getSchemOwner())) diff --git a/src/de/steamwar/bungeecore/commands/FightCommand.java b/src/de/steamwar/bungeecore/commands/FightCommand.java index 93292de3..984bc06b 100644 --- a/src/de/steamwar/bungeecore/commands/FightCommand.java +++ b/src/de/steamwar/bungeecore/commands/FightCommand.java @@ -164,7 +164,7 @@ public class FightCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { createArena(sender, "/fight ", args, 0, false, (player, mode, map) -> { - Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); + Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), null, false); arena.sendPlayer(player); Message.broadcast("FIGHT_BROADCAST", "FIGHT_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); diff --git a/src/de/steamwar/bungeecore/commands/HistoricCommand.java b/src/de/steamwar/bungeecore/commands/HistoricCommand.java index c7d64deb..ebf93123 100644 --- a/src/de/steamwar/bungeecore/commands/HistoricCommand.java +++ b/src/de/steamwar/bungeecore/commands/HistoricCommand.java @@ -33,7 +33,7 @@ public class HistoricCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { FightCommand.createArena(sender, "/historic ", args, 0, true, (player, mode, map) -> { - Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, null, null, player.getUniqueId(), null); + Subserver arena = SubserverSystem.startArena(mode, map, 0, 0, 0, null, null, player.getUniqueId(), null, false); arena.sendPlayer(player); Message.broadcast("HISTORIC_BROADCAST", "HISTORIC_BROADCAST_HOVER" , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), mode.getDisplayName(), player.getName()); diff --git a/src/de/steamwar/bungeecore/commands/RankedCommand.java b/src/de/steamwar/bungeecore/commands/RankedCommand.java index 5825b48f..1a978b55 100644 --- a/src/de/steamwar/bungeecore/commands/RankedCommand.java +++ b/src/de/steamwar/bungeecore/commands/RankedCommand.java @@ -165,7 +165,7 @@ public class RankedCommand extends BasicCommand { removeFromAll(wp1.player); removeFromAll(wp2.player); - Subserver arena = SubserverSystem.startArena(mode, mode.getRandomMap(), 0, 0, null, null, wp1.player.getUniqueId(), wp2.player.getUniqueId(), true); + Subserver arena = SubserverSystem.startArena(mode, mode.getRandomMap(), 0, 0, 0, null, null, wp1.player.getUniqueId(), wp2.player.getUniqueId(), true); arena.sendPlayer(wp1.player); arena.sendPlayer(wp2.player); diff --git a/src/de/steamwar/bungeecore/comms/PacketIdManager.java b/src/de/steamwar/bungeecore/comms/PacketIdManager.java index ae86d708..8376d591 100644 --- a/src/de/steamwar/bungeecore/comms/PacketIdManager.java +++ b/src/de/steamwar/bungeecore/comms/PacketIdManager.java @@ -24,6 +24,7 @@ public class PacketIdManager { //0x0(X) Standalone Packets public static final byte PING_PACKET = 0x01; public static final byte TABLIST_NAME = 0x02; + public static final byte PREPARE_SCHEM = 0x03; //0x1(X) Bungee Inventory public static final byte INVENTORY_PACKET = 0x10; diff --git a/src/de/steamwar/bungeecore/comms/SpigotReceiver.java b/src/de/steamwar/bungeecore/comms/SpigotReceiver.java index b18b3a04..f87646f1 100644 --- a/src/de/steamwar/bungeecore/comms/SpigotReceiver.java +++ b/src/de/steamwar/bungeecore/comms/SpigotReceiver.java @@ -22,6 +22,7 @@ package de.steamwar.bungeecore.comms; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; import de.steamwar.bungeecore.comms.handlers.InventoryCallbackHandler; +import de.steamwar.bungeecore.comms.handlers.PrepareSchemHandler; import de.steamwar.bungeecore.comms.handlers.TablistNameHandler; import de.steamwar.bungeecore.listeners.BasicListener; import net.md_5.bungee.api.event.PluginMessageEvent; @@ -55,5 +56,6 @@ public class SpigotReceiver extends BasicListener { static { registerHandler(PacketIdManager.INVENTORY_CALLBACK_PACKET, new InventoryCallbackHandler()); registerHandler(PacketIdManager.TABLIST_NAME, new TablistNameHandler()); + registerHandler(PacketIdManager.PREPARE_SCHEM, new PrepareSchemHandler()); } } diff --git a/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java b/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java new file mode 100644 index 00000000..40880a0e --- /dev/null +++ b/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java @@ -0,0 +1,23 @@ +package de.steamwar.bungeecore.comms.handlers; + +import com.google.common.io.ByteArrayDataInput; +import de.steamwar.bungeecore.ArenaMode; +import de.steamwar.bungeecore.SubserverSystem; +import de.steamwar.bungeecore.commands.BauCommand; +import de.steamwar.bungeecore.comms.SpigotHandler; +import de.steamwar.bungeecore.sql.SchematicType; +import de.steamwar.bungeecore.sql.SteamwarUser; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.connection.ProxiedPlayer; + +public class PrepareSchemHandler implements SpigotHandler { + @Override + public void handle(ByteArrayDataInput byteArrayDataInput) { + ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUuid()); + int schematicID = byteArrayDataInput.readInt(); + ArenaMode mode = ArenaMode.getBySchemType(SchematicType.fromDB(byteArrayDataInput.readUTF())); + + BauCommand.stopBauserver(player); + SubserverSystem.startTestServer(player, mode, mode.getRandomMap(), 0, schematicID); + } +} From 1824dda8575280925e314e208628bfc5049c5541 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 19:48:51 +0200 Subject: [PATCH 106/108] Fix license header Signed-off-by: Lixfel --- .../comms/handlers/PrepareSchemHandler.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java b/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java index 40880a0e..46d1a032 100644 --- a/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java +++ b/src/de/steamwar/bungeecore/comms/handlers/PrepareSchemHandler.java @@ -1,3 +1,22 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + package de.steamwar.bungeecore.comms.handlers; import com.google.common.io.ByteArrayDataInput; From 0dcb831142f9068bd26654fc0335f174626dc264 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 30 Mar 2021 20:03:56 +0200 Subject: [PATCH 107/108] Fix missing config Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ArenaMode.java | 6 ++++++ src/de/steamwar/bungeecore/SubserverSystem.java | 1 + 2 files changed, 7 insertions(+) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index b675b8eb..4d5a8689 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -76,6 +76,7 @@ public class ArenaMode { private final String folder; private final List chatNames; private final String serverJar; + private final String config; private final List maps; private final boolean historic; @@ -85,6 +86,7 @@ public class ArenaMode { private ArenaMode(String internalName, Configuration config){ this.folder = config.getString("folder"); this.serverJar = config.getString("serverJar"); + this.config = config.getString("config"); this.maps = config.getStringList("maps"); this.displayName = config.getString("displayName", internalName); if(config.contains("chatNames")) @@ -114,6 +116,10 @@ public class ArenaMode { return serverJar; } + public String getConfig(){ + return config; + } + public String hasMap(String map){ for(String m : maps){ if(m.equalsIgnoreCase(map)) diff --git a/src/de/steamwar/bungeecore/SubserverSystem.java b/src/de/steamwar/bungeecore/SubserverSystem.java index 48985488..8295642c 100644 --- a/src/de/steamwar/bungeecore/SubserverSystem.java +++ b/src/de/steamwar/bungeecore/SubserverSystem.java @@ -120,6 +120,7 @@ public class SubserverSystem { port, "2G", "logPath=" + mapName, + "config="+modus.getConfig(), "fightID=" + eventFightID, "ranked=" + ranked, "checkSchemID=" + checkSchemID, From 29c5dc34075ae41317c8de745f0be1be17ce8814 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 3 Apr 2021 09:06:00 +0200 Subject: [PATCH 108/108] Fix wait for termination Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/ConnectionListener.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index 7f0f88f9..309db1b4 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -30,9 +30,6 @@ import de.steamwar.bungeecore.sql.UserGroup; import net.md_5.bungee.api.AbstractReconnectHandler; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.PlayerDisconnectEvent; @@ -139,6 +136,6 @@ public class ConnectionListener extends BasicListener { ProxiedPlayer player = e.getPlayer(); Collection players = server.getPlayers(); if(players.isEmpty() || (players.size() == 1 && players.contains(player))) - ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), subserver::stop); + ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), subserver::waitForTermination); } }