From 44493bbea3bf75ece34b376e9d814bd05eec8ea1 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 10 Apr 2013 12:32:21 +0200 Subject: [PATCH] Removing chached plugin refferences and got rid of another listener. --- src/com/massivecraft/factions/Factions.java | 13 +++----- .../massivecraft/factions/MainListener.java | 16 ++++++++++ .../listeners/FactionsBlockListener.java | 9 +----- .../listeners/FactionsChatListener.java | 5 --- .../listeners/FactionsEntityListener.java | 7 ---- .../listeners/FactionsPlayerListener.java | 7 ---- .../listeners/FactionsServerListener.java | 32 ------------------- 7 files changed, 21 insertions(+), 68 deletions(-) delete mode 100644 src/com/massivecraft/factions/listeners/FactionsServerListener.java diff --git a/src/com/massivecraft/factions/Factions.java b/src/com/massivecraft/factions/Factions.java index 4c9f0367..d47227ee 100644 --- a/src/com/massivecraft/factions/Factions.java +++ b/src/com/massivecraft/factions/Factions.java @@ -21,7 +21,6 @@ import com.massivecraft.factions.listeners.FactionsChatListener; import com.massivecraft.factions.listeners.FactionsEntityListener; import com.massivecraft.factions.listeners.FactionsExploitListener; import com.massivecraft.factions.listeners.FactionsPlayerListener; -import com.massivecraft.factions.listeners.FactionsServerListener; import com.massivecraft.factions.util.AutoLeaveTask; import com.massivecraft.factions.util.EconLandRewardTask; import com.massivecraft.factions.util.LazyLocation; @@ -53,7 +52,6 @@ public class Factions extends MPlugin public FactionsEntityListener entityListener; public FactionsExploitListener exploitListener; public FactionsBlockListener blockListener; - public FactionsServerListener serverListener; // Persistance related private boolean locked = false; @@ -109,24 +107,21 @@ public class Factions extends MPlugin // Register Event Handlers MainListener.get().setup(); - this.playerListener = new FactionsPlayerListener(this); + this.playerListener = new FactionsPlayerListener(); getServer().getPluginManager().registerEvents(this.playerListener, this); - this.chatListener = new FactionsChatListener(this); + this.chatListener = new FactionsChatListener(); getServer().getPluginManager().registerEvents(this.chatListener, this); - this.entityListener = new FactionsEntityListener(this); + this.entityListener = new FactionsEntityListener(); getServer().getPluginManager().registerEvents(this.entityListener, this); this.exploitListener = new FactionsExploitListener(); getServer().getPluginManager().registerEvents(this.exploitListener, this); - this.blockListener = new FactionsBlockListener(this); + this.blockListener = new FactionsBlockListener(); getServer().getPluginManager().registerEvents(this.blockListener, this); - this.serverListener = new FactionsServerListener(this); - getServer().getPluginManager().registerEvents(this.serverListener, this); - postEnable(); this.loadSuccessful = true; } diff --git a/src/com/massivecraft/factions/MainListener.java b/src/com/massivecraft/factions/MainListener.java index a8f3c6b9..94ebe32d 100644 --- a/src/com/massivecraft/factions/MainListener.java +++ b/src/com/massivecraft/factions/MainListener.java @@ -11,6 +11,8 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.server.PluginDisableEvent; +import org.bukkit.event.server.PluginEnableEvent; import com.massivecraft.factions.integration.SpoutFeatures; @@ -37,6 +39,20 @@ public class MainListener implements Listener // SPOUT // -------------------------------------------- // + // Setup + + @EventHandler(priority = EventPriority.MONITOR) + public void spoutSetup(PluginDisableEvent event) + { + SpoutFeatures.setup(); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void spoutSetup(PluginEnableEvent event) + { + SpoutFeatures.setup(); + } + // Standard public static void spoutStandard(Player player) diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index 757f5a28..aab4d112 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -22,17 +22,10 @@ import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; public class FactionsBlockListener implements Listener -{ - public Factions p; - public FactionsBlockListener(Factions p) - { - this.p = p; - } - +{ @EventHandler(priority = EventPriority.NORMAL) public void onBlockSpread(BlockSpreadEvent event) { diff --git a/src/com/massivecraft/factions/listeners/FactionsChatListener.java b/src/com/massivecraft/factions/listeners/FactionsChatListener.java index dcb10bb1..f58dfe1d 100644 --- a/src/com/massivecraft/factions/listeners/FactionsChatListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsChatListener.java @@ -29,11 +29,6 @@ import com.massivecraft.factions.Rel; public class FactionsChatListener implements Listener { - public Factions p; - public FactionsChatListener(Factions p) - { - this.p = p; - } public static Field fieldRegisteredListenerDotPriority; public static final Pattern parsePattern; diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index fd3f91ce..a88d7b25 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -45,19 +45,12 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.Factions; import com.massivecraft.factions.Rel; import com.massivecraft.factions.event.PowerLossEvent; public class FactionsEntityListener implements Listener { - public Factions p; - public FactionsEntityListener(Factions p) - { - this.p = p; - } - @EventHandler(priority = EventPriority.NORMAL) public void onEntityDeath(EntityDeathEvent event) diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 49caeca1..5ee08965 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -31,7 +31,6 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayerColl; -import com.massivecraft.factions.Factions; import com.massivecraft.factions.Rel; import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.integration.SpoutFeatures; @@ -40,12 +39,6 @@ import com.massivecraft.factions.util.VisualizeUtil; public class FactionsPlayerListener implements Listener { - public Factions p; - public FactionsPlayerListener(Factions p) - { - this.p = p; - } - @EventHandler(priority = EventPriority.NORMAL) public void onPlayerJoin(PlayerJoinEvent event) { diff --git a/src/com/massivecraft/factions/listeners/FactionsServerListener.java b/src/com/massivecraft/factions/listeners/FactionsServerListener.java deleted file mode 100644 index 929637df..00000000 --- a/src/com/massivecraft/factions/listeners/FactionsServerListener.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.massivecraft.factions.listeners; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.server.PluginDisableEvent; -import org.bukkit.event.server.PluginEnableEvent; - -import com.massivecraft.factions.Factions; -import com.massivecraft.factions.integration.SpoutFeatures; - - -public class FactionsServerListener implements Listener -{ - public Factions p; - public FactionsServerListener(Factions p) - { - this.p = p; - } - - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginDisable(PluginDisableEvent event) - { - SpoutFeatures.setup(); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void onPluginEnable(PluginEnableEvent event) - { - SpoutFeatures.setup(); - } -} \ No newline at end of file