From 9cd7c1ac03018e7b777bc2069a0ed9079605b8df Mon Sep 17 00:00:00 2001 From: kamcio96 Date: Fri, 28 Feb 2014 22:44:48 +0100 Subject: [PATCH] Add ProxyReloadEvent --- .../bungee/api/event/ProxyReloadEvent.java | 22 +++++++++++++++++++ .../md_5/bungee/command/CommandReload.java | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 api/src/main/java/net/md_5/bungee/api/event/ProxyReloadEvent.java diff --git a/api/src/main/java/net/md_5/bungee/api/event/ProxyReloadEvent.java b/api/src/main/java/net/md_5/bungee/api/event/ProxyReloadEvent.java new file mode 100644 index 00000000..720a1834 --- /dev/null +++ b/api/src/main/java/net/md_5/bungee/api/event/ProxyReloadEvent.java @@ -0,0 +1,22 @@ +package net.md_5.bungee.api.event; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.EqualsAndHashCode; +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.plugin.Event; + +/** + * Called when somebody reloads BungeeCord + */ +@Getter +@AllArgsConstructor +@EqualsAndHashCode(callSuper = false) +public class ProxyReloadEvent extends Event +{ + + /** + * Creator of the action. + */ + private final CommandSender sender; +} diff --git a/proxy/src/main/java/net/md_5/bungee/command/CommandReload.java b/proxy/src/main/java/net/md_5/bungee/command/CommandReload.java index 437f0101..6d01f7a6 100644 --- a/proxy/src/main/java/net/md_5/bungee/command/CommandReload.java +++ b/proxy/src/main/java/net/md_5/bungee/command/CommandReload.java @@ -4,6 +4,7 @@ import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.plugin.Command; +import net.md_5.bungee.api.event.ProxyReloadEvent; public class CommandReload extends Command { @@ -19,6 +20,8 @@ public class CommandReload extends Command BungeeCord.getInstance().config.load(); BungeeCord.getInstance().stopListeners(); BungeeCord.getInstance().startListeners(); + BungeeCord.getInstance().getPluginManager().callEvent(new ProxyReloadEvent(sender)); + sender.sendMessage( ChatColor.BOLD.toString() + ChatColor.RED.toString() + "BungeeCord has been reloaded." + " This is NOT advisable and you will not be supported with any issues that arise! Please restart BungeeCord ASAP." ); }