From 386395725dd1c545b043b27e83e200403884e976 Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Wed, 10 Aug 2022 19:20:33 +0200 Subject: [PATCH 01/26] Add BauLock Add BauCommand.isLocked Add BauLockState Add "BAU_LOCKED" and "BAU_UNLOCKED" in BungeeCore_de.properties Add "Bau_LOCKED" and "BAU_UNLOCKED" in BungeeCore.properties --- .../bungeecore/commands/BauCommand.java | 53 ++++++++++++++++--- src/de/steamwar/bungeecore/sql/BauLock.java | 38 +++++++++++++ .../steamwar/bungeecore/sql/BauLockState.java | 8 +++ .../steamwar/messages/BungeeCore.properties | 3 ++ .../messages/BungeeCore_de.properties | 3 ++ 5 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 src/de/steamwar/bungeecore/sql/BauLock.java create mode 100644 src/de/steamwar/bungeecore/sql/BauLockState.java diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 9f59bf4..fa338ef 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -23,8 +23,7 @@ import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.network.NetworkSender; -import de.steamwar.bungeecore.sql.BauweltMember; -import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.bungeecore.sql.*; import de.steamwar.bungeecore.util.Chat19; import de.steamwar.messages.ChatSender; import de.steamwar.network.packets.server.BaumemberUpdatePacket; @@ -67,7 +66,7 @@ public class BauCommand extends BasicCommand { togglewe(p, args); break; case "toggleworld": - toggleworld(p, args); + toggleWorld(p, args); break; case "delmember": delmember(p, args); @@ -80,6 +79,15 @@ public class BauCommand extends BasicCommand { case "test": testarena(p, args); break; + + case "lock": + setLocked(SteamwarUser.get(p), args); + break; + + case "unlock": + setLocked(SteamwarUser.get(p), new String[]{"", "OPEN"}); + break; + default: HelpCommand.sendBauHelp(ChatSender.of(p)); } @@ -120,10 +128,14 @@ public class BauCommand extends BasicCommand { } SteamwarUser worldOwner = SteamwarUser.get(args[1]); - if (worldOwner == null) { - Message.send("UNKNOWN_PLAYER", p); + SteamwarUser user = SteamwarUser.get(p); + + if(isLocked(worldOwner, user)) { + Message.send("BAU_LOCKED_NOALLOWED", user.getPlayer()); return; - }else if (!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null){ + } + + if ((!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null)){ SubserverSystem.sendDeniedMessage(p, worldOwner.getUuid()); Message.send("BAU_TP_NOALLOWED", p); return; @@ -185,7 +197,7 @@ public class BauCommand extends BasicCommand { isAllowedTo(target.isWorldEdit(), p, target, "BAU_MEMBER_TOGGLE_WORLD_EDIT"); } - private static void toggleworld(ProxiedPlayer p, String[] args){ + private static void toggleWorld(ProxiedPlayer p, String[] args){ BauweltMember target = toggle(p, args, "toggleworld"); if(target == null) return; @@ -307,4 +319,31 @@ public class BauCommand extends BasicCommand { Message.send("BAU_MEMBER_TOGGLE_OFF", p, Message.parse(what, p)); } } + + private static boolean isLocked(SteamwarUser owner, SteamwarUser target) { + if (owner == null) { + Message.send("UNKNOWN_PLAYER", target.getPlayer()); + return true; + } + + BauLockState activeLockState = BauLock.getUserLockState(owner.getId()); + return (activeLockState == BauLockState.TEAM && !(Team.get(owner.getId()) == Team.get(target.getId()))) || activeLockState == BauLockState.ALL; + } + + private static void setLocked(SteamwarUser owner, String[] args) { + + BauLockState newState = BauLockState.OPEN; + if(args[1] != null) { + BauLockState.valueOf(args[1].toUpperCase()); + newState = BauLockState.valueOf(args[1].toUpperCase()); + } + + BauLock.updateUserConfig(owner.getId(), newState); + + String messageKey = "BAU_LOCKED"; + if(newState == BauLockState.OPEN) + messageKey = "BAU_UNLOCKED"; + + Message.send(messageKey, owner.getPlayer()); + } } diff --git a/src/de/steamwar/bungeecore/sql/BauLock.java b/src/de/steamwar/bungeecore/sql/BauLock.java new file mode 100644 index 0000000..4a5f5e1 --- /dev/null +++ b/src/de/steamwar/bungeecore/sql/BauLock.java @@ -0,0 +1,38 @@ +package de.steamwar.bungeecore.sql; + +public class BauLock { + + private static final String configName = "baulockstate"; + + private static final Statement insert = new Statement("INSERT INTO `UserConfig`(`User`, `Config`, `Value`) VALUES (?,?,?)"); + private static final Statement update = new Statement("UPDATE `UserConfig` SET `Value`= ? WHERE 'User' = ? AND 'Config' = ?"); + private static final Statement select = new Statement("SELECT `Value` FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); + private static final Statement selectAll = new Statement("SELECT * FROM `UserConfig` WHERE 'User' = ? AND Config' = ?"); + + public static BauLockState getUserLockState(int userID) { + select.select(rs -> { + if(rs.next()) + return BauLockState.valueOf(rs.getString("Value")); + return BauLockState.OPEN; + }, userID, configName); + return BauLockState.OPEN; + } + + public static void updateUserConfig(int userID, BauLockState state) { + + if(!exists(userID)) { + insert.update(userID, configName, String.valueOf(state)); + }else + update.update(String.valueOf(state), userID, configName); + } + + private static boolean exists(int userID) { + selectAll.select(rs -> { + if(rs.next()) + return rs.getString(1) != null; + return null; + }, userID, configName); + + return false; + } +} diff --git a/src/de/steamwar/bungeecore/sql/BauLockState.java b/src/de/steamwar/bungeecore/sql/BauLockState.java new file mode 100644 index 0000000..7abb02b --- /dev/null +++ b/src/de/steamwar/bungeecore/sql/BauLockState.java @@ -0,0 +1,8 @@ +package de.steamwar.bungeecore.sql; + +public enum BauLockState { + + ALL, // Locks the build server for all users + OPEN, //locks the build server for every user + TEAM //opens the build server only for every added user which is in the same team as the buildOwner +} diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 203618f..ec995b2 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -196,6 +196,9 @@ BAU_ADDMEMBER_ADDED=§aThe player was added to your world. BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. +BAU_LOCKED_NOALLOWED=&cThe buildserver is currently locked. +BAU_LOCKED=&eYou have locked your buildserver. +BAU_UNLOCKED=&eYou have unlocked your buildserver. BAU_DELMEMBER_USAGE=§8/§7build delmember §8[§eplayer§8] BAU_DELMEMBER_SELFDEL=§cYou cannot remove yourself! BAU_DELMEMBER_DELETED=§cPlayer was removed. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 28df9b1..dd2664b 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -180,6 +180,9 @@ 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_LOCKED_NOALLOWED=&cDer Buildserver ist momentan gelocked. +BAU_LOCKED=&eDu hast dein Bau geschlossen. +BAU_UNLOCKED=&eDu hast dein Bau wieder freigegeben. 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. From 19dad58712d0339bbffa192c04e9bc822871126d Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Sat, 13 Aug 2022 21:18:54 +0200 Subject: [PATCH 02/26] Replace BauLock to UserConfig Update BauLockState.ALL to BauLockState.NONE Add "BAU_LOCKED_OPTIONS" in BungeeCore_de.properties Add "BAU_LOCKED_OPTIONS" in BungeeCore.properties --- .../bungeecore/commands/BauCommand.java | 41 +++++++++---------- src/de/steamwar/bungeecore/sql/BauLock.java | 38 ----------------- .../steamwar/bungeecore/sql/BauLockState.java | 6 +-- .../steamwar/bungeecore/sql/UserConfig.java | 38 +++++++++++++++++ .../steamwar/messages/BungeeCore.properties | 6 ++- .../messages/BungeeCore_de.properties | 6 ++- 6 files changed, 69 insertions(+), 66 deletions(-) delete mode 100644 src/de/steamwar/bungeecore/sql/BauLock.java create mode 100644 src/de/steamwar/bungeecore/sql/UserConfig.java diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index fa338ef..20e2e8c 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -81,11 +81,11 @@ public class BauCommand extends BasicCommand { break; case "lock": - setLocked(SteamwarUser.get(p), args); + setLocked(SteamwarUser.get(p), args[1]); break; case "unlock": - setLocked(SteamwarUser.get(p), new String[]{"", "OPEN"}); + setLocked(SteamwarUser.get(p), "OPEN"); break; default: @@ -127,9 +127,15 @@ public class BauCommand extends BasicCommand { return; } + SteamwarUser worldOwner = SteamwarUser.get(args[1]); SteamwarUser user = SteamwarUser.get(p); + if (worldOwner == null) { + Message.send("UNKNOWN_PLAYER", user.getPlayer()); + return; + } + if(isLocked(worldOwner, user)) { Message.send("BAU_LOCKED_NOALLOWED", user.getPlayer()); return; @@ -321,29 +327,22 @@ public class BauCommand extends BasicCommand { } private static boolean isLocked(SteamwarUser owner, SteamwarUser target) { - if (owner == null) { - Message.send("UNKNOWN_PLAYER", target.getPlayer()); - return true; - } + BauLockState activeLockState = UserConfig.getUserLockState(owner.getId()); + if(activeLockState == null) + activeLockState = BauLockState.OPEN; - BauLockState activeLockState = BauLock.getUserLockState(owner.getId()); - return (activeLockState == BauLockState.TEAM && !(Team.get(owner.getId()) == Team.get(target.getId()))) || activeLockState == BauLockState.ALL; + return activeLockState == BauLockState.NONE || (activeLockState == BauLockState.TEAM && !(Team.get(owner.getId()) == Team.get(target.getId()))); } - private static void setLocked(SteamwarUser owner, String[] args) { - - BauLockState newState = BauLockState.OPEN; - if(args[1] != null) { - BauLockState.valueOf(args[1].toUpperCase()); - newState = BauLockState.valueOf(args[1].toUpperCase()); + private static void setLocked(SteamwarUser owner, String arg) { + if(arg == null || BauLockState.valueOf(arg) == null) { + Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer()); + return; } + UserConfig.updateUserConfig(owner.getId(), UserConfig.lockConfigName, arg.toUpperCase()); - BauLock.updateUserConfig(owner.getId(), newState); - - String messageKey = "BAU_LOCKED"; - if(newState == BauLockState.OPEN) - messageKey = "BAU_UNLOCKED"; - - Message.send(messageKey, owner.getPlayer()); + Message.send("BAU_LOCKED_" + arg, owner.getPlayer()); } + + } diff --git a/src/de/steamwar/bungeecore/sql/BauLock.java b/src/de/steamwar/bungeecore/sql/BauLock.java deleted file mode 100644 index 4a5f5e1..0000000 --- a/src/de/steamwar/bungeecore/sql/BauLock.java +++ /dev/null @@ -1,38 +0,0 @@ -package de.steamwar.bungeecore.sql; - -public class BauLock { - - private static final String configName = "baulockstate"; - - private static final Statement insert = new Statement("INSERT INTO `UserConfig`(`User`, `Config`, `Value`) VALUES (?,?,?)"); - private static final Statement update = new Statement("UPDATE `UserConfig` SET `Value`= ? WHERE 'User' = ? AND 'Config' = ?"); - private static final Statement select = new Statement("SELECT `Value` FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); - private static final Statement selectAll = new Statement("SELECT * FROM `UserConfig` WHERE 'User' = ? AND Config' = ?"); - - public static BauLockState getUserLockState(int userID) { - select.select(rs -> { - if(rs.next()) - return BauLockState.valueOf(rs.getString("Value")); - return BauLockState.OPEN; - }, userID, configName); - return BauLockState.OPEN; - } - - public static void updateUserConfig(int userID, BauLockState state) { - - if(!exists(userID)) { - insert.update(userID, configName, String.valueOf(state)); - }else - update.update(String.valueOf(state), userID, configName); - } - - private static boolean exists(int userID) { - selectAll.select(rs -> { - if(rs.next()) - return rs.getString(1) != null; - return null; - }, userID, configName); - - return false; - } -} diff --git a/src/de/steamwar/bungeecore/sql/BauLockState.java b/src/de/steamwar/bungeecore/sql/BauLockState.java index 7abb02b..a3ab254 100644 --- a/src/de/steamwar/bungeecore/sql/BauLockState.java +++ b/src/de/steamwar/bungeecore/sql/BauLockState.java @@ -2,7 +2,7 @@ package de.steamwar.bungeecore.sql; public enum BauLockState { - ALL, // Locks the build server for all users - OPEN, //locks the build server for every user - TEAM //opens the build server only for every added user which is in the same team as the buildOwner + NONE, // Locks the build server for all users + TEAM, //opens the build server only for every added user which is in the same team as the buildOwner + OPEN //unlocks the build server for all users } diff --git a/src/de/steamwar/bungeecore/sql/UserConfig.java b/src/de/steamwar/bungeecore/sql/UserConfig.java new file mode 100644 index 0000000..3e962ac --- /dev/null +++ b/src/de/steamwar/bungeecore/sql/UserConfig.java @@ -0,0 +1,38 @@ +package de.steamwar.bungeecore.sql; + +import java.util.UUID; + +public class UserConfig { + + public static final String lockConfigName = "baulockstate"; + + private static final Statement insert = new Statement("INSERT INTO `UserConfig`(`User`, `Config`, `Value`) VALUES (?,?,?)"); + private static final Statement update = new Statement("UPDATE `UserConfig` SET `Value`= ? WHERE 'User' = ? AND 'Config' = ?"); + private static final Statement select = new Statement("SELECT `Value` FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); + private static final Statement delete = new Statement("DELETE FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); + + public static BauLockState getUserLockState(int userID) { + return BauLockState.valueOf(getConfig(userID, lockConfigName)); + } + + public static String getConfig(int userID, String config) { + return select.select(rs -> { + if(rs.next()) + return rs.getString("Value"); + return null; + }, userID, config); + } + + public static void updateUserConfig(int userID, String config, String value) { + + if (getConfig(userID, config) == null) { + insert.update(userID, config, value); + } else { + update.update(value, config, config); + } + } + + public static void removePlayerEntry(int userID, String config) { + delete.update(userID, config); + } +} diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index ec995b2..706d637 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -197,8 +197,10 @@ BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. BAU_LOCKED_NOALLOWED=&cThe buildserver is currently locked. -BAU_LOCKED=&eYou have locked your buildserver. -BAU_UNLOCKED=&eYou have unlocked your buildserver. +BAU_LOCKED_OPTIONS=§eBuildserver lock options: none, team, open. +BAU_LOCKED_NONE=§eYou have closed your buildserver to all players. +BAU_LOCKED_TEAM=§eYou've closed your buildserver to all beside added team members. +BAU_LOCKED_OPEN=§eYou have reopened your build for all added players. BAU_DELMEMBER_USAGE=§8/§7build delmember §8[§eplayer§8] BAU_DELMEMBER_SELFDEL=§cYou cannot remove yourself! BAU_DELMEMBER_DELETED=§cPlayer was removed. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index dd2664b..6775060 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -181,8 +181,10 @@ 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_LOCKED_NOALLOWED=&cDer Buildserver ist momentan gelocked. -BAU_LOCKED=&eDu hast dein Bau geschlossen. -BAU_UNLOCKED=&eDu hast dein Bau wieder freigegeben. +BAU_LOCKED_OPTIONS=§eBuildserver lock optionen: none, team, open. +BAU_LOCKED_NONE=§eDu hast dein Bau für alle Spieler geschlossen. +BAU_LOCKED_TEAM=§eDu hast dein Bau für alle außer hinzugefügte Teammitglieder geschlossen. +BAU_LOCKED_OPEN=§eDu hast dein Bau für alle hinzugefügten Spieler wieder geöffnet. 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. From 39b63198d50883400ef1eb4f67bca782cfff0ce2 Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Sat, 13 Aug 2022 22:23:29 +0200 Subject: [PATCH 03/26] Add BungeeCore_de.properties "BAU_LOCKED_OPTIONS" Color correction Add BungeeCore.properties "BAU_LOCKED_OPTIONS" Color correction --- src/de/steamwar/messages/BungeeCore.properties | 2 +- src/de/steamwar/messages/BungeeCore_de.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 706d637..1a47099 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -197,7 +197,7 @@ BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. BAU_LOCKED_NOALLOWED=&cThe buildserver is currently locked. -BAU_LOCKED_OPTIONS=§eBuildserver lock options: none, team, open. +BAU_LOCKED_OPTIONS=§eBuildserver lock options: §cnone§8, §eteam§8, §aopen§8. BAU_LOCKED_NONE=§eYou have closed your buildserver to all players. BAU_LOCKED_TEAM=§eYou've closed your buildserver to all beside added team members. BAU_LOCKED_OPEN=§eYou have reopened your build for all added players. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 6775060..25742f2 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -181,7 +181,7 @@ 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_LOCKED_NOALLOWED=&cDer Buildserver ist momentan gelocked. -BAU_LOCKED_OPTIONS=§eBuildserver lock optionen: none, team, open. +BAU_LOCKED_OPTIONS=§eBuildserver lock optionen: §cnone§8, §eteam§8, §aopen§8. BAU_LOCKED_NONE=§eDu hast dein Bau für alle Spieler geschlossen. BAU_LOCKED_TEAM=§eDu hast dein Bau für alle außer hinzugefügte Teammitglieder geschlossen. BAU_LOCKED_OPEN=§eDu hast dein Bau für alle hinzugefügten Spieler wieder geöffnet. From c2211bdedfe792a90ace9d92003d98e9536bbc5c Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Sun, 14 Aug 2022 00:11:18 +0200 Subject: [PATCH 04/26] Add HelCommand for /bau lock Add HelCommand for /bau unlock --- src/de/steamwar/bungeecore/commands/HelpCommand.java | 4 +++- src/de/steamwar/messages/BungeeCore.properties | 4 ++++ src/de/steamwar/messages/BungeeCore_de.properties | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index 7bcce92..87bfe36 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -101,7 +101,9 @@ public class HelpCommand extends BasicCommand { "HELP_BAU_TOGGLEWE", "/bau togglewe ", "HELP_BAU_TOGGLEWORLD", "/bau toggleworld ", "HELP_BAU_DELETE", "/bau delete ", - "HELP_BAU_TESTARENA", "/bau testarena "); + "HELP_BAU_TESTARENA", "/bau testarena ", + "HELP_BAU_LOCK", "/bau lock", + "HELP_BAU_UNLOCK", "/bau unlock"); } private static void printPage(ChatSender sender, ClickEvent.Action action, String... args) { diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 1a47099..d8c607d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -99,6 +99,10 @@ HELP_BAU_DELETE=§8/§ebuild delete §8- §7Reset your entire build server HELP_BAU_DELETE_HOVER=§eReset build server HELP_BAU_TESTARENA=§8/§ebuild testarena §8- §7Start a test arena HELP_BAU_TESTARENA_HOVER=§eStart test arena +HELP_BAU_LOCK=§8/§ebuild lock §8- §7Locks the buildserver for customized group of players. +HELP_BAU_LOCK_HOVER=§eLock the build +HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7Unlocks the buildserver for all added user. +HELP_BAU_UNLOCK_HOVER=§eUnlock the build #Usage description of various commands USAGE_ALERT=§8/§7alert §8[§emessage§8] diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 25742f2..0eca3d7 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -38,6 +38,10 @@ HELP_JOIN=§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei! HELP_JOIN_HOVER=§eSpieler beitreten HELP_LOCAL=§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server! HELP_LOCAL_HOVER=§eLokaler Chat +HELP_BAU_LOCK=§8/§ebuild lock §8- §7Schließe den Bauserver für bestimmte Spieler. +HELP_BAU_LOCK_HOVER=§eSchließe deinen bau +HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7SÖffne den Bauserver für alle vertrauten Spieler. +HELP_BAU_UNLOCK_HOVER=§eÖffne deinen bau HELP_TNT=§8/§7tnt §8- §7(de)aktiviert Explosionsschaden HELP_FIRE=§8/§7fire §8- §7(de)aktiviert Feuerschaden @@ -181,7 +185,7 @@ 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_LOCKED_NOALLOWED=&cDer Buildserver ist momentan gelocked. -BAU_LOCKED_OPTIONS=§eBuildserver lock optionen: §cnone§8, §eteam§8, §aopen§8. +BAU_LOCKED_OPTIONS=§eBauserver schließ optionen: §cnone§8, §eteam§8, §aopen§8. BAU_LOCKED_NONE=§eDu hast dein Bau für alle Spieler geschlossen. BAU_LOCKED_TEAM=§eDu hast dein Bau für alle außer hinzugefügte Teammitglieder geschlossen. BAU_LOCKED_OPEN=§eDu hast dein Bau für alle hinzugefügten Spieler wieder geöffnet. From ef6435b176c2052ef7c6c3124c5d215cf95bd128 Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Fri, 2 Sep 2022 14:27:27 +0200 Subject: [PATCH 05/26] +Fix BauCommand.setLocked +Fix BauCommand.isLocked +Update BauLockState.NONE to BauLockState.NOBODY +Move Userconfig.getUserLockState to BauCommand --- .../bungeecore/commands/BauCommand.java | 24 ++++++++++++------- .../steamwar/bungeecore/sql/BauLockState.java | 2 +- .../steamwar/bungeecore/sql/UserConfig.java | 7 ------ .../steamwar/messages/BungeeCore.properties | 6 ++--- .../messages/BungeeCore_de.properties | 12 +++++----- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 20e2e8c..d6f4df8 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -81,11 +81,11 @@ public class BauCommand extends BasicCommand { break; case "lock": - setLocked(SteamwarUser.get(p), args[1]); + setLocked(SteamwarUser.get(p), args); break; case "unlock": - setLocked(SteamwarUser.get(p), "OPEN"); + setLocked(SteamwarUser.get(p), new String[]{"", "open"}); break; default: @@ -327,22 +327,28 @@ public class BauCommand extends BasicCommand { } private static boolean isLocked(SteamwarUser owner, SteamwarUser target) { - BauLockState activeLockState = UserConfig.getUserLockState(owner.getId()); + BauLockState activeLockState = getUserLockState(owner.getId()); if(activeLockState == null) activeLockState = BauLockState.OPEN; - return activeLockState == BauLockState.NONE || (activeLockState == BauLockState.TEAM && !(Team.get(owner.getId()) == Team.get(target.getId()))); + return activeLockState == BauLockState.NOBODY || (activeLockState == BauLockState.TEAM && owner.getTeam() == target.getTeam()); } - private static void setLocked(SteamwarUser owner, String arg) { - if(arg == null || BauLockState.valueOf(arg) == null) { + private static final String bauLockConfigName = "baulockstate"; + + private static void setLocked(SteamwarUser owner, String[] args) { + if(args.length < 2 || BauLockState.valueOf(args[1]) == null) { Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer()); return; } - UserConfig.updateUserConfig(owner.getId(), UserConfig.lockConfigName, arg.toUpperCase()); - Message.send("BAU_LOCKED_" + arg, owner.getPlayer()); + String lockState = args[1].toUpperCase(); + UserConfig.updateUserConfig(owner.getId(), bauLockConfigName, lockState); + + Message.send("BAU_LOCKED_" + lockState, owner.getPlayer()); } - + private static BauLockState getUserLockState(int userID) { + return BauLockState.valueOf(UserConfig.getConfig(userID, bauLockConfigName)); + } } diff --git a/src/de/steamwar/bungeecore/sql/BauLockState.java b/src/de/steamwar/bungeecore/sql/BauLockState.java index a3ab254..0d1a325 100644 --- a/src/de/steamwar/bungeecore/sql/BauLockState.java +++ b/src/de/steamwar/bungeecore/sql/BauLockState.java @@ -2,7 +2,7 @@ package de.steamwar.bungeecore.sql; public enum BauLockState { - NONE, // Locks the build server for all users + NOBODY, // Locks the build server for all users TEAM, //opens the build server only for every added user which is in the same team as the buildOwner OPEN //unlocks the build server for all users } diff --git a/src/de/steamwar/bungeecore/sql/UserConfig.java b/src/de/steamwar/bungeecore/sql/UserConfig.java index 3e962ac..44e02c4 100644 --- a/src/de/steamwar/bungeecore/sql/UserConfig.java +++ b/src/de/steamwar/bungeecore/sql/UserConfig.java @@ -3,18 +3,11 @@ package de.steamwar.bungeecore.sql; import java.util.UUID; public class UserConfig { - - public static final String lockConfigName = "baulockstate"; - private static final Statement insert = new Statement("INSERT INTO `UserConfig`(`User`, `Config`, `Value`) VALUES (?,?,?)"); private static final Statement update = new Statement("UPDATE `UserConfig` SET `Value`= ? WHERE 'User' = ? AND 'Config' = ?"); private static final Statement select = new Statement("SELECT `Value` FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); private static final Statement delete = new Statement("DELETE FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); - public static BauLockState getUserLockState(int userID) { - return BauLockState.valueOf(getConfig(userID, lockConfigName)); - } - public static String getConfig(int userID, String config) { return select.select(rs -> { if(rs.next()) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index d8c607d..1c0839d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -200,9 +200,9 @@ BAU_ADDMEMBER_ADDED=§aThe player was added to your world. BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. -BAU_LOCKED_NOALLOWED=&cThe buildserver is currently locked. -BAU_LOCKED_OPTIONS=§eBuildserver lock options: §cnone§8, §eteam§8, §aopen§8. -BAU_LOCKED_NONE=§eYou have closed your buildserver to all players. +BAU_LOCKED_NOALLOWED=&cThe build server is currently locked. +BAU_LOCKED_OPTIONS=§eBuild server lock options: §cnone§8, §eteam§8, §aopen§8. +BAU_LOCKED_NOBODY=§eYou have closed your buildserver to all players. BAU_LOCKED_TEAM=§eYou've closed your buildserver to all beside added team members. BAU_LOCKED_OPEN=§eYou have reopened your build for all added players. BAU_DELMEMBER_USAGE=§8/§7build delmember §8[§eplayer§8] diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 0eca3d7..1a1725a 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -38,8 +38,8 @@ HELP_JOIN=§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei! HELP_JOIN_HOVER=§eSpieler beitreten HELP_LOCAL=§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server! HELP_LOCAL_HOVER=§eLokaler Chat -HELP_BAU_LOCK=§8/§ebuild lock §8- §7Schließe den Bauserver für bestimmte Spieler. -HELP_BAU_LOCK_HOVER=§eSchließe deinen bau +HELP_BAU_LOCK=§8/§ebuild lock §8- §7Sperre dein Bauserver für bestimmte Spieler. +HELP_BAU_LOCK_HOVER=§eSperre deinen bau HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7SÖffne den Bauserver für alle vertrauten Spieler. HELP_BAU_UNLOCK_HOVER=§eÖffne deinen bau @@ -184,10 +184,10 @@ 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_LOCKED_NOALLOWED=&cDer Buildserver ist momentan gelocked. -BAU_LOCKED_OPTIONS=§eBauserver schließ optionen: §cnone§8, §eteam§8, §aopen§8. -BAU_LOCKED_NONE=§eDu hast dein Bau für alle Spieler geschlossen. -BAU_LOCKED_TEAM=§eDu hast dein Bau für alle außer hinzugefügte Teammitglieder geschlossen. +BAU_LOCKED_NOALLOWED=&cDer Bauserver ist momentan gesperrt. +BAU_LOCKED_OPTIONS=§eBauserver sperr optionen: §cnone§8, §eteam§8, §aopen§8. +BAU_LOCKED_NOBODY=§eDu hast dein Bau für alle Spieler geschlossen. +BAU_LOCKED_TEAM=§eDu hast dein Bau für alle außer hinzugefügte Teammitglieder gesperrt. BAU_LOCKED_OPEN=§eDu hast dein Bau für alle hinzugefügten Spieler wieder geöffnet. BAU_DELMEMBER_USAGE=§8/§7bau delmember §8[§eSpieler§8] BAU_DELMEMBER_SELFDEL=§cDu kannst dich nicht selbst entfernen! From 3d958800fce3ca8f8c52ea41f9b049db4b427e1d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 8 Sep 2022 17:29:25 +0200 Subject: [PATCH 06/26] Remove sorted checker in fabric Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/mods/Fabric.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java index b2b949f..c244de2 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Fabric.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Fabric.java @@ -41,7 +41,6 @@ import java.nio.charset.UnsupportedCharsetException; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.logging.Level; -import java.util.stream.Collectors; public class Fabric extends BasicListener { @@ -124,12 +123,14 @@ public class Fabric extends BasicListener { mods.add(Mod.get(mod.getAsString(), Mod.Platform.FABRIC)); } + /* boolean isSorted = isSortedAlphabetically(mods); if(!isSorted) { banPlayer(user, player, "Mods are not sorted alphabetically: " + mods.stream().map(Mod::getModName).collect(Collectors.joining(", "))); return; } + */ if(!neededModsContained(mods)) { banPlayer(user, player, "Needed mods are not contained"); From e3e68af80fd5b1bacae27fc6bbadedc725bdf462 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 8 Sep 2022 18:24:31 +0200 Subject: [PATCH 07/26] Hotfix ServerTeamchatCommand --- .../bungeecore/commands/ServerTeamchatCommand.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java index ea4ce9f..e22c68f 100644 --- a/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java +++ b/src/de/steamwar/bungeecore/commands/ServerTeamchatCommand.java @@ -31,13 +31,7 @@ public class ServerTeamchatCommand extends SWCommand { } @Register(description = "STC_USAGE") - public void genericCommand(CommandSender commandSender, String... message) { - ChatSender sender = ChatSender.of(commandSender); - if(message.length == 0) { - sender.system("STC_USAGE"); - return; - } - - ChatListener.sendChat(sender, ChatSender.serverteamReceivers(), "CHAT_SERVERTEAM", null, String.join(" ", message)); + public void genericCommand(CommandSender commandSender, @ErrorMessage(value = "STC_USAGE", allowEAs = false) String... message) { + ChatListener.sendChat(ChatSender.of(commandSender), ChatSender.serverteamReceivers(), "CHAT_SERVERTEAM", null, String.join(" ", message)); } } From 42898b0d4dfc1765c9e6406be52de5a875e227b1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 8 Sep 2022 19:45:20 +0200 Subject: [PATCH 08/26] Hotfix npe --- src/de/steamwar/bungeecore/commands/TypeMappers.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/bungeecore/commands/TypeMappers.java b/src/de/steamwar/bungeecore/commands/TypeMappers.java index f1927e3..94b27e4 100644 --- a/src/de/steamwar/bungeecore/commands/TypeMappers.java +++ b/src/de/steamwar/bungeecore/commands/TypeMappers.java @@ -88,6 +88,7 @@ public class TypeMappers { public Collection tabCompletes(CommandSender sender, String[] previousArguments, String s) { if (previousArguments.length == 0) return null; ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]); + if (arenaMode == null) return null; List stringList = new ArrayList<>(arenaMode.getMaps()); stringList.add("random"); return stringList; From fe0d0eaffb4ae69ca089f8c4675823bc29fcffc1 Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:49:17 +0200 Subject: [PATCH 09/26] +Add Owner message when bau is locked for Team --- .../bungeecore/commands/BauCommand.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index d6f4df8..84d524d 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -29,6 +29,7 @@ import de.steamwar.messages.ChatSender; import de.steamwar.network.packets.server.BaumemberUpdatePacket; 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.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -81,11 +82,16 @@ public class BauCommand extends BasicCommand { break; case "lock": - setLocked(SteamwarUser.get(p), args); + if(!(args.length < 2)) { + Message.send("BAU_LOCKED_OPTIONS", p); + return; + } + + setLocked(SteamwarUser.get(p), args[1]); break; case "unlock": - setLocked(SteamwarUser.get(p), new String[]{"", "open"}); + setLocked(SteamwarUser.get(p), "open"); break; default: @@ -127,7 +133,6 @@ public class BauCommand extends BasicCommand { return; } - SteamwarUser worldOwner = SteamwarUser.get(args[1]); SteamwarUser user = SteamwarUser.get(p); @@ -331,18 +336,21 @@ public class BauCommand extends BasicCommand { if(activeLockState == null) activeLockState = BauLockState.OPEN; + if(activeLockState == BauLockState.TEAM) + SubserverSystem.sendDeniedMessage(target.getPlayer(), owner.getUuid()); + return activeLockState == BauLockState.NOBODY || (activeLockState == BauLockState.TEAM && owner.getTeam() == target.getTeam()); } private static final String bauLockConfigName = "baulockstate"; - private static void setLocked(SteamwarUser owner, String[] args) { - if(args.length < 2 || BauLockState.valueOf(args[1]) == null) { + private static void setLocked(SteamwarUser owner, String arg) { + if(BauLockState.valueOf(arg) == null) { Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer()); return; } - String lockState = args[1].toUpperCase(); + String lockState = arg.toUpperCase(); UserConfig.updateUserConfig(owner.getId(), bauLockConfigName, lockState); Message.send("BAU_LOCKED_" + lockState, owner.getPlayer()); From 9a5b938fba2aa15b1c99425fc975580d2a56083d Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Thu, 8 Sep 2022 21:28:21 +0200 Subject: [PATCH 10/26] +Fixed Owner message when locked --- src/de/steamwar/bungeecore/commands/BauCommand.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 84d524d..6a4e4a6 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -147,9 +147,7 @@ public class BauCommand extends BasicCommand { } if ((!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null)){ - SubserverSystem.sendDeniedMessage(p, worldOwner.getUuid()); - Message.send("BAU_TP_NOALLOWED", p); - return; + } versionSelector(p, args, 2, @@ -336,8 +334,10 @@ public class BauCommand extends BasicCommand { if(activeLockState == null) activeLockState = BauLockState.OPEN; - if(activeLockState == BauLockState.TEAM) + if((!target.getUuid().equals(owner.getUuid()) && BauweltMember.getBauMember(owner.getId(), target.getId()) == null) && !(activeLockState == BauLockState.NOBODY)) { SubserverSystem.sendDeniedMessage(target.getPlayer(), owner.getUuid()); + Message.send("BAU_TP_NOALLOWED", target.getPlayer()); + } return activeLockState == BauLockState.NOBODY || (activeLockState == BauLockState.TEAM && owner.getTeam() == target.getTeam()); } From d4cd8a16a06a6ca54c8ad1bdc1dbcc4787d8e4cc Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Thu, 8 Sep 2022 21:32:41 +0200 Subject: [PATCH 11/26] +Removed not used if statement --- src/de/steamwar/bungeecore/commands/BauCommand.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 6a4e4a6..228aba4 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -146,10 +146,6 @@ public class BauCommand extends BasicCommand { return; } - if ((!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null)){ - - } - versionSelector(p, args, 2, () -> new ServerStarter().build19(worldOwner.getUuid()).send(p).start(), () -> new ServerStarter().build15(worldOwner.getUuid()).send(p).start(), From 6ab0d3d9832f2dfaa09f1699be7468b507b16f37 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 9 Sep 2022 08:40:49 +0200 Subject: [PATCH 12/26] Remove could not decode from ErrorLogger Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/ErrorLogger.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/ErrorLogger.java b/src/de/steamwar/bungeecore/ErrorLogger.java index ef80a0b..2ac83ae 100644 --- a/src/de/steamwar/bungeecore/ErrorLogger.java +++ b/src/de/steamwar/bungeecore/ErrorLogger.java @@ -33,7 +33,6 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; public class ErrorLogger extends Handler { - private int ddosRate = 0; ErrorLogger(){ Logger.getLogger("").addHandler(this); @@ -57,12 +56,7 @@ public class ErrorLogger extends Handler { if(logRecord.getThrown() != null) logRecord.getThrown().printStackTrace(new PrintStream(stacktraceOutput)); String stacktrace = stacktraceOutput.toString(); - if(stacktrace.contains("Cannot request protocol")) { - if(++ddosRate % 1000 == 0) { - SWException.log("Bungee", "DDOS", ddosRate + ""); - } - return; - } else if (stacktrace.contains("ErrorLogger")) { + if (stacktrace.contains("ErrorLogger")) { return; } @@ -86,6 +80,7 @@ public class ErrorLogger extends Handler { List contains = new ArrayList<>(); contains.add("Error authenticating "); contains.add("read timed out"); + contains.add("could not decode packet"); contains.add("Connection reset by peer"); contains.add("No client connected for pending server"); contains.add("Error occurred processing connection for"); From 9e579ee3d69107ccdd0010d17ff5c3c68c27e84d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 9 Sep 2022 16:11:34 +0200 Subject: [PATCH 13/26] Hotfix case sensitive maps --- src/de/steamwar/bungeecore/ArenaMode.java | 6 ++++++ src/de/steamwar/bungeecore/commands/TypeMappers.java | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/ArenaMode.java b/src/de/steamwar/bungeecore/ArenaMode.java index 9057691..abb6b77 100644 --- a/src/de/steamwar/bungeecore/ArenaMode.java +++ b/src/de/steamwar/bungeecore/ArenaMode.java @@ -94,6 +94,7 @@ public class ArenaMode { private final String serverJar; private final String config; private final List maps; + private final Map lowerToRealMapNames = new HashMap<>(); private final boolean historic; private final String internalName; @@ -106,6 +107,7 @@ public class ArenaMode { this.serverJar = config.getString("Server.ServerJar"); this.config = internalName + ".yml"; this.maps = config.getStringList("Server.Maps"); + maps.forEach(map -> lowerToRealMapNames.put(map.toLowerCase(), map)); this.displayName = config.getString("GameName", internalName); this.chatNames = config.getStringList("Server.ChatNames"); this.schemType = config.getString("Schematic.Type", "").toLowerCase(); @@ -155,6 +157,10 @@ public class ArenaMode { return maps; } + public String convertToRealMapName(String map){ + return lowerToRealMapNames.get(map.toLowerCase()); + } + public String getChatName(){ return chatNames.get(0); } diff --git a/src/de/steamwar/bungeecore/commands/TypeMappers.java b/src/de/steamwar/bungeecore/commands/TypeMappers.java index 94b27e4..97c510b 100644 --- a/src/de/steamwar/bungeecore/commands/TypeMappers.java +++ b/src/de/steamwar/bungeecore/commands/TypeMappers.java @@ -80,8 +80,7 @@ public class TypeMappers { if (previousArguments.length == 0) return null; if (s.equalsIgnoreCase("random")) return "random"; ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]); - if (arenaMode.getMaps().contains(s)) return s; - return null; + return arenaMode.convertToRealMapName(s); } @Override From eee3dba1de096b960efc1465c882214e43b237f9 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Fri, 9 Sep 2022 16:35:05 +0200 Subject: [PATCH 14/26] Simplify arena map typemapper --- src/de/steamwar/bungeecore/commands/TypeMappers.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TypeMappers.java b/src/de/steamwar/bungeecore/commands/TypeMappers.java index 97c510b..3539a0d 100644 --- a/src/de/steamwar/bungeecore/commands/TypeMappers.java +++ b/src/de/steamwar/bungeecore/commands/TypeMappers.java @@ -79,8 +79,7 @@ public class TypeMappers { public String map(CommandSender commandSender, String[] previousArguments, String s) { if (previousArguments.length == 0) return null; if (s.equalsIgnoreCase("random")) return "random"; - ArenaMode arenaMode = ArenaMode.getByChat(previousArguments[previousArguments.length - 1]); - return arenaMode.convertToRealMapName(s); + return ArenaMode.getByChat(previousArguments[previousArguments.length - 1]).convertToRealMapName(s); } @Override From d7530cae86b4da15d949f37f00e02de3e6451d2a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 9 Sep 2022 20:38:37 +0200 Subject: [PATCH 15/26] Add current infos to Whois --- .../bungeecore/commands/WhoisCommand.java | 18 +++++++++++++++--- src/de/steamwar/messages/BungeeCore.properties | 4 ++++ .../steamwar/messages/BungeeCore_de.properties | 4 ++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index 9e25ad2..2aea258 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.Message; +import de.steamwar.bungeecore.Storage; import de.steamwar.bungeecore.sql.Punishment; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.Team; @@ -31,8 +32,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.net.InetSocketAddress; import java.sql.Timestamp; import java.text.DecimalFormat; +import java.time.Instant; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -78,15 +81,24 @@ public class WhoisCommand extends SWCommand { 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_GROUP", player, user.getUserGroup().getColorCode(), user.getUserGroup().name()); if (user.getDiscordId() != null) { Message.send("WHOIS_DISCORD_ID", player, user.getDiscordId()); } Timestamp firstJoin = user.getFirstjoin(); - if (firstJoin == null) + if (firstJoin == null) { Message.send("WHOIS_JOINED_FIRST", player, "0000-00-00 00:00:00"); - else + } else { Message.send("WHOIS_JOINED_FIRST", player, firstJoin.toString()); - Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); + } + Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / 3600d)); + + if(BungeeCord.getInstance().getPlayer(user.getUuid()) != null) { + ProxiedPlayer target = BungeeCord.getInstance().getPlayer(user.getUuid()); + Message.send("WHOIS_CURRENT_PLAYED", player, new DecimalFormat("####.##").format(Instant.now().getEpochSecond() - Storage.sessions.get(target).toInstant().getEpochSecond() / 60d)); + Message.send("WHOIS_CURRENT_SERVER", player, target.getServer().getInfo().getName()); + Message.send("WHOIS_CURRENT_PROTOCOL", player, target.getPendingConnection().getVersion()); + } Team team = Team.get(user.getTeam()); 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()); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9872dfe..394e4ea 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -574,9 +574,13 @@ WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eCopy UUID WHOIS_ID=§7ID§8: §e{0} +WHOIS_GROUP=§7Group§8: §{0}{1} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_JOINED_FIRST=§7Joined on§8: §e{0} WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h +WHOIS_CURRENT_PLAYED=§7Current Online Time§8: §e{0}m +WHOIS_CURRENT_SERVER=§7Current Server§8: §e{0} +WHOIS_CURRENT_PROTOCOL=§7Current Protocol§8: §e{0} WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2} WHOIS_TEAM_HOVER=§eShow {0} WHOIS_PUNISHMENTS=§7Punish: diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index e0341a7..aff7e1f 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -550,12 +550,16 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen. #WhoisCommand WHOIS_USAGE=§c/whois [Spieler/ID] <-a> WHOIS_USERNAME=§7Username§8: §e{0} +WHOIS_GROUP=§7Gruppe§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eUUID Kopieren WHOIS_ID=§7ID§8: §e{0} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_JOINED_FIRST=§7Beigetreten am§8: §e{0} WHOIS_HOURS_PLAYED=§7Spielzeit§8: §e{0}h +WHOIS_CURRENT_PLAYED=§7Aktuell online§8: §e{0}m +WHOIS_CURRENT_SERVER=§7Aktueller Server§8: §e{0} +WHOIS_CURRENT_PROTOCOL=§7Aktuelle Version§8: §e{0} WHOIS_TEAM=§7Team§8: §e[§{0}{1}§e] {2} WHOIS_TEAM_HOVER=§e{0} anzeigen WHOIS_PUNISHMENTS=§7Strafen: From 1af7b0398731ea3f6d134beb363b648c3844b6e3 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 11 Sep 2022 15:28:37 +0200 Subject: [PATCH 16/26] Bump JDA & close Inpustream --- build.gradle | 2 +- .../bungeecore/bot/listeners/PrivateMessageListener.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index dd9ed88..789fc21 100644 --- a/build.gradle +++ b/build.gradle @@ -97,7 +97,7 @@ dependencies { compileOnly 'de.steamwar:waterfall:RELEASE' compileOnly 'de.steamwar:persistentbungeecore:RELEASE' - implementation("net.dv8tion:JDA:4.3.0_299") { + implementation("net.dv8tion:JDA:4.4.0_352") { exclude module: 'opus-java' } diff --git a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java index 8f55731..c458e07 100644 --- a/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java +++ b/src/de/steamwar/bungeecore/bot/listeners/PrivateMessageListener.java @@ -25,6 +25,9 @@ import de.steamwar.bungeecore.sql.SteamwarUser; import net.dv8tion.jda.api.entities.Message; import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent; +import java.io.InputStream; +import java.util.concurrent.CompletableFuture; + public class PrivateMessageListener extends BasicDiscordListener { @Override @@ -63,7 +66,9 @@ public class PrivateMessageListener extends BasicDiscordListener { } try { - node.saveFromStream(attachment.retrieveInputStream().get(), newFormat); + InputStream in = attachment.retrieveInputStream().get(); + node.saveFromStream(in, newFormat); + in.close(); event.getMessage().reply("`" + name + "` wurde erfolgreich hochgeladen").queue(); } catch (Exception e) { event.getMessage().reply("`" + name + "` konnte nicht hochgeladen werden, bitte versuche es später nochmal oder wende dich an einen Developer").queue(); From 3e1d60245a94c639299de39f408afd40ba4dad90 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Sep 2022 18:08:42 +0200 Subject: [PATCH 17/26] Fix fatal issues Signed-off-by: Lixfel --- CommonCore | 2 +- .../bungeecore/commands/BauCommand.java | 67 +++++++++---------- .../steamwar/bungeecore/sql/BauLockState.java | 19 ++++++ .../steamwar/bungeecore/sql/UserConfig.java | 43 ++++++++---- .../steamwar/messages/BungeeCore.properties | 14 ++-- .../messages/BungeeCore_de.properties | 12 ++-- 6 files changed, 94 insertions(+), 63 deletions(-) diff --git a/CommonCore b/CommonCore index 9df9259..c1e175c 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit 9df92595b2f344585bd3e1639cedc761680b7761 +Subproject commit c1e175c3e84280c160ae5c7f84e44805f159bbf3 diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index dbfa423..43ad0bd 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -23,13 +23,15 @@ import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.network.NetworkSender; -import de.steamwar.bungeecore.sql.*; +import de.steamwar.bungeecore.sql.BauLockState; +import de.steamwar.bungeecore.sql.BauweltMember; +import de.steamwar.bungeecore.sql.SteamwarUser; +import de.steamwar.bungeecore.sql.UserConfig; import de.steamwar.bungeecore.util.Chat19; import de.steamwar.messages.ChatSender; import de.steamwar.network.packets.server.BaumemberUpdatePacket; 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.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -67,7 +69,7 @@ public class BauCommand extends BasicCommand { togglewe(p, args); break; case "toggleworld": - toggleWorld(p, args); + toggleworld(p, args); break; case "delmember": delmember(p, args); @@ -82,7 +84,7 @@ public class BauCommand extends BasicCommand { break; case "lock": - if(!(args.length < 2)) { + if(args.length < 2) { Message.send("BAU_LOCKED_OPTIONS", p); return; } @@ -134,22 +136,20 @@ public class BauCommand extends BasicCommand { } SteamwarUser worldOwner = SteamwarUser.get(args[1]); - SteamwarUser user = SteamwarUser.get(p); if (worldOwner == null) { - Message.send("UNKNOWN_PLAYER", user.getPlayer()); + 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()); + Message.send("BAU_TP_NOALLOWED", p); } - if(isLocked(worldOwner, user)) { - Message.send("BAU_LOCKED_NOALLOWED", user.getPlayer()); + if(isLocked(worldOwner, SteamwarUser.get(p))) { + Message.send("BAU_LOCKED_NOALLOWED", p); return; } - if ((!p.getUniqueId().equals(worldOwner.getUuid()) && BauweltMember.getBauMember(worldOwner.getUuid(), p.getUniqueId()) == null)){ - - } - versionSelector(p, args, 2, () -> new ServerStarter().build19(worldOwner.getUuid()).send(p).start(), () -> new ServerStarter().build15(worldOwner.getUuid()).send(p).start(), @@ -206,7 +206,7 @@ public class BauCommand extends BasicCommand { isAllowedTo(target.isWorldEdit(), p, target, "BAU_MEMBER_TOGGLE_WORLD_EDIT"); } - private static void toggleWorld(ProxiedPlayer p, String[] args){ + private static void toggleworld(ProxiedPlayer p, String[] args){ BauweltMember target = toggle(p, args, "toggleworld"); if(target == null) return; @@ -329,34 +329,31 @@ public class BauCommand extends BasicCommand { } } - private static boolean isLocked(SteamwarUser owner, SteamwarUser target) { - BauLockState activeLockState = getUserLockState(owner.getId()); - if(activeLockState == null) - activeLockState = BauLockState.OPEN; - - if((!target.getUuid().equals(owner.getUuid()) && BauweltMember.getBauMember(owner.getId(), target.getId()) == null) && !(activeLockState == BauLockState.NOBODY)) { - SubserverSystem.sendDeniedMessage(target.getPlayer(), owner.getUuid()); - Message.send("BAU_TP_NOALLOWED", target.getPlayer()); - } - - return activeLockState == BauLockState.NOBODY || (activeLockState == BauLockState.TEAM && owner.getTeam() == target.getTeam()); - } - - private static final String bauLockConfigName = "baulockstate"; - + private static final String BAU_LOCK_CONFIG_NAME = "baulockstate"; private static void setLocked(SteamwarUser owner, String arg) { - if(BauLockState.valueOf(arg) == null) { + BauLockState state; + try { + state = BauLockState.valueOf(arg); + } catch (IllegalStateException e) { Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer()); return; } - String lockState = arg.toUpperCase(); - UserConfig.updateUserConfig(owner.getId(), bauLockConfigName, lockState); - - Message.send("BAU_LOCKED_" + lockState, owner.getPlayer()); + UserConfig.updateUserConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name()); + Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer()); } - private static BauLockState getUserLockState(int userID) { - return BauLockState.valueOf(UserConfig.getConfig(userID, bauLockConfigName)); + private static boolean isLocked(SteamwarUser owner, SteamwarUser target) { + String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME); + + switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) { + case NOBODY: + return true; + case TEAM: + return owner.getTeam() != target.getTeam(); + case OPEN: + default: + return false; + } } } diff --git a/src/de/steamwar/bungeecore/sql/BauLockState.java b/src/de/steamwar/bungeecore/sql/BauLockState.java index 0d1a325..5d75fc3 100644 --- a/src/de/steamwar/bungeecore/sql/BauLockState.java +++ b/src/de/steamwar/bungeecore/sql/BauLockState.java @@ -1,3 +1,22 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2022 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; public enum BauLockState { diff --git a/src/de/steamwar/bungeecore/sql/UserConfig.java b/src/de/steamwar/bungeecore/sql/UserConfig.java index 44e02c4..10f4dda 100644 --- a/src/de/steamwar/bungeecore/sql/UserConfig.java +++ b/src/de/steamwar/bungeecore/sql/UserConfig.java @@ -1,12 +1,31 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2022 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.util.UUID; - public class UserConfig { - private static final Statement insert = new Statement("INSERT INTO `UserConfig`(`User`, `Config`, `Value`) VALUES (?,?,?)"); - private static final Statement update = new Statement("UPDATE `UserConfig` SET `Value`= ? WHERE 'User' = ? AND 'Config' = ?"); - private static final Statement select = new Statement("SELECT `Value` FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); - private static final Statement delete = new Statement("DELETE FROM `UserConfig` WHERE 'User' = ? AND 'Config' = ?"); + private UserConfig() {} + + private static final Statement insert = new Statement("INSERT INTO UserConfig (User, Config, Value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE Value = VALUES(Value)"); + private static final Statement select = new Statement("SELECT Value FROM UserConfig WHERE User = ? AND Config = ?"); + private static final Statement delete = new Statement("DELETE FROM UserConfig WHERE User = ? AND Config = ?"); public static String getConfig(int userID, String config) { return select.select(rs -> { @@ -17,15 +36,11 @@ public class UserConfig { } public static void updateUserConfig(int userID, String config, String value) { - - if (getConfig(userID, config) == null) { - insert.update(userID, config, value); - } else { - update.update(value, config, config); + if(value == null) { + delete.update(userID, config); + return; } - } - public static void removePlayerEntry(int userID, String config) { - delete.update(userID, config); + insert.update(userID, config, value); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 7169c94..83ef159 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -101,10 +101,10 @@ HELP_BAU_DELETE=§8/§ebuild delete §8- §7Reset your entire build server HELP_BAU_DELETE_HOVER=§eReset build server HELP_BAU_TESTARENA=§8/§ebuild testarena §8- §7Start a test arena HELP_BAU_TESTARENA_HOVER=§eStart test arena -HELP_BAU_LOCK=§8/§ebuild lock §8- §7Locks the buildserver for customized group of players. -HELP_BAU_LOCK_HOVER=§eLock the build +HELP_BAU_LOCK=§8/§ebuild lock §8- §7Locks the build server for a specified group of players. +HELP_BAU_LOCK_HOVER=§eLock your build server HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7Unlocks the buildserver for all added user. -HELP_BAU_UNLOCK_HOVER=§eUnlock the build +HELP_BAU_UNLOCK_HOVER=§eUnlock your build server #Usage description of various commands USAGE_ALERT=§8/§7alert §8[§emessage§8] @@ -203,10 +203,10 @@ BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. BAU_LOCKED_NOALLOWED=&cThe build server is currently locked. -BAU_LOCKED_OPTIONS=§eBuild server lock options: §cnone§8, §eteam§8, §aopen§8. -BAU_LOCKED_NOBODY=§eYou have closed your buildserver to all players. -BAU_LOCKED_TEAM=§eYou've closed your buildserver to all beside added team members. -BAU_LOCKED_OPEN=§eYou have reopened your build for all added players. +BAU_LOCKED_OPTIONS=§7Build server lock options§8: §cnone§8, §eteam§8, §aopen +BAU_LOCKED_NOBODY=§eYou have closed your build server for all players. +BAU_LOCKED_TEAM=§eYou've closed your build server for all players except added team members. +BAU_LOCKED_OPEN=§eYou have opened your build server for all added players. BAU_DELMEMBER_USAGE=§8/§7build delmember §8[§eplayer§8] BAU_DELMEMBER_SELFDEL=§cYou cannot remove yourself! BAU_DELMEMBER_DELETED=§cPlayer was removed. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 068c7df..a64536d 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -40,9 +40,9 @@ HELP_JOIN=§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei! HELP_JOIN_HOVER=§eSpieler beitreten HELP_LOCAL=§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server! HELP_LOCAL_HOVER=§eLokaler Chat -HELP_BAU_LOCK=§8/§ebuild lock §8- §7Sperre dein Bauserver für bestimmte Spieler. +HELP_BAU_LOCK=§8/§ebuild lock §8- §7Sperre deinen Bauserver für bestimmte Spieler. HELP_BAU_LOCK_HOVER=§eSperre deinen bau -HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7SÖffne den Bauserver für alle vertrauten Spieler. +HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7SÖffne den Bauserver für alle hinzugefügten Spieler. HELP_BAU_UNLOCK_HOVER=§eÖffne deinen bau HELP_TNT=§8/§7tnt §8- §7(de)aktiviert Explosionsschaden @@ -187,10 +187,10 @@ 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_LOCKED_NOALLOWED=&cDer Bauserver ist momentan gesperrt. -BAU_LOCKED_OPTIONS=§eBauserver sperr optionen: §cnone§8, §eteam§8, §aopen§8. -BAU_LOCKED_NOBODY=§eDu hast dein Bau für alle Spieler geschlossen. -BAU_LOCKED_TEAM=§eDu hast dein Bau für alle außer hinzugefügte Teammitglieder gesperrt. -BAU_LOCKED_OPEN=§eDu hast dein Bau für alle hinzugefügten Spieler wieder geöffnet. +BAU_LOCKED_OPTIONS=§eBauserver-Sperroptionen: §cnone§8, §eteam§8, §aopen§8. +BAU_LOCKED_NOBODY=§eDu hast deinen Bau für alle Spieler geschlossen. +BAU_LOCKED_TEAM=§eDu hast deinen Bau für alle außer hinzugefügte Teammitglieder gesperrt. +BAU_LOCKED_OPEN=§eDu hast deinen Bau für alle hinzugefügten Spieler geöffnet. 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. From e83b399593e5b0ddd7ba3cae35b0cdad5ca0c25e Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Sep 2022 18:09:23 +0200 Subject: [PATCH 18/26] Fix wrong CommonDB Signed-off-by: Lixfel --- CommonCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CommonCore b/CommonCore index c1e175c..9df9259 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit c1e175c3e84280c160ae5c7f84e44805f159bbf3 +Subproject commit 9df92595b2f344585bd3e1639cedc761680b7761 From 29a30ec5bbd7869aa4345b35dc7f5995050207f2 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Sep 2022 18:11:58 +0200 Subject: [PATCH 19/26] Fix missing return Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/BauCommand.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 43ad0bd..98af453 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -82,7 +82,6 @@ public class BauCommand extends BasicCommand { case "test": testarena(p, args); break; - case "lock": if(args.length < 2) { Message.send("BAU_LOCKED_OPTIONS", p); @@ -91,11 +90,9 @@ public class BauCommand extends BasicCommand { setLocked(SteamwarUser.get(p), args[1]); break; - case "unlock": setLocked(SteamwarUser.get(p), "open"); break; - default: HelpCommand.sendBauHelp(ChatSender.of(p)); } @@ -136,13 +133,13 @@ public class BauCommand extends BasicCommand { } SteamwarUser worldOwner = SteamwarUser.get(args[1]); - if (worldOwner == null) { 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()); Message.send("BAU_TP_NOALLOWED", p); + return; } if(isLocked(worldOwner, SteamwarUser.get(p))) { From fd1efaa22bc0a5e7a6ab916098768de979663f37 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Sep 2022 18:16:06 +0200 Subject: [PATCH 20/26] Fix case sensitivity Signed-off-by: Lixfel --- 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 98af453..51fdd0f 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -88,10 +88,10 @@ public class BauCommand extends BasicCommand { return; } - setLocked(SteamwarUser.get(p), args[1]); + setLocked(SteamwarUser.get(p), args[1].toUpperCase()); break; case "unlock": - setLocked(SteamwarUser.get(p), "open"); + setLocked(SteamwarUser.get(p), "OPEN"); break; default: HelpCommand.sendBauHelp(ChatSender.of(p)); From 7377f5513a021e9a7ca3e189f914836d3a9a6761 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Sep 2022 18:34:50 +0200 Subject: [PATCH 21/26] Fix several issues Signed-off-by: Lixfel --- .../bungeecore/commands/BauCommand.java | 17 +++++++++++++---- .../steamwar/bungeecore/sql/SteamwarUser.java | 1 + src/de/steamwar/messages/BungeeCore.properties | 8 ++++---- .../steamwar/messages/BungeeCore_de.properties | 18 +++++++++--------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 51fdd0f..ef3bba2 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -88,10 +88,10 @@ public class BauCommand extends BasicCommand { return; } - setLocked(SteamwarUser.get(p), args[1].toUpperCase()); + setLocked(p, args[1].toUpperCase()); break; case "unlock": - setLocked(SteamwarUser.get(p), "OPEN"); + setLocked(p, "OPEN"); break; default: HelpCommand.sendBauHelp(ChatSender.of(p)); @@ -327,7 +327,8 @@ public class BauCommand extends BasicCommand { } private static final String BAU_LOCK_CONFIG_NAME = "baulockstate"; - private static void setLocked(SteamwarUser owner, String arg) { + private static void setLocked(ProxiedPlayer p, String arg) { + SteamwarUser owner = SteamwarUser.get(p.getUniqueId()); BauLockState state; try { state = BauLockState.valueOf(arg); @@ -337,12 +338,20 @@ public class BauCommand extends BasicCommand { } UserConfig.updateUserConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name()); + Subserver.getServerList().stream().filter(server -> server.getType() == Servertype.BAUSERVER && ((Bauserver)server).getOwner().equals(p.getUniqueId())).findAny().ifPresent( + server -> server.getServer().getPlayers().stream().filter(player -> isLocked(owner, SteamwarUser.get(player.getUniqueId()))).forEach(member -> { + member.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LOBBY_SERVER)); + Message.send("BAU_LOCKED_NOALLOWED", p); + }) + ); Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer()); } private static boolean isLocked(SteamwarUser owner, SteamwarUser target) { - String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME); + if (owner.getId() == target.getId()) + return false; + String state = UserConfig.getConfig(owner.getId(), BAU_LOCK_CONFIG_NAME); switch (state == null ? BauLockState.OPEN : BauLockState.valueOf(state)) { case NOBODY: return true; diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index a5cb605..ab083a7 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -268,6 +268,7 @@ public class SteamwarUser { return team; } + @Deprecated public ProxiedPlayer getPlayer() { return ProxyServer.getInstance().getPlayer(uuid); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 83ef159..9cbf19e 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -202,11 +202,11 @@ BAU_ADDMEMBER_ADDED=§aThe player was added to your world. BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. -BAU_LOCKED_NOALLOWED=&cThe build server is currently locked. +BAU_LOCKED_NOALLOWED=§cThe build server is currently locked. BAU_LOCKED_OPTIONS=§7Build server lock options§8: §cnone§8, §eteam§8, §aopen -BAU_LOCKED_NOBODY=§eYou have closed your build server for all players. -BAU_LOCKED_TEAM=§eYou've closed your build server for all players except added team members. -BAU_LOCKED_OPEN=§eYou have opened your build server for all added players. +BAU_LOCKED_NOBODY=§7You have closed your build server for all players. +BAU_LOCKED_TEAM=§7You've closed your build server for all players except added team members. +BAU_LOCKED_OPEN=§7You have opened your build server for all added players. BAU_DELMEMBER_USAGE=§8/§7build delmember §8[§eplayer§8] BAU_DELMEMBER_SELFDEL=§cYou cannot remove yourself! BAU_DELMEMBER_DELETED=§cPlayer was removed. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index a64536d..9566388 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -40,10 +40,6 @@ HELP_JOIN=§7Trete mit §8/§ejoin §8[§eSpieler§8] §7einem Kampf bei! HELP_JOIN_HOVER=§eSpieler beitreten HELP_LOCAL=§7Schreibe mit §8/§elocal §7nur auf dem lokalen Server! HELP_LOCAL_HOVER=§eLokaler Chat -HELP_BAU_LOCK=§8/§ebuild lock §8- §7Sperre deinen Bauserver für bestimmte Spieler. -HELP_BAU_LOCK_HOVER=§eSperre deinen bau -HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7SÖffne den Bauserver für alle hinzugefügten Spieler. -HELP_BAU_UNLOCK_HOVER=§eÖffne deinen bau HELP_TNT=§8/§7tnt §8- §7(de)aktiviert Explosionsschaden HELP_FIRE=§8/§7fire §8- §7(de)aktiviert Feuerschaden @@ -91,6 +87,10 @@ 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_LOCK=§8/§ebau lock §8- §7Sperre deinen Bauserver für bestimmte Spieler. +HELP_BAU_LOCK_HOVER=§eSperre deinen Bau +HELP_BAU_UNLOCK=§8/§ebau unlock §8- §7Öffne deinen Bauserver für alle hinzugefügten Spieler. +HELP_BAU_UNLOCK_HOVER=§eÖffne deinen Bau #Usage description of various commands USAGE_ALERT=§8/§7alert §8[§eNachricht§8] @@ -186,11 +186,11 @@ 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_LOCKED_NOALLOWED=&cDer Bauserver ist momentan gesperrt. -BAU_LOCKED_OPTIONS=§eBauserver-Sperroptionen: §cnone§8, §eteam§8, §aopen§8. -BAU_LOCKED_NOBODY=§eDu hast deinen Bau für alle Spieler geschlossen. -BAU_LOCKED_TEAM=§eDu hast deinen Bau für alle außer hinzugefügte Teammitglieder gesperrt. -BAU_LOCKED_OPEN=§eDu hast deinen Bau für alle hinzugefügten Spieler geöffnet. +BAU_LOCKED_NOALLOWED=§cDer Bauserver ist momentan gesperrt. +BAU_LOCKED_OPTIONS=§7Bauserver-Sperroptionen§8: §cnone§8, §eteam§8, §aopen +BAU_LOCKED_NOBODY=§7Du hast deinen Bau für alle Spieler geschlossen. +BAU_LOCKED_TEAM=§7Du hast deinen Bau für alle außer hinzugefügte Teammitglieder gesperrt. +BAU_LOCKED_OPEN=§7Du hast deinen Bau für alle hinzugefügten Spieler geöffnet. 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. From 29192839632505be1ea51fb4dd16add1dde8777a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 11 Sep 2022 20:04:24 +0200 Subject: [PATCH 22/26] Whois Fixes --- src/de/steamwar/bungeecore/commands/WhoisCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 2 +- src/de/steamwar/messages/BungeeCore_de.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/WhoisCommand.java b/src/de/steamwar/bungeecore/commands/WhoisCommand.java index 2aea258..bf016c3 100644 --- a/src/de/steamwar/bungeecore/commands/WhoisCommand.java +++ b/src/de/steamwar/bungeecore/commands/WhoisCommand.java @@ -95,7 +95,7 @@ public class WhoisCommand extends SWCommand { if(BungeeCord.getInstance().getPlayer(user.getUuid()) != null) { ProxiedPlayer target = BungeeCord.getInstance().getPlayer(user.getUuid()); - Message.send("WHOIS_CURRENT_PLAYED", player, new DecimalFormat("####.##").format(Instant.now().getEpochSecond() - Storage.sessions.get(target).toInstant().getEpochSecond() / 60d)); + Message.send("WHOIS_CURRENT_PLAYED", player, new DecimalFormat("####.##").format((Instant.now().getEpochSecond() - Storage.sessions.get(target).toInstant().getEpochSecond()) / 60d)); Message.send("WHOIS_CURRENT_SERVER", player, target.getServer().getInfo().getName()); Message.send("WHOIS_CURRENT_PROTOCOL", player, target.getPendingConnection().getVersion()); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 394e4ea..7b1c74d 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -574,7 +574,7 @@ WHOIS_USERNAME=§7Username§8: §e{0} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eCopy UUID WHOIS_ID=§7ID§8: §e{0} -WHOIS_GROUP=§7Group§8: §{0}{1} +WHOIS_GROUP=§7Group§8: {0}{1} WHOIS_DISCORD_ID=§7Discord-ID§8: §e{0} WHOIS_JOINED_FIRST=§7Joined on§8: §e{0} WHOIS_HOURS_PLAYED=§7Online Time§8: §e{0}h diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index aff7e1f..fc4e57e 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -550,7 +550,7 @@ SERVER_WORLD_ERROR=§cDas Erstellen der Welt ist fehlgeschlagen. #WhoisCommand WHOIS_USAGE=§c/whois [Spieler/ID] <-a> WHOIS_USERNAME=§7Username§8: §e{0} -WHOIS_GROUP=§7Gruppe§8: §e{0} +WHOIS_GROUP=§7Gruppe§8: {0}{1} WHOIS_UUID=§7UUID§8: §e{0} WHOIS_UUID_HOVER=§eUUID Kopieren WHOIS_ID=§7ID§8: §e{0} From 85c5201c82c4ec844455cfb1e7835c50cfb06681 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 11 Sep 2022 20:10:17 +0200 Subject: [PATCH 23/26] Fix language Signed-off-by: Lixfel --- src/de/steamwar/messages/BungeeCore.properties | 8 ++++---- src/de/steamwar/messages/BungeeCore_de.properties | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9cbf19e..460914f 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -101,9 +101,9 @@ HELP_BAU_DELETE=§8/§ebuild delete §8- §7Reset your entire build server HELP_BAU_DELETE_HOVER=§eReset build server HELP_BAU_TESTARENA=§8/§ebuild testarena §8- §7Start a test arena HELP_BAU_TESTARENA_HOVER=§eStart test arena -HELP_BAU_LOCK=§8/§ebuild lock §8- §7Locks the build server for a specified group of players. +HELP_BAU_LOCK=§8/§ebuild lock §8- §7Locks the build server for a specified group of players HELP_BAU_LOCK_HOVER=§eLock your build server -HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7Unlocks the buildserver for all added user. +HELP_BAU_UNLOCK=§8/§ebuild unlock §8- §7Unlocks the buildserver for added users HELP_BAU_UNLOCK_HOVER=§eUnlock your build server #Usage description of various commands @@ -204,8 +204,8 @@ BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. BAU_LOCKED_NOALLOWED=§cThe build server is currently locked. BAU_LOCKED_OPTIONS=§7Build server lock options§8: §cnone§8, §eteam§8, §aopen -BAU_LOCKED_NOBODY=§7You have closed your build server for all players. -BAU_LOCKED_TEAM=§7You've closed your build server for all players except added team members. +BAU_LOCKED_NOBODY=§7You have locked your build server for all players. +BAU_LOCKED_TEAM=§7You've locked your build server for all players except added team members. BAU_LOCKED_OPEN=§7You have opened your build server for all added players. BAU_DELMEMBER_USAGE=§8/§7build delmember §8[§eplayer§8] BAU_DELMEMBER_SELFDEL=§cYou cannot remove yourself! diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index 9566388..c890573 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -87,9 +87,9 @@ 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_LOCK=§8/§ebau lock §8- §7Sperre deinen Bauserver für bestimmte Spieler. +HELP_BAU_LOCK=§8/§ebau lock §8- §7Sperre deinen Bauserver für bestimmte Spielergruppen HELP_BAU_LOCK_HOVER=§eSperre deinen Bau -HELP_BAU_UNLOCK=§8/§ebau unlock §8- §7Öffne deinen Bauserver für alle hinzugefügten Spieler. +HELP_BAU_UNLOCK=§8/§ebau unlock §8- §7Öffne deinen Bauserver für alle hinzugefügten Spieler HELP_BAU_UNLOCK_HOVER=§eÖffne deinen Bau #Usage description of various commands From 02c81068e7bb574b8b44ea4ec62e350bb2e23a76 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 12 Sep 2022 17:54:42 +0200 Subject: [PATCH 24/26] Fix Double Bans --- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index a5cb605..4e16de5 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -325,14 +325,14 @@ public class SteamwarUser { ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid); if (player != null) { - updateBanIP(player.getAddress().getAddress().getHostAddress()); ChatSender.disconnect(player).system(punishmentMessage(punishment)); for (BannedUserIPs banned : BannedUserIPs.get(player.getAddress().getAddress().getHostAddress())) { SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); - if (isPunished(punishment) && bannedUser.getPunishment(punishment).getEndTime().before(time)) { + if (bannedUser.isPunished(punishment) && bannedUser.getPunishment(punishment).getEndTime().before(time)) { bannedUser.punish(punishment, time, banReason, from, perma); } } + updateBanIP(player.getAddress().getAddress().getHostAddress()); } else { updateBanIP(""); } From f9f0f837796d396a1beda43288ffb896321c7c40 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 13 Sep 2022 22:34:59 +0200 Subject: [PATCH 25/26] Don't kick players Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/BauCommand.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index ef3bba2..6e845ce 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -338,12 +338,6 @@ public class BauCommand extends BasicCommand { } UserConfig.updateUserConfig(owner.getId(), BAU_LOCK_CONFIG_NAME, state == BauLockState.OPEN ? null : state.name()); - Subserver.getServerList().stream().filter(server -> server.getType() == Servertype.BAUSERVER && ((Bauserver)server).getOwner().equals(p.getUniqueId())).findAny().ifPresent( - server -> server.getServer().getPlayers().stream().filter(player -> isLocked(owner, SteamwarUser.get(player.getUniqueId()))).forEach(member -> { - member.connect(ProxyServer.getInstance().getServerInfo(BungeeCore.LOBBY_SERVER)); - Message.send("BAU_LOCKED_NOALLOWED", p); - }) - ); Message.send("BAU_LOCKED_" + state.name(), owner.getPlayer()); } From 451de152b211a1eda06fdc002783a44b6493001d Mon Sep 17 00:00:00 2001 From: MoBrot <90271578+MoBrot@users.noreply.github.com> Date: Tue, 13 Sep 2022 22:52:38 +0200 Subject: [PATCH 26/26] +Fixed noby and IllegalArgumentException --- src/de/steamwar/bungeecore/commands/BauCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 2 +- src/de/steamwar/messages/BungeeCore_de.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 6e845ce..8e2fb9a 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -332,7 +332,7 @@ public class BauCommand extends BasicCommand { BauLockState state; try { state = BauLockState.valueOf(arg); - } catch (IllegalStateException e) { + } catch (IllegalArgumentException e) { Message.send("BAU_LOCKED_OPTIONS", owner.getPlayer()); return; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 460914f..8339140 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -203,7 +203,7 @@ BAU_ADDMEMBER_ADDED_TARGET=§aYou have been added to the world of §e{0}§a. BAU_TP_USAGE=§8/§7build tp §8[§eplayer§8] BAU_TP_NOALLOWED=§cYou are not allowed to teleport to this player's world. BAU_LOCKED_NOALLOWED=§cThe build server is currently locked. -BAU_LOCKED_OPTIONS=§7Build server lock options§8: §cnone§8, §eteam§8, §aopen +BAU_LOCKED_OPTIONS=§7Build server lock options§8: §cnobody§8, §eteam§8, §aopen BAU_LOCKED_NOBODY=§7You have locked your build server for all players. BAU_LOCKED_TEAM=§7You've locked your build server for all players except added team members. BAU_LOCKED_OPEN=§7You have opened your build server for all added players. diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index c890573..8367540 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -187,7 +187,7 @@ 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_LOCKED_NOALLOWED=§cDer Bauserver ist momentan gesperrt. -BAU_LOCKED_OPTIONS=§7Bauserver-Sperroptionen§8: §cnone§8, §eteam§8, §aopen +BAU_LOCKED_OPTIONS=§7Bauserver-Sperroptionen§8: §cnobody§8, §eteam§8, §aopen BAU_LOCKED_NOBODY=§7Du hast deinen Bau für alle Spieler geschlossen. BAU_LOCKED_TEAM=§7Du hast deinen Bau für alle außer hinzugefügte Teammitglieder gesperrt. BAU_LOCKED_OPEN=§7Du hast deinen Bau für alle hinzugefügten Spieler geöffnet.