Removing chached plugin refferences and got rid of another listener.

This commit is contained in:
Olof Larsson 2013-04-10 12:32:21 +02:00
parent 75ec92fb7d
commit 44493bbea3
7 changed files with 21 additions and 68 deletions

View File

@ -21,7 +21,6 @@ import com.massivecraft.factions.listeners.FactionsChatListener;
import com.massivecraft.factions.listeners.FactionsEntityListener; import com.massivecraft.factions.listeners.FactionsEntityListener;
import com.massivecraft.factions.listeners.FactionsExploitListener; import com.massivecraft.factions.listeners.FactionsExploitListener;
import com.massivecraft.factions.listeners.FactionsPlayerListener; import com.massivecraft.factions.listeners.FactionsPlayerListener;
import com.massivecraft.factions.listeners.FactionsServerListener;
import com.massivecraft.factions.util.AutoLeaveTask; import com.massivecraft.factions.util.AutoLeaveTask;
import com.massivecraft.factions.util.EconLandRewardTask; import com.massivecraft.factions.util.EconLandRewardTask;
import com.massivecraft.factions.util.LazyLocation; import com.massivecraft.factions.util.LazyLocation;
@ -53,7 +52,6 @@ public class Factions extends MPlugin
public FactionsEntityListener entityListener; public FactionsEntityListener entityListener;
public FactionsExploitListener exploitListener; public FactionsExploitListener exploitListener;
public FactionsBlockListener blockListener; public FactionsBlockListener blockListener;
public FactionsServerListener serverListener;
// Persistance related // Persistance related
private boolean locked = false; private boolean locked = false;
@ -109,24 +107,21 @@ public class Factions extends MPlugin
// Register Event Handlers // Register Event Handlers
MainListener.get().setup(); MainListener.get().setup();
this.playerListener = new FactionsPlayerListener(this); this.playerListener = new FactionsPlayerListener();
getServer().getPluginManager().registerEvents(this.playerListener, this); getServer().getPluginManager().registerEvents(this.playerListener, this);
this.chatListener = new FactionsChatListener(this); this.chatListener = new FactionsChatListener();
getServer().getPluginManager().registerEvents(this.chatListener, this); getServer().getPluginManager().registerEvents(this.chatListener, this);
this.entityListener = new FactionsEntityListener(this); this.entityListener = new FactionsEntityListener();
getServer().getPluginManager().registerEvents(this.entityListener, this); getServer().getPluginManager().registerEvents(this.entityListener, this);
this.exploitListener = new FactionsExploitListener(); this.exploitListener = new FactionsExploitListener();
getServer().getPluginManager().registerEvents(this.exploitListener, this); getServer().getPluginManager().registerEvents(this.exploitListener, this);
this.blockListener = new FactionsBlockListener(this); this.blockListener = new FactionsBlockListener();
getServer().getPluginManager().registerEvents(this.blockListener, this); getServer().getPluginManager().registerEvents(this.blockListener, this);
this.serverListener = new FactionsServerListener(this);
getServer().getPluginManager().registerEvents(this.serverListener, this);
postEnable(); postEnable();
this.loadSuccessful = true; this.loadSuccessful = true;
} }

View File

@ -11,6 +11,8 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
@ -37,6 +39,20 @@ public class MainListener implements Listener
// SPOUT // 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 // Standard
public static void spoutStandard(Player player) public static void spoutStandard(Player player)

View File

@ -22,17 +22,10 @@ import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
public class FactionsBlockListener implements Listener public class FactionsBlockListener implements Listener
{ {
public Factions p;
public FactionsBlockListener(Factions p)
{
this.p = p;
}
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onBlockSpread(BlockSpreadEvent event) public void onBlockSpread(BlockSpreadEvent event)
{ {

View File

@ -29,11 +29,6 @@ import com.massivecraft.factions.Rel;
public class FactionsChatListener implements Listener public class FactionsChatListener implements Listener
{ {
public Factions p;
public FactionsChatListener(Factions p)
{
this.p = p;
}
public static Field fieldRegisteredListenerDotPriority; public static Field fieldRegisteredListenerDotPriority;
public static final Pattern parsePattern; public static final Pattern parsePattern;

View File

@ -45,19 +45,12 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Faction; import com.massivecraft.factions.Faction;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.event.PowerLossEvent; import com.massivecraft.factions.event.PowerLossEvent;
public class FactionsEntityListener implements Listener public class FactionsEntityListener implements Listener
{ {
public Factions p;
public FactionsEntityListener(Factions p)
{
this.p = p;
}
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onEntityDeath(EntityDeathEvent event) public void onEntityDeath(EntityDeathEvent event)

View File

@ -31,7 +31,6 @@ import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayerColl; import com.massivecraft.factions.FPlayerColl;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
@ -40,12 +39,6 @@ import com.massivecraft.factions.util.VisualizeUtil;
public class FactionsPlayerListener implements Listener public class FactionsPlayerListener implements Listener
{ {
public Factions p;
public FactionsPlayerListener(Factions p)
{
this.p = p;
}
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) public void onPlayerJoin(PlayerJoinEvent event)
{ {

View File

@ -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();
}
}