mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-03 19:56:40 +00:00
Updated the remaining Listeners to the new event system.
This commit is contained in:
@ -30,7 +30,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
@ -71,8 +70,7 @@ public class CommandRegistration {
|
||||
Bukkit.getServer().getLogger().severe(plugin.getDescription().getName() +
|
||||
": Could not retrieve server CommandMap, using fallback instead! Please report to http://redmine.sk89q.com");
|
||||
fallbackCommands = commandMap = new SimpleCommandMap(Bukkit.getServer());
|
||||
Bukkit.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS,
|
||||
new FallbackRegistrationListener(fallbackCommands), Event.Priority.Normal, plugin);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new FallbackRegistrationListener(fallbackCommands), plugin);
|
||||
}
|
||||
}
|
||||
return commandMap;
|
||||
|
@ -19,13 +19,14 @@
|
||||
package com.sk89q.bukkit.util;
|
||||
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
|
||||
/**
|
||||
* @author zml2008
|
||||
*/
|
||||
public class FallbackRegistrationListener extends PlayerListener {
|
||||
public class FallbackRegistrationListener implements Listener {
|
||||
|
||||
private final CommandMap commandRegistration;
|
||||
|
||||
@ -33,7 +34,7 @@ public class FallbackRegistrationListener extends PlayerListener {
|
||||
this.commandRegistration = commandRegistration;
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler(event = PlayerCommandPreprocessEvent.class)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user