Listeners should be MassiveCore engines.

This commit is contained in:
Olof Larsson 2014-10-08 06:24:37 +02:00
parent 48bda6a2df
commit 54e04fee88
5 changed files with 34 additions and 22 deletions

View File

@ -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.

View File

@ -42,7 +42,8 @@ public class MConf extends Entity<MConf>
if (!Factions.get().isDatabaseInitialized()) return this;
FactionsListenerChat.get().setup();
FactionsListenerChat.get().deactivate();
FactionsListenerChat.get().activate();
return this;
}

View File

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

View File

@ -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
}
}
}
}

View File

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