From 792f70efa5f3a47f642360e97979fe841593384c Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 20 Jan 2012 05:20:37 +0100 Subject: Update for new CraftBukkit Event Code EssentialsSpawn can't be updated yet, because the new event system lacks dynamic priorities. --- .../src/com/earth2me/essentials/geoip/EssentialsGeoIP.java | 2 +- .../earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'EssentialsGeoIP') diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index e0ca6cd7c..5700a7472 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -37,7 +37,7 @@ public class EssentialsGeoIP extends JavaPlugin return; } final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess); - pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); + pm.registerEvents(playerListener, this); logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java index ee187c2aa..0018d09b4 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java @@ -17,11 +17,13 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.zip.GZIPInputStream; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerListener; -public class EssentialsGeoIPPlayerListener extends PlayerListener implements IConf +public class EssentialsGeoIPPlayerListener implements Listener, IConf { LookupService ls = null; private static final Logger logger = Logger.getLogger("Minecraft"); @@ -39,7 +41,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo reloadConfig(); } - @Override + @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(PlayerJoinEvent event) { User u = ess.getUser(event.getPlayer()); -- cgit v1.2.3 From e46fe381b4610d6a784922fe0bfc1bdca963d7c3 Mon Sep 17 00:00:00 2001 From: snowleo Date: Fri, 20 Jan 2012 05:52:35 +0100 Subject: Removing load info, bucket displays that now. --- .../src/com/earth2me/essentials/geoip/EssentialsGeoIP.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'EssentialsGeoIP') diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index 5700a7472..eb401c6db 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -3,17 +3,12 @@ package com.earth2me.essentials.geoip; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import java.util.logging.Level; -import java.util.logging.Logger; -import org.bukkit.event.Event.Priority; -import org.bukkit.event.Event.Type; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class EssentialsGeoIP extends JavaPlugin { - private static final Logger logger = Logger.getLogger("Minecraft"); - public EssentialsGeoIP() { } @@ -30,7 +25,7 @@ public class EssentialsGeoIP extends JavaPlugin final IEssentials ess = (IEssentials)pm.getPlugin("Essentials"); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { - logger.log(Level.WARNING, _("versionMismatchAll")); + getLogger().log(Level.WARNING, _("versionMismatchAll")); } if (!ess.isEnabled()) { this.setEnabled(false); @@ -39,8 +34,7 @@ public class EssentialsGeoIP extends JavaPlugin final EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder(), ess); pm.registerEvents(playerListener, this); - logger.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), "essentials team")); - logger.log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."); + getLogger().log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."); } } -- cgit v1.2.3