From 0234e0d2e0f7f9132494552e18102a1638ebcc0b Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 3 Jan 2021 15:18:00 +0100 Subject: [PATCH 1/2] Add Hover to Check Reminder and Reminder on Connection --- src/de/steamwar/bungeecore/commands/CheckCommand.java | 10 +++++++++- .../bungeecore/listeners/ConnectionListener.java | 5 ++++- src/de/steamwar/messages/BungeeCore.properties | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index 9aaed51..7ee3024 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -68,9 +68,17 @@ public class CheckCommand extends BasicCommand { ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { List schematics = getSchemsToCheck(); if(schematics.size() != currentCheckers.size()) - Message.team("CHECK_REMINDER", schematics.size() - currentCheckers.size()); + for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ + if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) + BungeeCore.send(player, Message.parse("CHECK_REMINDER", player, schematics.size() - currentCheckers.size()), Message.parse("CHECK_REMINDER_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list")); + } }, 10, 10, TimeUnit.MINUTES); } + public static void sendReminder(ProxiedPlayer player) { + List schematics = getSchemsToCheck(); + if(schematics.size() != currentCheckers.size()) + BungeeCore.send(player, Message.parse("CHECK_REMINDER", player, schematics.size() - currentCheckers.size()), Message.parse("CHECK_REMINDER_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list")); + } @Override public void execute(CommandSender sender, String[] args) { diff --git a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java index 0deb468..b872730 100644 --- a/src/de/steamwar/bungeecore/listeners/ConnectionListener.java +++ b/src/de/steamwar/bungeecore/listeners/ConnectionListener.java @@ -23,6 +23,7 @@ import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Servertype; import de.steamwar.bungeecore.Subserver; import de.steamwar.bungeecore.commands.ChallengeCommand; +import de.steamwar.bungeecore.commands.CheckCommand; import de.steamwar.bungeecore.commands.MsgCommand; import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.UserGroup; @@ -65,8 +66,10 @@ public class ConnectionListener extends BasicListener { if(user.getUserGroup().isAdminGroup()) player.addGroups(ADMIN_GROUP); - if(user.getUserGroup().isTeamGroup()) + if(user.getUserGroup().isTeamGroup()) { player.addGroups(TEAM_GROUP); + CheckCommand.sendReminder(player); + } if(user.getUserGroup().isCheckSchematics()) player.setPermission(CHECK_PERMISSION, true); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 0b11312..aeca89b 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -122,6 +122,7 @@ BAU_DELETE_GUI_DELETE=§aLöschen #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! +CHECK_REMINDER_HOVER=§eZuprüfende Schematics CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. CHECK_HELP_LIST=§8/§echeck list §8- §7Zeigt die Liste der ungeprüften Schematics CHECK_HELP_NEXT=§8/§echeck next §8- §7Nächste Prüffrage§8/§7freigeben From 3ec2e103b594492c75d2f684d6fb8be009170a02 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 13 Apr 2021 14:53:41 +0200 Subject: [PATCH 2/2] Fixed Schem Alert --- src/de/steamwar/bungeecore/Message.java | 7 +++++++ src/de/steamwar/bungeecore/commands/CheckCommand.java | 7 ++----- src/de/steamwar/messages/BungeeCore.properties | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/Message.java b/src/de/steamwar/bungeecore/Message.java index 65f1dec..5239bd8 100644 --- a/src/de/steamwar/bungeecore/Message.java +++ b/src/de/steamwar/bungeecore/Message.java @@ -129,4 +129,11 @@ public class Message { sendPrefixless(message, player, type, params); } } + + public static void team(String message, String onHover, ClickEvent onClick, Object... params){ + for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ + if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) + sendPrefixless(message, player, Message.parse(onHover, player, params), onClick, params); + } + } } \ No newline at end of file diff --git a/src/de/steamwar/bungeecore/commands/CheckCommand.java b/src/de/steamwar/bungeecore/commands/CheckCommand.java index 7ee3024..74dbbb8 100644 --- a/src/de/steamwar/bungeecore/commands/CheckCommand.java +++ b/src/de/steamwar/bungeecore/commands/CheckCommand.java @@ -68,16 +68,13 @@ public class CheckCommand extends BasicCommand { ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> { List schematics = getSchemsToCheck(); if(schematics.size() != currentCheckers.size()) - for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()){ - if(player.getGroups().contains(ConnectionListener.TEAM_GROUP)) - BungeeCore.send(player, Message.parse("CHECK_REMINDER", player, schematics.size() - currentCheckers.size()), Message.parse("CHECK_REMINDER_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list")); - } + Message.team("CHECK_REMINDER", "CHECK_REMINDER_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list"), schematics.size() - currentCheckers.size()); }, 10, 10, TimeUnit.MINUTES); } public static void sendReminder(ProxiedPlayer player) { List schematics = getSchemsToCheck(); if(schematics.size() != currentCheckers.size()) - BungeeCore.send(player, Message.parse("CHECK_REMINDER", player, schematics.size() - currentCheckers.size()), Message.parse("CHECK_REMINDER_HOVER", player), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list")); + Message.send("CHECK_REMINDER", player, "CHECK_REMINDER_HOVER", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check list"), schematics.size() - currentCheckers.size()); } @Override diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index aeca89b..25babec 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -122,7 +122,7 @@ BAU_DELETE_GUI_DELETE=§aLöschen #CheckCommand CHECK_REMINDER=§7Es sind §e{0} §7Schematics zu prüfen§8! -CHECK_REMINDER_HOVER=§eZuprüfende Schematics +CHECK_REMINDER_HOVER=§eZu prüfende Schematics CHECK_NOT_CHECKING=§cDu prüfst derzeit nicht. CHECK_HELP_LIST=§8/§echeck list §8- §7Zeigt die Liste der ungeprüften Schematics CHECK_HELP_NEXT=§8/§echeck next §8- §7Nächste Prüffrage§8/§7freigeben @@ -146,4 +146,4 @@ CHECK_RANK_HOVER=§aMit diesem Rang freigeben CHECK_ACCEPTED=§aDein §e{0} {1} §ewurde freigegeben§8! CHECK_ACCEPTED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7ist nun freigegeben! CHECK_DECLINED=§cDein §e{0} {1} §cwurde abgelehnt§8: §c{2} -CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von §e{2} §7abgelehnt! \ No newline at end of file +CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §7wurde aufgrund von §e{2} §7abgelehnt! \ No newline at end of file