Support new bukkit event system

This commit is contained in:
Trever Fischer 2012-03-18 18:28:51 -04:00
parent 57bf517964
commit be0a4ebd0d
2 changed files with 7 additions and 4 deletions

View File

@ -29,7 +29,8 @@ import java.util.logging.Logger;
import java.util.Scanner;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.Listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerJoinEvent;
@ -37,7 +38,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONException;
public class JoinListener extends PlayerListener {
public class JoinListener implements Listener {
Logger log = Logger.getLogger("Caminus.Join");
private String m_url;
@ -48,6 +49,8 @@ public class JoinListener extends PlayerListener {
m_url = url;
}
@EventHandler
public void onPlayerLogin(PlayerLoginEvent event) {
Player p = event.getPlayer();
if (p.hasPermission("caminus.whitelisted"))
@ -65,6 +68,7 @@ public class JoinListener extends PlayerListener {
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player p = event.getPlayer();
String[] motd = null;

View File

@ -43,7 +43,6 @@ public class Plugin extends JavaPlugin {
conf.addDefault("url", "http://camin.us/api/");
String url = conf.getString("url");
m_listener.setURL(url);
pm.registerEvent(Event.Type.PLAYER_LOGIN, m_listener, Event.Priority.Normal, this);
pm.registerEvent(Event.Type.PLAYER_JOIN, m_listener, Event.Priority.Normal, this);
pm.registerEvents(m_listener, this);
}
}