diff --git a/src/main/java/com/massivecraft/factions/Factions.java b/src/main/java/com/massivecraft/factions/Factions.java index 0d0cc15e..8dd5f8ac 100644 --- a/src/main/java/com/massivecraft/factions/Factions.java +++ b/src/main/java/com/massivecraft/factions/Factions.java @@ -135,9 +135,9 @@ public class Factions extends MassivePlugin this.outerCmdFactions.register(); // Setup Listeners - FactionsListenerMain.get().setup(); - FactionsListenerChat.get().setup(); - FactionsListenerExploit.get().setup(); + FactionsListenerMain.get().activate(); + FactionsListenerChat.get().activate(); + FactionsListenerExploit.get().activate(); EngineIdUpdate.get().activate(); // TODO: This listener is a work in progress. diff --git a/src/main/java/com/massivecraft/factions/entity/MConf.java b/src/main/java/com/massivecraft/factions/entity/MConf.java index 9e456439..de31b71d 100644 --- a/src/main/java/com/massivecraft/factions/entity/MConf.java +++ b/src/main/java/com/massivecraft/factions/entity/MConf.java @@ -42,7 +42,8 @@ public class MConf extends Entity if (!Factions.get().isDatabaseInitialized()) return this; - FactionsListenerChat.get().setup(); + FactionsListenerChat.get().deactivate(); + FactionsListenerChat.get().activate(); return this; } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerChat.java b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerChat.java index 79cdc06f..81b6750b 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerChat.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerChat.java @@ -4,17 +4,18 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event; import org.bukkit.event.EventException; import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.EventExecutor; +import org.bukkit.plugin.Plugin; import com.massivecraft.factions.Factions; import com.massivecraft.factions.chat.ChatFormatter; import com.massivecraft.factions.entity.MConf; +import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat; -public class FactionsListenerChat implements Listener +public class FactionsListenerChat extends EngineAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT @@ -24,12 +25,19 @@ public class FactionsListenerChat implements Listener public static FactionsListenerChat get() { return i; } // -------------------------------------------- // - // SETUP + // OVERRIDE // -------------------------------------------- // - public void setup() + @Override + public Plugin getPlugin() { - HandlerList.unregisterAll(this); + return Factions.get(); + } + + @Override + public void activate() + { + super.activate(); if (MConf.get().chatSetFormat) { @@ -45,7 +53,6 @@ public class FactionsListenerChat implements Listener { Bukkit.getPluginManager().registerEvent(EventMassiveCorePlayerToRecipientChat.class, this, EventPriority.NORMAL, new ParseRelcolorEventExecutor(), Factions.get(), true); } - } // -------------------------------------------- // diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerExploit.java b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerExploit.java index 16574323..962f3175 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerExploit.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerExploit.java @@ -9,17 +9,17 @@ import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.Bukkit; +import org.bukkit.event.EventPriority; +import org.bukkit.plugin.Plugin; import org.bukkit.Location; import org.bukkit.Material; import com.massivecraft.factions.Factions; import com.massivecraft.factions.entity.MConf; +import com.massivecraft.massivecore.EngineAbstract; -public class FactionsListenerExploit implements Listener +public class FactionsListenerExploit extends EngineAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT @@ -29,12 +29,13 @@ public class FactionsListenerExploit implements Listener public static FactionsListenerExploit get() { return i; } // -------------------------------------------- // - // SETUP + // OVERRIDE // -------------------------------------------- // - public void setup() + @Override + public Plugin getPlugin() { - Bukkit.getPluginManager().registerEvents(this, Factions.get()); + return Factions.get(); } // -------------------------------------------- // @@ -135,4 +136,5 @@ public class FactionsListenerExploit implements Listener } } } + } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java index 34fbc0da..b4c3d3b5 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -22,7 +22,6 @@ import org.bukkit.entity.Wither; import org.bukkit.event.Cancellable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBurnEvent; @@ -56,6 +55,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerRespawnEvent; +import org.bukkit.plugin.Plugin; import org.bukkit.projectiles.ProjectileSource; import com.massivecraft.factions.Factions; @@ -72,6 +72,7 @@ import com.massivecraft.factions.event.EventFactionsPvpDisallowed; import com.massivecraft.factions.event.EventFactionsPowerChange; import com.massivecraft.factions.event.EventFactionsPowerChange.PowerChangeReason; import com.massivecraft.factions.util.VisualizeUtil; +import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave; import com.massivecraft.massivecore.mixin.Mixin; import com.massivecraft.massivecore.ps.PS; @@ -79,7 +80,7 @@ import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.PlayerUtil; import com.massivecraft.massivecore.util.Txt; -public class FactionsListenerMain implements Listener +public class FactionsListenerMain extends EngineAbstract { // -------------------------------------------- // // INSTANCE & CONSTRUCT @@ -90,12 +91,13 @@ public class FactionsListenerMain implements Listener public FactionsListenerMain() {} // -------------------------------------------- // - // SETUP + // OVERRIDE // -------------------------------------------- // - public void setup() + @Override + public Plugin getPlugin() { - Bukkit.getPluginManager().registerEvents(this, Factions.get()); + return Factions.get(); } // -------------------------------------------- //