Update our MCore event handlers to use the newer Bukkit event system
This commit is contained in:
parent
3ed879ca18
commit
f182f70371
@ -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.Lowest, 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,8 +1,10 @@
|
||||
package com.massivecraft.factions.zcore;
|
||||
|
||||
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;
|
||||
@ -10,7 +12,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)
|
||||
@ -18,7 +20,7 @@ public class MPluginSecretPlayerListener extends PlayerListener
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.isCancelled()) return;
|
||||
@ -29,7 +31,7 @@ public class MPluginSecretPlayerListener extends PlayerListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerChat(PlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled()) return;
|
||||
@ -40,7 +42,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