update to current bukkit event handling system

This commit is contained in:
Tobias Ottenweller
2012-02-25 17:41:44 +01:00
parent 0b6f573928
commit 4a6b5902e3
3 changed files with 99 additions and 52 deletions

View File

@@ -9,11 +9,12 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.mcteam.ancientgates.commands.BaseCommand;
import org.mcteam.ancientgates.commands.CommandClose;
import org.mcteam.ancientgates.commands.CommandCreate;
@@ -23,11 +24,14 @@ import org.mcteam.ancientgates.commands.CommandList;
import org.mcteam.ancientgates.commands.CommandOpen;
import org.mcteam.ancientgates.commands.CommandSetFrom;
import org.mcteam.ancientgates.commands.CommandSetTo;
import org.mcteam.ancientgates.gson.Gson;
import org.mcteam.ancientgates.gson.GsonBuilder;
import org.mcteam.ancientgates.listeners.PluginBlockListener;
import org.mcteam.ancientgates.listeners.PluginPlayerListener;
public class Plugin extends JavaPlugin {
public static Plugin instance;
@@ -55,7 +59,8 @@ public class Plugin extends JavaPlugin {
}
@Override
public void onEnable() {
public void onEnable()
{
// Add the commands
commands.add(new CommandHelp());
commands.add(new CommandCreate());
@@ -74,10 +79,9 @@ public class Plugin extends JavaPlugin {
Gate.load();
// Register events
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_MOVE, this.playerListener, Event.Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PHYSICS, this.blockListener, Event.Priority.Normal, this);
getServer().getPluginManager().registerEvents(this.playerListener, this);
getServer().getPluginManager().registerEvents(this.blockListener, this);
log("Enabled");
}