Event handler switched over to new Bukkit event system

This commit is contained in:
Brettflan 2012-02-07 20:58:28 -06:00
parent 80eab49b54
commit a4f7cd6487
4 changed files with 9 additions and 13 deletions

View File

@ -14,7 +14,6 @@ import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
import org.bukkit.util.config.ConfigurationNode;

View File

@ -1,13 +1,15 @@
package com.wimbli.WorldBorder;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.Location;
public class WBPlayerListener extends PlayerListener
public class WBListener implements Listener
{
@Override
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event)
{
if (event.isCancelled()) return;

View File

@ -1,7 +1,5 @@
package com.wimbli.WorldBorder;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginDescriptionFile;
@ -9,8 +7,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
public class WorldBorder extends JavaPlugin
{
private final WBPlayerListener pl = new WBPlayerListener();
@Override
public void onEnable()
{
PluginDescriptionFile desc = this.getDescription();
@ -27,9 +24,10 @@ public class WorldBorder extends JavaPlugin
getCommand("wborder").setExecutor(new WBCommand(this));
// keep an eye on teleports, to redirect them to a spot inside the border if necessary
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_TELEPORT, pl, Priority.Lowest, this);
getServer().getPluginManager().registerEvents(new WBListener(), this);
}
@Override
public void onDisable()
{
PluginDescriptionFile desc = this.getDescription();

View File

@ -5,7 +5,6 @@ import java.util.List;
import java.util.LinkedList;
import java.util.Set;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.entity.Player;
import org.bukkit.Server;
@ -108,10 +107,8 @@ public class WorldFillTask implements Runnable
if (continueNotice)
{ // notify user that task has continued automatically
continueNotice = false;
String clrCmd = ChatColor.AQUA.toString();
String clrDesc = ChatColor.WHITE.toString();
sendMessage("World map generation task automatically continuing.");
sendMessage("Reminder: you can cancel at any time with " + clrCmd + "wb fill cancel" + clrDesc + ", or pause/unpause with " + clrCmd + "wb fill pause" + clrDesc + ".");
sendMessage("Reminder: you can cancel at any time with \"wb fill cancel\", or pause/unpause with \"wb fill pause\".");
}
if (pausedForMemory)