Support new bukkit event system
This commit is contained in:
parent
57bf517964
commit
be0a4ebd0d
@ -29,7 +29,8 @@ import java.util.logging.Logger;
|
|||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
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.PlayerLoginEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
public class JoinListener extends PlayerListener {
|
public class JoinListener implements Listener {
|
||||||
Logger log = Logger.getLogger("Caminus.Join");
|
Logger log = Logger.getLogger("Caminus.Join");
|
||||||
private String m_url;
|
private String m_url;
|
||||||
|
|
||||||
@ -48,6 +49,8 @@ public class JoinListener extends PlayerListener {
|
|||||||
m_url = url;
|
m_url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
if (p.hasPermission("caminus.whitelisted"))
|
if (p.hasPermission("caminus.whitelisted"))
|
||||||
@ -65,6 +68,7 @@ public class JoinListener extends PlayerListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
String[] motd = null;
|
String[] motd = null;
|
||||||
|
@ -43,7 +43,6 @@ public class Plugin extends JavaPlugin {
|
|||||||
conf.addDefault("url", "http://camin.us/api/");
|
conf.addDefault("url", "http://camin.us/api/");
|
||||||
String url = conf.getString("url");
|
String url = conf.getString("url");
|
||||||
m_listener.setURL(url);
|
m_listener.setURL(url);
|
||||||
pm.registerEvent(Event.Type.PLAYER_LOGIN, m_listener, Event.Priority.Normal, this);
|
pm.registerEvents(m_listener, this);
|
||||||
pm.registerEvent(Event.Type.PLAYER_JOIN, m_listener, Event.Priority.Normal, this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user