From 4ba2b56d194a39a123c1274da4db5ef7375aceeb Mon Sep 17 00:00:00 2001 From: jojo Date: Thu, 19 Nov 2020 22:03:50 +0100 Subject: [PATCH 01/11] Update '/help bau' --- .../bungeecore/commands/HelpCommand.java | 112 +++++++++++++++--- .../steamwar/messages/BungeeCore.properties | 24 +++- 2 files changed, 116 insertions(+), 20 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index afb08f5..11d23fc 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -26,13 +26,14 @@ import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; public class HelpCommand extends BasicCommand { + public HelpCommand() { super("help", "", "?"); } @Override public void execute(CommandSender sender, String[] args) { - if(args.length != 1){ + if (args.length != 1) { Message.send("HELP_LOBBY", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOBBY_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l")); Message.send("HELP_BAU", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau")); Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bauserver")); @@ -42,28 +43,59 @@ public class HelpCommand extends BasicCommand { Message.send("HELP_TEAM", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_TEAM_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/team")); Message.send("HELP_JOIN", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_JOIN_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join")); Message.send("HELP_LOCAL", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOCAL_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/local")); - }else if(args[0].equalsIgnoreCase("bauserver")){ + return; + } + if (args[0].equalsIgnoreCase("bauserver")) { sendBauHelp((ProxiedPlayer) sender); - }else if(args[0].equalsIgnoreCase("bau")){ - Message.sendPrefixless("HELP_TNT", sender); - Message.sendPrefixless("HELP_FIRE", sender); - Message.sendPrefixless("HELP_TESTBLOCK", sender); - Message.sendPrefixless("HELP_RESET", sender); - Message.sendPrefixless("HELP_SPEED", sender); - Message.sendPrefixless("HELP_NV", sender); - Message.sendPrefixless("HELP_WV", sender); - Message.sendPrefixless("HELP_TRACE", sender); - Message.sendPrefixless("HELP_LOADER", sender); - Message.sendPrefixless("HELP_PROTECT", sender); - Message.sendPrefixless("HELP_FREEZE", sender); - Message.sendPrefixless("HELP_SKULL", sender); - Message.sendPrefixless("HELP_DEBUGSTICK", sender); - Message.sendPrefixless("HELP_BAUINFO", sender); - Message.sendPrefixless("HELP_BAUSERVER_SHORT", sender); + } + if (args[0].equalsIgnoreCase("bau")) { + bauHelpGroup((ProxiedPlayer) sender, args); + return; + } + + } + + private static void bauHelpGroup(ProxiedPlayer p, String[] args) { + if (args.length != 2) { + sendBauHelpGroup(p); + return; + } + + switch (args[1].toLowerCase()) { + case "admin": + case "owner": + case "bauwelt": + sendBauHelpAdmin(p); + return; + case "world": + sendBauHelpWorld(p); + return; + case "player": + sendBauHelpPlayer(p); + return; + case "worldedit": + case "we": + case "world-edit": + case "edit": + sendBauHelpWorldEdit(p); + return; + case "other": + sendBauHelpOther(p); + return; + default: + sendBauHelpGroup(p); } } - static void sendBauHelp(ProxiedPlayer p){ + private static void sendBauHelpGroup(ProxiedPlayer p) { + Message.send("HELP_BAU_GROUP_ADMIN", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_ADMIN_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau admin")); + Message.send("HELP_BAU_GROUP_WORLD", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_WORLD_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau world")); + Message.send("HELP_BAU_GROUP_PLAYER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_PLAYER_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau player")); + Message.send("HELP_BAU_GROUP_WE", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_WE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau we")); + Message.send("HELP_BAU_GROUP_OTHER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_GROUP_OTHER_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau other")); + } + + static void sendBauHelp(ProxiedPlayer p) { Message.send("HELP_BAU_TP", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TP_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau tp ")); Message.send("HELP_BAU_ADDMEMBER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_ADDMEMBER_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau addmember ")); Message.send("HELP_BAU_DELMEMBER", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_DELMEMBER_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delmember ")); @@ -74,4 +106,46 @@ public class HelpCommand extends BasicCommand { Message.send("HELP_BAU_TESTARENA", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TESTARENA_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau testarena ")); Message.send("HELP_BAU_BAU", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_BAU_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau")); } + + static void sendBauHelpWorld(ProxiedPlayer p) { + Message.sendPrefixless("HELP_TNT", p); + Message.sendPrefixless("HELP_FIRE", p); + Message.sendPrefixless("HELP_FREEZE", p); + Message.sendPrefixless("HELP_TPSLIMIT", p); + Message.sendPrefixless("HELP_PROTECT", p); + Message.sendPrefixless("HELP_RESET", p); + } + + static void sendBauHelpPlayer(ProxiedPlayer p) { + Message.sendPrefixless("HELP_SPEED", p); + Message.sendPrefixless("HELP_NV", p); + Message.sendPrefixless("HELP_WV", p); + Message.sendPrefixless("HELP_DEBUGSTICK", p); + Message.sendPrefixless("HELP_TRACE", p); + Message.sendPrefixless("HELP_LOADER", p); + } + + static void sendBauHelpAdmin(ProxiedPlayer p) { + sendBauHelp(p); + } + + static void sendBauHelpWorldEdit(ProxiedPlayer p) { + Message.sendPrefixless("HELP_WE_POS1", p); + Message.sendPrefixless("HELP_WE_POS2", p); + Message.sendPrefixless("HELP_WE_COPY", p); + Message.sendPrefixless("HELP_WE_PASTE", p); + Message.sendPrefixless("HELP_WE_FLOPY", p); + Message.sendPrefixless("HELP_WE_FLOPYP", p); + Message.sendPrefixless("HELP_WE_ROTATE_90", p); + Message.sendPrefixless("HELP_WE_ROTATE_180", p); + Message.sendPrefixless("HELP_WE_ROTATE_N90", p); + } + + static void sendBauHelpOther(ProxiedPlayer p) { + Message.sendPrefixless("HELP_TESTBLOCK", p); + Message.sendPrefixless("HELP_SKULL", p); + Message.sendPrefixless("HELP_BAUINFO", p); + Message.sendPrefixless("HELP_BAUSERVER_SHORT", p); + } + } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6855cb7..2551f68 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -27,6 +27,7 @@ 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 @@ -35,6 +36,27 @@ HELP_DEBUGSTICK=§8/§edebugstick §8- §7Gibt dir einen Debugstick (nur 1.15) HELP_BAUINFO=§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver HELP_BAUSERVER_SHORT=§8/§ehelp bauserver §8- §7Hilfe zum Bauserver +HELP_WE_POS1=§8//§e1 §8- §7Die Abkürzung für §8//§epos1 +HELP_WE_POS2=§8//§e2 §8- §7Die Abkürzung für §8//§epos2 +HELP_WE_COPY=§8//§ec §8- §7Die Abkürzung für §8//§ecopy +HELP_WE_PASTE=§8//§ep §8- §7Die Abkürzung für §8//§epaste +HELP_WE_FLOPY=§8//§eflopy §8- §7Die Abkürzung für §8//§ecopy §7& §8//§eflip +HELP_WE_FLOPYP=§8//§eflopyp §8- §7Die Abkürzung für §8//§ecopy §7& §8//§eflip §7& §8//§epaste +HELP_WE_ROTATE_90=§8//§e90 §8- §7Die Abkürzung für §8//§erotate 90 +HELP_WE_ROTATE_180=§8//§e180 §8- §7Die Abkürzung für §8//§erotate 180 +HELP_WE_ROTATE_N90=§8//§e-90 §8- §7Die Abkürzung für §8//§erotate -90 + +HELP_BAU_GROUP_ADMIN=§7Alle Befehle, welcher für die Verwaltung eines Baus wichtig sind +HELP_BAU_GROUP_ADMIN_HOVER=§eAlle Verwaltungs Befehle +HELP_BAU_GROUP_OTHER=§7Alle sonstigen Befehle, für die Bau Welt +HELP_BAU_GROUP_OTHER_HOVER=§eAlle sonstigen Befehle +HELP_BAU_GROUP_WE=§7Alle Abkürzungen für World Edit +HELP_BAU_GROUP_WE_HOVER=§eAlle World Edit Befehle +HELP_BAU_GROUP_PLAYER=§7Alle Befehle, welche für den einzelnen Spieler sind +HELP_BAU_GROUP_PLAYER_HOVER=§eAlle Spieler Befehle +HELP_BAU_GROUP_WORLD=§7Alle wichtigen Weltbefehle, für die Bau Welt +HELP_BAU_GROUP_WORLD_HOVER=§eAlle World Befehle + HELP_BAU_TP=§8/§ebau tp §8- §7Gehe auf Bauserver von Freunden! HELP_BAU_TP_HOVER=§eZu einem anderen Bauserver HELP_BAU_ADDMEMBER=§8/§ebau addmember §8- §7Fügt einen Freund hinzu @@ -52,4 +74,4 @@ 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 +HELP_BAU_BAU_HOVER=§eNützliche Zusatzfunktionen \ No newline at end of file From 6c68aab3dd7ebb372ffa672eea4960688429ce83 Mon Sep 17 00:00:00 2001 From: jojo Date: Thu, 19 Nov 2020 22:35:19 +0100 Subject: [PATCH 02/11] Fix HelpCommand --- src/de/steamwar/bungeecore/commands/HelpCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index 11d23fc..140e996 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -33,7 +33,7 @@ public class HelpCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { - if (args.length != 1) { + if (args.length < 1) { Message.send("HELP_LOBBY", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOBBY_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l")); Message.send("HELP_BAU", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau")); Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bauserver")); @@ -56,7 +56,7 @@ public class HelpCommand extends BasicCommand { } private static void bauHelpGroup(ProxiedPlayer p, String[] args) { - if (args.length != 2) { + if (args.length < 2) { sendBauHelpGroup(p); return; } From 56b01d6ee65d6fcad3272bb8b884a913ccb7ac41 Mon Sep 17 00:00:00 2001 From: jojo Date: Fri, 20 Nov 2020 09:53:43 +0100 Subject: [PATCH 03/11] Update Messages Update HelpCommand --- .../bungeecore/commands/HelpCommand.java | 7 +++ .../steamwar/messages/BungeeCore.properties | 43 +++++++++++-------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index 140e996..0509aca 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -25,6 +25,8 @@ import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; +import javax.swing.*; + public class HelpCommand extends BasicCommand { public HelpCommand() { @@ -108,6 +110,7 @@ public class HelpCommand extends BasicCommand { } static void sendBauHelpWorld(ProxiedPlayer p) { + Message.send("HELP_BAU_GROUP_WORLD_TITLE", p); Message.sendPrefixless("HELP_TNT", p); Message.sendPrefixless("HELP_FIRE", p); Message.sendPrefixless("HELP_FREEZE", p); @@ -117,6 +120,7 @@ public class HelpCommand extends BasicCommand { } static void sendBauHelpPlayer(ProxiedPlayer p) { + Message.sendPrefixless("HELP_BAU_GROUP_PLAYER_TITLE", p); Message.sendPrefixless("HELP_SPEED", p); Message.sendPrefixless("HELP_NV", p); Message.sendPrefixless("HELP_WV", p); @@ -126,10 +130,12 @@ public class HelpCommand extends BasicCommand { } static void sendBauHelpAdmin(ProxiedPlayer p) { + Message.send("HELP_BAU_GROUP_ADMIN_TITLE", p); sendBauHelp(p); } static void sendBauHelpWorldEdit(ProxiedPlayer p) { + Message.sendPrefixless("HELP_BAU_GROUP_WE_TITLE", p); Message.sendPrefixless("HELP_WE_POS1", p); Message.sendPrefixless("HELP_WE_POS2", p); Message.sendPrefixless("HELP_WE_COPY", p); @@ -142,6 +148,7 @@ public class HelpCommand extends BasicCommand { } static void sendBauHelpOther(ProxiedPlayer p) { + Message.sendPrefixless("HELP_BAU_GROUP_OTHER_TITLE", p); Message.sendPrefixless("HELP_TESTBLOCK", p); Message.sendPrefixless("HELP_SKULL", p); Message.sendPrefixless("HELP_BAUINFO", p); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 2551f68..53e660a 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -36,26 +36,31 @@ HELP_DEBUGSTICK=§8/§edebugstick §8- §7Gibt dir einen Debugstick (nur 1.15) HELP_BAUINFO=§8/§ebauinfo §8- §7Gibt dir Informationen über den Bauserver HELP_BAUSERVER_SHORT=§8/§ehelp bauserver §8- §7Hilfe zum Bauserver -HELP_WE_POS1=§8//§e1 §8- §7Die Abkürzung für §8//§epos1 -HELP_WE_POS2=§8//§e2 §8- §7Die Abkürzung für §8//§epos2 -HELP_WE_COPY=§8//§ec §8- §7Die Abkürzung für §8//§ecopy -HELP_WE_PASTE=§8//§ep §8- §7Die Abkürzung für §8//§epaste -HELP_WE_FLOPY=§8//§eflopy §8- §7Die Abkürzung für §8//§ecopy §7& §8//§eflip -HELP_WE_FLOPYP=§8//§eflopyp §8- §7Die Abkürzung für §8//§ecopy §7& §8//§eflip §7& §8//§epaste -HELP_WE_ROTATE_90=§8//§e90 §8- §7Die Abkürzung für §8//§erotate 90 -HELP_WE_ROTATE_180=§8//§e180 §8- §7Die Abkürzung für §8//§erotate 180 -HELP_WE_ROTATE_N90=§8//§e-90 §8- §7Die Abkürzung für §8//§erotate -90 +HELP_WE_POS1=§8//§e1 §8» //§epos1 +HELP_WE_POS2=§8//§e2 §8» //§epos2 +HELP_WE_COPY=§8//§ec §8» //§ecopy +HELP_WE_PASTE=§8//§ep §8» //§epaste +HELP_WE_FLOPY=§8//§eflopy §8» //§ecopy §7& §8//§eflip +HELP_WE_FLOPYP=§8//§eflopyp §8» //§ecopy §7& §8//§eflip §7& §8//§epaste +HELP_WE_ROTATE_90=§8//§e90 §8» //§erotate 90 +HELP_WE_ROTATE_180=§8//§e180 §8» //§erotate 180 +HELP_WE_ROTATE_N90=§8//§e-90 §8» //§erotate -90 -HELP_BAU_GROUP_ADMIN=§7Alle Befehle, welcher für die Verwaltung eines Baus wichtig sind -HELP_BAU_GROUP_ADMIN_HOVER=§eAlle Verwaltungs Befehle -HELP_BAU_GROUP_OTHER=§7Alle sonstigen Befehle, für die Bau Welt -HELP_BAU_GROUP_OTHER_HOVER=§eAlle sonstigen Befehle -HELP_BAU_GROUP_WE=§7Alle Abkürzungen für World Edit -HELP_BAU_GROUP_WE_HOVER=§eAlle World Edit Befehle -HELP_BAU_GROUP_PLAYER=§7Alle Befehle, welche für den einzelnen Spieler sind -HELP_BAU_GROUP_PLAYER_HOVER=§eAlle Spieler Befehle -HELP_BAU_GROUP_WORLD=§7Alle wichtigen Weltbefehle, für die Bau Welt -HELP_BAU_GROUP_WORLD_HOVER=§eAlle World Befehle +HELP_BAU_GROUP_ADMIN=§7Bauserver-Verwaltungsbefehle +HELP_BAU_GROUP_ADMIN_HOVER=§eAlle Verwaltungsbefehle +HELP_BAU_GROUP_ADMIN_TITLE=§7Alle Verwaltungsbefehle§8: +HELP_BAU_GROUP_OTHER=§7Weitere Bauserverbefehle +HELP_BAU_GROUP_OTHER_HOVER=§eWeitere Bauserverbefehle +HELP_BAU_GROUP_OTHER_TITLE=§7Weitere Bauserverbefehle§8: +HELP_BAU_GROUP_WE=§7WorldEdit-Abkürzungen +HELP_BAU_GROUP_WE_HOVER=§eWorldEdit-Abkürzungen +HELP_BAU_GROUP_WE_TITLE=§7WorldEdit-Abkürzungen§8: +HELP_BAU_GROUP_PLAYER=§7Spielerbefehle +HELP_BAU_GROUP_PLAYER_HOVER=§eSpielerbefehle +HELP_BAU_GROUP_PLAYER_TITLE=§7Spielerbefehle§8: +HELP_BAU_GROUP_WORLD=§7Weltverändernde Bauserverbefehle +HELP_BAU_GROUP_WORLD_HOVER=§eWeltverändernde Bauserverbefehle +HELP_BAU_GROUP_WORLD_TITLE=§7Weltverändernde Bauserverbefehle§8: HELP_BAU_TP=§8/§ebau tp §8- §7Gehe auf Bauserver von Freunden! HELP_BAU_TP_HOVER=§eZu einem anderen Bauserver From e6926116fb8259ca6c23934f178e6757421ddb62 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 28 Nov 2020 08:06:36 +0100 Subject: [PATCH 04/11] Optimize Imports --- src/de/steamwar/bungeecore/commands/HelpCommand.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index 0509aca..4d0e491 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -25,8 +25,6 @@ import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.connection.ProxiedPlayer; -import javax.swing.*; - public class HelpCommand extends BasicCommand { public HelpCommand() { From 9a3756f3d0e90380f0ded792fb5354c671f7c9dd Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 8 Dec 2020 17:09:19 +0100 Subject: [PATCH 05/11] Extraced Inventory API Changes from BungeeSchemGUI --- .../bungeecore/commands/BauCommand.java | 8 +++-- .../bungeecore/comms/PacketIdManager.java | 1 - .../comms/packets/InventoryPacket.java | 2 +- .../bungeecore/inventory/SWInventory.java | 29 ++++++++----------- .../steamwar/bungeecore/inventory/SWItem.java | 21 +++++--------- .../bungeecore/inventory/SWListInv.java | 10 +++---- .../steamwar/messages/BungeeCore.properties | 7 ++++- 7 files changed, 37 insertions(+), 41 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/BauCommand.java b/src/de/steamwar/bungeecore/commands/BauCommand.java index 3385650..8f39327 100644 --- a/src/de/steamwar/bungeecore/commands/BauCommand.java +++ b/src/de/steamwar/bungeecore/commands/BauCommand.java @@ -239,9 +239,11 @@ public class BauCommand { } private static void delete(ProxiedPlayer p, String[] command){ - SWInventory inventory = new SWInventory(p, 9, "§eWirklich Welt löschen?"); - inventory.addItem(new SWItem(8, "§cAbbrechen", 1), click -> inventory.close()); - inventory.addItem(new SWItem(0, "§aLöschen", 10), click -> { + SWInventory inventory = new SWInventory(p, 9, Message.parse("BAU_DELETE_GUI_NAME", p)); + inventory.addItem(8, new SWItem(Message.parse("BAU_DELETE_GUI_CANCEL", p), 1), click -> + inventory.close() + ); + inventory.addItem(0, new SWItem(Message.parse("BAU_DELETE_GUI_DELETE", p), 10), click -> { if(bau15(p, command, 2)){ SteamwarUser user = SteamwarUser.get(p.getUniqueId()); deleteWorld(p, BungeeCore.USERWORLDS15 + user.getId()); diff --git a/src/de/steamwar/bungeecore/comms/PacketIdManager.java b/src/de/steamwar/bungeecore/comms/PacketIdManager.java index b2c3300..ae86d70 100644 --- a/src/de/steamwar/bungeecore/comms/PacketIdManager.java +++ b/src/de/steamwar/bungeecore/comms/PacketIdManager.java @@ -20,7 +20,6 @@ package de.steamwar.bungeecore.comms; public class PacketIdManager { - private PacketIdManager(){} //0x0(X) Standalone Packets public static final byte PING_PACKET = 0x01; diff --git a/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java b/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java index 4a37d1c..f9a6195 100644 --- a/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java +++ b/src/de/steamwar/bungeecore/comms/packets/InventoryPacket.java @@ -68,7 +68,7 @@ public class InventoryPacket extends BungeePacket { JsonArray array = new JsonArray(); for (int i = 0; i < size; i++) { if(items.get(i) != null) - array.add(items.get(i).writeToString()); + array.add(items.get(i).writeToString(i)); } object.add("items", array); byteArrayDataOutput.writeUTF(object.toString()); diff --git a/src/de/steamwar/bungeecore/inventory/SWInventory.java b/src/de/steamwar/bungeecore/inventory/SWInventory.java index 1f3d166..31cb89e 100644 --- a/src/de/steamwar/bungeecore/inventory/SWInventory.java +++ b/src/de/steamwar/bungeecore/inventory/SWInventory.java @@ -25,7 +25,9 @@ import de.steamwar.bungeecore.comms.packets.InventoryPacket; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.connection.ProxiedPlayer; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; public class SWInventory { @@ -46,33 +48,26 @@ public class SWInventory { next = false; } - public void addItem(SWItem item) { - itemMap.put(item.getPosition(), item); - } - - public void addItem(SWItem item, InvCallback callback) { - item.setCallback(callback); - itemMap.put(item.getPosition(), item); - } - - public void addItem(int position, SWItem item) { - itemMap.put(position, item); - } - public void addItem(int pos, SWItem item, InvCallback callback) { + addItem(pos, item, new ArrayList<>(), callback); + } + + public void addItem(int pos, SWItem item, List lore, InvCallback callback) { item.setCallback(callback); + item.setLore(lore); + itemMap.put(pos, item); + } + + public void addItem(int pos, SWItem item) { itemMap.put(pos, item); } public void addItem(int pos, SWItem item, String name, InvCallback callback) { + item.setName(name); item.setCallback(callback); itemMap.put(pos, item); } - public void removeItem(SWItem item) { - itemMap.remove(item.getPosition()); - } - public void removeItem(int position) { itemMap.remove(position); } diff --git a/src/de/steamwar/bungeecore/inventory/SWItem.java b/src/de/steamwar/bungeecore/inventory/SWItem.java index aadd2d9..41f6ea1 100644 --- a/src/de/steamwar/bungeecore/inventory/SWItem.java +++ b/src/de/steamwar/bungeecore/inventory/SWItem.java @@ -29,29 +29,26 @@ public class SWItem { private String material, title, skullOwner; private boolean enchanted, hideAttributes; - private int position; private List lore; private InvCallback callback; private int color; - public SWItem(String material, int position, String title) { + public SWItem(String material, String title) { this.material = material.toUpperCase(); lore = new ArrayList<>(); - this.position = position; this.title = title; color = 0; } - public SWItem(int position, String title, int color) { + public SWItem(String title, int color) { this.material = "DYE"; lore = new ArrayList<>(); - this.position = position; this.title = title; this.color = color; } public static SWItem getSkull(String skullOwner) { - SWItem item = new SWItem("SKULL", 1, skullOwner); + SWItem item = new SWItem("SKULL", skullOwner); item.setSkullOwner(skullOwner); return item; } @@ -100,10 +97,6 @@ public class SWItem { this.hideAttributes = hideAttributes; } - public int getPosition() { - return position; - } - public void setName(String name) { title = name; } @@ -112,7 +105,7 @@ public class SWItem { this.lore.add(lore); } - public JsonObject writeToString() { + public JsonObject writeToString(int position) { JsonObject object = new JsonObject(); object.addProperty("material", material); object.addProperty("position", position); @@ -152,8 +145,10 @@ public class SWItem { return false; if(!item.skullOwner.equals(skullOwner)) return false; - if(item.position != position) - return false; return true; } + + public void setLore(List lore) { + this.lore = lore; + } } diff --git a/src/de/steamwar/bungeecore/inventory/SWListInv.java b/src/de/steamwar/bungeecore/inventory/SWListInv.java index 639e953..bd43730 100644 --- a/src/de/steamwar/bungeecore/inventory/SWListInv.java +++ b/src/de/steamwar/bungeecore/inventory/SWListInv.java @@ -43,19 +43,19 @@ public class SWListInv extends SWInventory { setCallback(-999, (InvCallback.ClickType click) -> close()); if(elements.size() > 54){ if(page != 0) - addItem(45, new SWItem(45, "§eSeite zurück", 10), (InvCallback.ClickType click) -> { + addItem(45, new SWItem("§eSeite zurück", 10), (InvCallback.ClickType click) -> { page--; open(); }); else - addItem(45, new SWItem(45, "§7Seite zurück", 8), (InvCallback.ClickType click) -> {}); + addItem(45, new SWItem("§7Seite zurück", 8), (InvCallback.ClickType click) -> {}); if(page < elements.size()/45) - addItem(53, new SWItem( 53, "§eSeite vor", 10), "§eSeite vor", (InvCallback.ClickType click) -> { + addItem(53, new SWItem("§eSeite vor", 10), "§eSeite vor", (InvCallback.ClickType click) -> { page++; open(); }); else - addItem(53, new SWItem(53, "§eSeite vor", 8), (InvCallback.ClickType click) -> {}); + addItem(53, new SWItem("§eSeite vor", 8), (InvCallback.ClickType click) -> {}); } int ipageLimit = elements.size() - page*45; @@ -119,7 +119,7 @@ public class SWListInv extends SWInventory { m = "CAULDRON_ITEM"; else m = s.getSchemItem(); - SWItem item = new SWItem(m, 0, "§e" + s.getSchemName()); + SWItem item = new SWItem(m, "§e" + s.getSchemName()); schemList.add(new SWListEntry<>(item, s)); } return schemList; diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 14172c9..90a26cf 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -108,4 +108,9 @@ IGNORE_MESSAGE=§7Du ignorierst nun §e{0}§8. #PollresultCommand POLLRESULT_NOPOLL=§cDerzeit läuft keine Umfrage. POLLRESULT_HEADER=§eEs haben {0} abgestimmt auf die Frage: §7{1} -POLLRESULT_LIST=§e{0}§8: §7{1} \ No newline at end of file +POLLRESULT_LIST=§e{0}§8: §7{1} + +#BauCommand +BAU_DELETE_GUI_NAME=§eWirklich Welt löschen? +BAU_DELETE_GUI_CANCEL=§cAbbrechen +BAU_DELETE_GUI_DELETE=§aLöschen \ No newline at end of file From 518ba7bd35c783f31be8eb3a20c7663b1fc85a10 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 9 Dec 2020 07:11:20 +0100 Subject: [PATCH 06/11] Hotfix Signed-off-by: Lixfel --- .../bungeecore/commands/HelpCommand.java | 4 +-- .../steamwar/messages/BungeeCore.properties | 25 ++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/HelpCommand.java b/src/de/steamwar/bungeecore/commands/HelpCommand.java index 4d0e491..7394036 100644 --- a/src/de/steamwar/bungeecore/commands/HelpCommand.java +++ b/src/de/steamwar/bungeecore/commands/HelpCommand.java @@ -36,7 +36,7 @@ public class HelpCommand extends BasicCommand { if (args.length < 1) { Message.send("HELP_LOBBY", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_LOBBY_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/l")); Message.send("HELP_BAU", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/bau")); - Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bauserver")); + Message.send("HELP_BAUSERVER", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_BAUSERVER_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau")); Message.send("HELP_FIGHT", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_FIGHT_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/fight")); Message.send("HELP_CHALLENGE", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_CHALLENGE_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/challenge")); Message.send("HELP_HISTORIC", true, sender, ChatMessageType.SYSTEM, Message.parse("HELP_HISTORIC_HOVER", sender), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/historic")); @@ -104,7 +104,6 @@ public class HelpCommand extends BasicCommand { Message.send("HELP_BAU_TOGGLEWORLD", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TOGGLEWORLD_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau toggleworld ")); Message.send("HELP_BAU_DELETE", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_DELETE_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau delete ")); Message.send("HELP_BAU_TESTARENA", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_TESTARENA_HOVER", p), new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/bau testarena ")); - Message.send("HELP_BAU_BAU", true, p, ChatMessageType.SYSTEM, Message.parse("HELP_BAU_BAU_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help bau")); } static void sendBauHelpWorld(ProxiedPlayer p) { @@ -150,7 +149,6 @@ public class HelpCommand extends BasicCommand { Message.sendPrefixless("HELP_TESTBLOCK", p); Message.sendPrefixless("HELP_SKULL", p); Message.sendPrefixless("HELP_BAUINFO", p); - Message.sendPrefixless("HELP_BAUSERVER_SHORT", p); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 14172c9..e7ff281 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -9,7 +9,7 @@ HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück! HELP_LOBBY_HOVER=§eZurück zur Lobby HELP_BAU=§7Komme mit §8/§ebau §7auf den Bauserver! HELP_BAU_HOVER=§eZum Bauserver -HELP_BAUSERVER=§7Erhalte mit §8/§ehelp bauserver §7Hilfe zum Bauserver! +HELP_BAUSERVER=§7Erhalte mit §8/§ehelp bau §7Hilfe zum Bauserver! HELP_BAUSERVER_HOVER=§eHilfe zum Bauserver HELP_FIGHT=§7Starte mit §8/§efight §7einen neuen Kampf! HELP_FIGHT_HOVER=§eZum Kampfsystem @@ -32,24 +32,23 @@ 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_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_BAUSERVER_SHORT=§8/§ehelp bauserver §8- §7Hilfe zum Bauserver -HELP_WE_POS1=§8//§e1 §8» //§epos1 -HELP_WE_POS2=§8//§e2 §8» //§epos2 -HELP_WE_COPY=§8//§ec §8» //§ecopy -HELP_WE_PASTE=§8//§ep §8» //§epaste -HELP_WE_FLOPY=§8//§eflopy §8» //§ecopy §7& §8//§eflip -HELP_WE_FLOPYP=§8//§eflopyp §8» //§ecopy §7& §8//§eflip §7& §8//§epaste -HELP_WE_ROTATE_90=§8//§e90 §8» //§erotate 90 -HELP_WE_ROTATE_180=§8//§e180 §8» //§erotate 180 -HELP_WE_ROTATE_N90=§8//§e-90 §8» //§erotate -90 +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_BAU_GROUP_ADMIN=§7Bauserver-Verwaltungsbefehle HELP_BAU_GROUP_ADMIN_HOVER=§eAlle Verwaltungsbefehle @@ -83,8 +82,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] From ed79088560dd6dca5ca1ace9a69034d9a148f0de Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 10 Dec 2020 15:00:48 +0100 Subject: [PATCH 07/11] Add Ban Time to Banumgehungs message and moved Messages to properties --- .../bungeecore/listeners/BanListener.java | 37 +++++++++++-------- .../steamwar/messages/BungeeCore.properties | 3 ++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index c9aadb7..d996c90 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -20,6 +20,7 @@ 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; import net.md_5.bungee.api.ProxyServer; @@ -31,6 +32,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.LoginEvent; import net.md_5.bungee.event.EventHandler; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.format.DateTimeFormatter; import java.util.List; public class BanListener extends BasicListener { @@ -47,27 +51,28 @@ public class BanListener extends BasicListener { List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); if(!ips.isEmpty()){ - StringBuilder potentialBan = new StringBuilder(); - potentialBan.append(BungeeCore.CHAT_PREFIX); - potentialBan.append("§cMögliche Bannumgehung durch §r"); - potentialBan.append(user.getUserName()); - potentialBan.append("§c:"); - for(BannedUserIPs banned : ips){ - SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); - potentialBan.append(" §e"); - potentialBan.append(banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT)); - potentialBan.append(" §c"); - potentialBan.append(bannedUser.getUserName()); - } - - TextComponent msg = new TextComponent(potentialBan.toString()); - msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§cBanne Spieler wegen Bannumgehung").create())); - msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " perma Bannumgehung")); for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ if ((target.hasPermission("bungeecore.teamchat")) && (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY || target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN)){ + StringBuilder potentialBan = new StringBuilder(); + potentialBan.append(Message.parsePrefixed("BAN_AVOIDING_ALERT", target, user.getUserName())); + + Timestamp highestBan = Timestamp.from(Instant.now()); + for(BannedUserIPs banned : ips) { + SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); + potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getId(), + banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT), bannedUser.getUserName())); + if(highestBan.before(banned.getTimestamp())) + highestBan = banned.getTimestamp(); + } + + TextComponent msg = new TextComponent(potentialBan.toString()); + msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("BAN_AVOIDING_BAN_HOVER", target)).create())); + msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " " + + highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")) + + " Bannumgehung")); target.sendMessage(msg); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e7ff281..9e7e432 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -93,6 +93,9 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] ALERT=§f{0} BAN_MESSAGE_YOU=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} +BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§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} From dcff5ed22fabf4d39e4304caeaa84026d86f1a12 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 10 Dec 2020 15:17:25 +0100 Subject: [PATCH 08/11] Add Extending Ban of Account with same IP --- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 61625ea..66b1d36 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -214,6 +214,12 @@ public class SteamwarUser { if(player != null){ updateBanIP(player.getAddress().getAddress().getHostAddress()); player.disconnect(banMessage()); + 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); + } }else updateBanIP(""); } From 68ce7330ef4d3dc46677f1e0806b0bdc7a54f81a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 10 Dec 2020 19:18:50 +0100 Subject: [PATCH 09/11] Fixing Double Execution of Code --- .../bungeecore/listeners/BanListener.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index d996c90..810e95a 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -52,6 +52,15 @@ public class BanListener extends BasicListener { List ips = BannedUserIPs.get(event.getConnection().getAddress().getAddress().getHostAddress()); if(!ips.isEmpty()){ + Timestamp highestBan = Timestamp.from(Instant.now()); + for(BannedUserIPs banned : ips) { + if(highestBan.before(banned.getTimestamp())) + highestBan = banned.getTimestamp(); + } + ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " " + + highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")) + + " Bannumgehung"); + for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){ if ((target.hasPermission("bungeecore.teamchat")) && (target.getChatMode() == ProxiedPlayer.ChatMode.COMMANDS_ONLY @@ -59,20 +68,15 @@ public class BanListener extends BasicListener { StringBuilder potentialBan = new StringBuilder(); potentialBan.append(Message.parsePrefixed("BAN_AVOIDING_ALERT", target, user.getUserName())); - Timestamp highestBan = Timestamp.from(Instant.now()); for(BannedUserIPs banned : ips) { SteamwarUser bannedUser = SteamwarUser.get(banned.getUserID()); potentialBan.append(Message.parse("BAN_AVOIDING_LIST", target, bannedUser.getId(), banned.getTimestamp().toLocalDateTime().format(BungeeCore.DATE_FORMAT), bannedUser.getUserName())); - if(highestBan.before(banned.getTimestamp())) - highestBan = banned.getTimestamp(); } TextComponent msg = new TextComponent(potentialBan.toString()); msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(Message.parse("BAN_AVOIDING_BAN_HOVER", target)).create())); - msg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/ban " + user.getUserName() + " " - + highestBan.toLocalDateTime().format(DateTimeFormatter.ofPattern("dd.MM.yyyy_HH:mm")) - + " Bannumgehung")); + msg.setClickEvent(clickEvent); target.sendMessage(msg); } } From c0330635a6e5fddfa9488f9e5aa546de3220126c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 10 Dec 2020 19:31:28 +0100 Subject: [PATCH 10/11] Fixing Message --- src/de/steamwar/messages/BungeeCore.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9e7e432..0c537b1 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -93,8 +93,8 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] ALERT=§f{0} BAN_MESSAGE_YOU=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} -BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0}§c: -BAN_AVOIDING_LIST={0} §e{1} §c +BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0} +BAN_AVOIDING_LIST=§c: {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} From 95b5925b5fb85223d2a16fbda36f21cb2f744bc1 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 10 Dec 2020 19:35:43 +0100 Subject: [PATCH 11/11] Fixing Message Again... --- src/de/steamwar/messages/BungeeCore.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 0c537b1..dc2dbab 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -93,8 +93,8 @@ USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] ALERT=§f{0} BAN_MESSAGE_YOU=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} -BAN_AVOIDING_ALERT=§cMögliche Bannumgehung durch §r{0} -BAN_AVOIDING_LIST=§c: {0} §e{1} §c +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}