mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-08-31 08:49:35 +02:00
Update our MCore event handlers to use the newer Bukkit event system
This commit is contained in:
parent
fbbf0a12af
commit
8e96a75b56
|
@ -74,11 +74,8 @@ public abstract class MPlugin extends JavaPlugin
|
|||
// Create and register listeners
|
||||
this.mPluginSecretPlayerListener = new MPluginSecretPlayerListener(this);
|
||||
this.mPluginSecretServerListener = new MPluginSecretServerListener(this);
|
||||
PluginManager pm = this.getServer().getPluginManager();
|
||||
pm.registerEvent(Event.Type.PLAYER_PRELOGIN, this.mPluginSecretPlayerListener, Event.Priority.Lowest, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_CHAT, this.mPluginSecretPlayerListener, Event.Priority.Low, this);
|
||||
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, this.mPluginSecretPlayerListener, Event.Priority.Low, this);
|
||||
pm.registerEvent(Event.Type.SERVER_COMMAND, this.mPluginSecretServerListener, Event.Priority.Lowest, this);
|
||||
getServer().getPluginManager().registerEvents(this.mPluginSecretPlayerListener, this);
|
||||
getServer().getPluginManager().registerEvents(this.mPluginSecretServerListener, this);
|
||||
|
||||
|
||||
// Register recurring tasks
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.massivecraft.factions.zcore;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||
|
||||
import com.massivecraft.factions.zcore.persist.EM;
|
||||
|
@ -11,7 +13,7 @@ import com.massivecraft.factions.zcore.persist.Entity;
|
|||
import com.massivecraft.factions.zcore.persist.EntityCollection;
|
||||
import com.massivecraft.factions.zcore.persist.PlayerEntityCollection;
|
||||
|
||||
public class MPluginSecretPlayerListener extends PlayerListener
|
||||
public class MPluginSecretPlayerListener implements Listener
|
||||
{
|
||||
private MPlugin p;
|
||||
public MPluginSecretPlayerListener(MPlugin p)
|
||||
|
@ -19,7 +21,7 @@ public class MPluginSecretPlayerListener extends PlayerListener
|
|||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.isCancelled()) return;
|
||||
|
@ -31,7 +33,7 @@ public class MPluginSecretPlayerListener extends PlayerListener
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerChat(PlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled()) return;
|
||||
|
@ -43,7 +45,7 @@ public class MPluginSecretPlayerListener extends PlayerListener
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerPreLogin(PlayerPreLoginEvent event)
|
||||
{
|
||||
for (EntityCollection<? extends Entity> ecoll : EM.class2Entities.values())
|
||||
|
|
|
@ -2,10 +2,12 @@ package com.massivecraft.factions.zcore;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
import org.bukkit.event.server.ServerListener;
|
||||
|
||||
public class MPluginSecretServerListener extends ServerListener
|
||||
public class MPluginSecretServerListener implements Listener
|
||||
{
|
||||
private MPlugin p;
|
||||
private String refCommand;
|
||||
|
@ -27,7 +29,7 @@ public class MPluginSecretServerListener extends ServerListener
|
|||
catch (ClassCastException ex) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onServerCommand(ServerCommandEvent event)
|
||||
{
|
||||
if (event.getCommand().length() == 0) return;
|
||||
|
|
Loading…
Reference in New Issue
Block a user