From 8e51f13ba79d1e5be5e21718813ec42101163fa4 Mon Sep 17 00:00:00 2001 From: Hayden Watson <8919564+Mrweatherman208@users.noreply.github.com> Date: Thu, 4 Aug 2022 16:55:51 -0400 Subject: [PATCH] 6.0.1 Changes RC1 Updated comments and added new features! --- .classpath | 2 +- bin/.gitignore | 1 - bin/hjw/maintenanceannouncer/Listener.class | Bin 1899 -> 2061 bytes bin/hjw/maintenanceannouncer/Main.class | Bin 7552 -> 7611 bytes config.yml | 9 ++++++--- plugin.yml | 16 ++++++++-------- src/hjw/maintenanceannouncer/Listener.java | 20 +++++++++++++------- src/hjw/maintenanceannouncer/Main.java | 20 ++++++++++---------- 8 files changed, 38 insertions(+), 30 deletions(-) delete mode 100644 bin/.gitignore diff --git a/.classpath b/.classpath index 7cda3b6..f7666f0 100644 --- a/.classpath +++ b/.classpath @@ -1,7 +1,7 @@ - + diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index d57ae51..0000000 --- a/bin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/hjw/ diff --git a/bin/hjw/maintenanceannouncer/Listener.class b/bin/hjw/maintenanceannouncer/Listener.class index 691f70c601475d3e332d8e14579d9fbfdd39d9c5..876afefea0932f59869597819b1a67ab6f7814dc 100644 GIT binary patch delta 788 zcma)4O-~b16g_XIbcQ6n&+SGIW?RGgD$$Y}^?a z=B@Y_kdO*Aac$iBCv@Qta6w{xg^&W0FxS~@PxnfwKUCOR>4z(THDFRGKGBJ@M5VI>ZNSc zb~HT0bNz9_^uPN={7tNPM^sBeq? zWt1uS(=zQaYN@UE5)cq87RGu*MDSX?VoMco)a$52EzwFkjd5Y(FJNKL zibNCr2R0!UG#c0LT^ijR!^*fI5f4pV7&mU-ocH}sp7VZZHuP<+`SI7A_rM6Z>*gyV zKWJ&aoeue3vqh&&>RrKZdJHxTVsb@`MJ=|F60EuFcm=n5zwCMC2NgN)+h`So^pZB% zCTM>eiYIbTxnj{rzrgTnPPOLV5s0F}b~&pjOjF(7V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)p{Uv@a<5!|rTVnYQek*oscU%96=Vkm!1PjV6BX~h< zD5$oc(C{MuA_fXpoc}ise>ZTc$#e3>MI!yNeGR3sYQn9>uWR6L=Pm1Hqg=pmc9t+2XR!H_~+ zyF7;q4^Oej90|S8P6}?elZA>jDy9;G%*M_7Xo^*6T-vLUlW;-1XK;Q5<|4)8MPA`A zYHThiEIKtiE28%)#OzC298e|pysEO7NZZpl_^ zF_Wz_EBVLf<11dZl(gR^S(+WUGW>lgGS?qAT0yDb@sVt1gZ7VQ9mjJV@0fG^WRByf zO~;C6$6cm%=RCl{%u<{vEgLgQcy(kak&x@Ukc2F@&zTkX`W;`$;@N3Za<@r|q38Cw z*%>=!cn+Z=EBSKAYSY~uHNT+q(a%=4ql%gO{xp8X7k&m$_4p?7^G<)jH;re+k;N;Wzr(W} z;N)b#$8(%I54Q`&*x}kzRaC9MI-|PdNyVgk#vAe=4?sBzyN@)?}Fy5LHjdQV z%!qKMTZ~q1dJ`Cu9iYSm3ZH>QPT PYLWP7{vr;}ql;ewK>}C} diff --git a/config.yml b/config.yml index 797a1b1..97440b3 100644 --- a/config.yml +++ b/config.yml @@ -10,19 +10,22 @@ Allow reloads to Maintenance Announcer: true # Tell players about server maintenance when they join the server. (default: true) Tell players about server maintenance on join: true +# Tell admins about server maintenance when they join the server. (default: true) +Tell admins about server maintenance on join: true + # ----Message Customization------------------------------------------------------------------ # Here's where you can customize every message. Maintenance has started: '&f Maintenance to the server has started. Please excuse any lag.' Maintenance has ended: '&f Maintenance to the server has ended. Thanks for your patience.' Invalid argument message: '&a Invalid Argument! Args: start, begin, stop, end, admin start, admin begin, admin stop, admin end, reload.' -Maintenance ongoing message: '&f The server is currently undergoing maintenance. Please excuse any lag.' -Maintenance not ongoing message: '&f The server is not currently undergoing maintenance.' +Maintenance ongoing message: '&f The server is currently under maintenance. Please excuse any lag.' +Maintenance not ongoing message: '&f The server is not currently under any maintenance.' Prefix: '&c[Maintenance Announcer]' Admin only prefix: '&c[Maintenance Announcer (ADMIN ONLY)]' Sent to all admins message: '&a Sent to ALL admins!' Too many arguments message: '&a Too many arguments were entered!' # Made with love in Tennessee. -# Copyright 2016 - 2021 Hayden Watson. +# Copyright 2016 - 2022 Hayden Watson. # Maintenance Announcer is available under the MIT license. \ No newline at end of file diff --git a/plugin.yml b/plugin.yml index 67cb6a9..357e41d 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: MaintenanceAnnouncer author: Hayden Watson -version: 6.0 +version: 6.0.1 website: https://haydenwatson.co/maintenance-announcer prefix: Maintenance Announcer main: hjw.maintenanceannouncer.Main @@ -9,7 +9,7 @@ database: false commands: maintenance: - description: Check if the server is undergoing maintenance. + description: Check if the server is under maintenance. permission: hjw.maintenanceannouncer.see maintenance start: description: Broadcast to players that maintenance has started. @@ -23,11 +23,11 @@ commands: description: Check if the server is undergoing maintenance (admin only). permission: hjw.maintenanceannouncer.adminsee maintenance admin start: - description: Broadcast to only admins that maintenance has started. + description: Broadcast to admins only that maintenance has started. permission: hjw.maintenanceannouncer.adminstart aliases: [admin begin] maintenance admin end: - description: Broadcast to only admins that maintenance has ended. + description: Broadcast to admins only that maintenance has ended. permission: hjw.maintenanceannouncer.adminend aliases: [admin stop] maintenance reload: @@ -46,7 +46,7 @@ permissions: hjw.maintenanceannouncer.adminend: true hjw.maintenanceannouncer.reload: true hjw.maintenanceannouncer.see: - description: Allows you to see there is server maintenance going on. + description: Allows you to see if server maintenance is going on. default: true hjw.maintenanceannouncer.start: description: Allows broadcasting that maintenance has started. @@ -55,13 +55,13 @@ permissions: description: Allows broadcasting that maintenance has ended. default: op hjw.maintenanceannouncer.adminsee: - description: Allows you to see there is admin only server maintenance going on. + description: Allows you to see if admin only server maintenance is going on. default: op hjw.maintenanceannouncer.adminstart: - description: Allows broadcasting that maintenance has started to only admins. + description: Allows broadcasting that maintenance has started to admins only. default: op hjw.maintenanceannouncer.adminend: - description: Allows broadcasting that maintenance has ended to only admins. + description: Allows broadcasting that maintenance has ended to admins only. default: op hjw.maintenanceannouncer.reload: description: Reloads the plugin. diff --git a/src/hjw/maintenanceannouncer/Listener.java b/src/hjw/maintenanceannouncer/Listener.java index 29fa3d9..2d8caba 100644 --- a/src/hjw/maintenanceannouncer/Listener.java +++ b/src/hjw/maintenanceannouncer/Listener.java @@ -15,14 +15,20 @@ public Listener(Main plugin) { @EventHandler private void onPlayerJoin(PlayerJoinEvent event) { - // This feature automatically notifies players when they join on whether or not maintenance is ongoing to the server at the current moment. - if(event.getPlayer().hasPermission("hjw.maintenanceannouncer.see") && plugin.started == true) { - event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Prefix") + plugin.getConfig().getString("Maintenance ongoing message"))); + // Check config file for if Maintenance Announcer should tell players about server maintenance on join. + if (plugin.getConfig().getBoolean("Tell players about server maintenance on join") == true) { + // This feature automatically notifies players when they join on whether or not maintenance is ongoing to the server at the current moment. + if(event.getPlayer().hasPermission("hjw.maintenanceannouncer.see") && plugin.started == true) { + event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Prefix") + plugin.getConfig().getString("Maintenance ongoing message"))); + } } - - // Check if user can see if admin only maintenance has started. - if(event.getPlayer().hasPermission("hjw.maintenanceannouncer.adminsee") && plugin.adminOnlyStarted == true) { - event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Admin only prefix") + plugin.getConfig().getString("Maintenance ongoing message"))); + + // Check config file for if Maintenance Announcer should tell admins about server maintenance on join. + if(plugin.getConfig().getBoolean("Tell admins about server maintenance on join") == true) { + // Check if user can see if admin only maintenance has started. + if(event.getPlayer().hasPermission("hjw.maintenanceannouncer.adminsee") && plugin.adminOnlyStarted == true) { + event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("Admin only prefix") + plugin.getConfig().getString("Maintenance ongoing message"))); + } } } } \ No newline at end of file diff --git a/src/hjw/maintenanceannouncer/Main.java b/src/hjw/maintenanceannouncer/Main.java index 8f37c2b..bd4314b 100755 --- a/src/hjw/maintenanceannouncer/Main.java +++ b/src/hjw/maintenanceannouncer/Main.java @@ -12,8 +12,8 @@ public class Main extends JavaPlugin { - public boolean started = false; // Var for if the maintenance to the server is active. - public boolean adminOnlyStarted = false; // Var for if the admin only maintenance to the server is active. + public boolean started = false; // Bool for if the maintenance to the server is active. + public boolean adminOnlyStarted = false; // Bool for if the admin only maintenance to the server is active. private String prefix = "[Maintenance Announcer]"; private String adminOnlyPrefix = "[Maintenance Announcer (ADMIN ONLY)]"; @@ -33,8 +33,8 @@ public void onEnable() { adminOnlyStarted = true; } - if (getConfig().getBoolean("Tell players about server maintenance on join") == true) { - startEvent(); + if ((getConfig().getBoolean("Tell players about server maintenance on join") == true) || (getConfig().getBoolean("Tell admins about server maintenance on join") == true)) { + startEvent(); // Start the listener for telling player or admins that the server is under maintenance. } // Load customized prefixes from the config file. @@ -192,8 +192,8 @@ private void startMaintenance() { started = true; // Save that maintenance to the server has started to the config file. - getConfig().set("Maintenance", true); - saveConfig(); + getConfig().set("Maintenance", true); // Set "Maintenance" Bool as true. + saveConfig(); // Saves changes to the config file. // Broadcast that maintenance has started to all the players. for (Player player : Bukkit.getServer().getOnlinePlayers()) { @@ -202,7 +202,7 @@ private void startMaintenance() { } } - getLogger().info("A maintenance started announcement to the server was made!"); + getLogger().info("A maintenance start announcement to the server was made!"); } @@ -220,7 +220,7 @@ private void endMaintenance() { } } - getLogger().info("A maintenance ended announcement to the server was made!"); + getLogger().info("A maintenance end announcement to the server was made!"); } @@ -237,7 +237,7 @@ private void startAdminMaintenance() { } } - getLogger().info("An admin only maintenance started announcement to the server was made!"); + getLogger().info("An *admin only* maintenance start announcement to the server was made!"); } @@ -256,7 +256,7 @@ private void stopAdminMaintenance() { } } - getLogger().info("An admin only maintenance ended announcement to the server was made!"); + getLogger().info("An *admin only* maintenance end announcement to the server was made!"); } private void createConfig() {