/** * Called when a player attempts to log in to the server * * @param event Relevant event details */ @Override public void onPlayerLogin(PlayerLoginEvent event) { Player player = event.getPlayer(); GlobalConfiguration cfg = plugin.getGlobalConfiguration(); WorldConfiguration wcfg = cfg.getWorldConfig(player.getWorld().getName()); if (wcfg.enforceOneSession) { String name = player.getName(); for (Player pl : plugin.getServer().getOnlinePlayers()) { if (pl.getName().equalsIgnoreCase(name)) { pl.kickPlayer("Logged in from another location."); } } } if (!checkediConomy) { iConomy iconomy = (iConomy) plugin.getServer().getPluginManager().getPlugin("iConomy"); if (iconomy != null) { plugin.getGlobalConfiguration().setiConomy(iconomy); } checkediConomy = true; } }
public void registerEvents() { PluginManager pm = plugin.getServer().getPluginManager(); /* pm.registerEvent(Event.Type.PLAYER_ITEM, this, Priority.High, plugin); */ pm.registerEvent(Event.Type.PLAYER_INTERACT, this, Priority.High, plugin); pm.registerEvent(Event.Type.PLAYER_DROP_ITEM, this, Priority.High, plugin); pm.registerEvent(Event.Type.PLAYER_PICKUP_ITEM, this, Priority.High, plugin); pm.registerEvent(Event.Type.PLAYER_JOIN, this, Priority.Normal, plugin); pm.registerEvent(Event.Type.PLAYER_LOGIN, this, Priority.Normal, plugin); pm.registerEvent(Event.Type.PLAYER_QUIT, this, Priority.Normal, plugin); pm.registerEvent(Event.Type.PLAYER_RESPAWN, this, Priority.High, plugin); }