@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerExpChange(PlayerLevelChangeEvent event) { Player player = event.getPlayer(); NormalAchievements category = NormalAchievements.LEVELS; if (!shouldIncreaseBeTakenIntoAccount(player, category)) { return; } int previousMaxLevel = (int) plugin.getCacheManager().getAndIncrementStatisticAmount(category, player.getUniqueId(), 0); if (event.getNewLevel() <= previousMaxLevel) { return; } updateStatisticAndAwardAchievementsIfAvailable(player, category, event.getNewLevel() - previousMaxLevel); }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerLevelChange(PlayerLevelChangeEvent event){ if(enableEventLevelUp) { try { Player player = (Player) event.getPlayer(); if(!player.hasPermission("googleanalyticsplugin.ignore")) { if(event.getOldLevel() < event.getNewLevel()) { plugin.getTracker().TrackAction(getClientName(plugin, player), getClientId(player), getClientIP(player.getAddress().getAddress()), player.getName(), "Levelup", String.format("Level %3s", "" + player.getLevel())); } } } catch(Exception e) { plugin.getLogger().warning("Event Listener Error: " + e.getMessage()); } } }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerLevelChange(PlayerLevelChangeEvent event) { Player player = event.getPlayer(); if (player.getGameMode() != GameMode.SURVIVAL) return; if (isFactionsApplicable(player, true)) return; if (plugin.isDisabledWorld(player) || plugin.isCamping(player)) return; // Only give xp for single level changes int oldLevel = event.getOldLevel(); int newLevel = event.getNewLevel(); if (newLevel - oldLevel != 1) return; String message = plugin.getPrefix() + FormatUtil.format(plugin.getMessage("mc_xp_gain"), xpGain); plugin.getExperienceHandler().handleXpGain(player, xpGain, message); }
@EventHandler public void onNewLevel(PlayerLevelChangeEvent event) { Player player = event.getPlayer(); if (event.getNewLevel() == 30) { MessageFormat formatter = new MessageFormat(Language.getBundle().getString("exp-treasury.reminder")); player.sendMessage(formatter.format(new Object[]{30})); } if (event.getOldLevel() < event.getNewLevel() && bank.getConfig().getBoolean("fireworks")) { Firework firework = player.getWorld().spawn(event.getPlayer().getLocation(), Firework.class); FireworkMeta meta = firework.getFireworkMeta(); meta.addEffects(FireworkEffect.builder().withColor(Color.BLACK, Color.YELLOW, Color.RED).withFlicker().withFade(Color.YELLOW, Color.RED, Color.BLACK).withTrail().build()); meta.setPower(1); firework.setFireworkMeta(meta); } }
@EventHandler public void onLevelChange(PlayerLevelChangeEvent e) { if (!Utils.isInArena(e.getPlayer())) { return; } if (e.getNewLevel() == 0) { return; } if (e.getNewLevel() > 30) { e.getPlayer().setLevel(30); } else { Player p = e.getPlayer(); Utils.flushSkillSelection(p); } }
@EventHandler public void onPlayerLvlChanged(PlayerLevelChangeEvent event){ Player player = event.getPlayer(); if (player.getLevel() >= 60){ return; } //增加血槽 double healAdded = event.getNewLevel(); player.setMaxHealth(20 + healAdded); }
@Override protected Integer[] get(final Event e, final Player[] source) { return super.get(source, new Converter<Player, Integer>() { @SuppressWarnings("null") @Override public Integer convert(final Player p) { if (e instanceof PlayerLevelChangeEvent && ((PlayerLevelChangeEvent) e).getPlayer() == p && !Delay.isDelayed(e)) { return getTime() < 0 ? ((PlayerLevelChangeEvent) e).getOldLevel() : ((PlayerLevelChangeEvent) e).getNewLevel(); } return p.getLevel(); } }); }
@EventHandler public void onLevelUp(PlayerLevelChangeEvent event) { String playerID = PlayerConverter.getID(event.getPlayer()); if (!containsPlayer(playerID)) { return; } if (event.getNewLevel() >= level && checkConditions(playerID)) { completeObjective(playerID); } }
@EventHandler public void onPlayerLevelChange(PlayerLevelChangeEvent event){ Player player = event.getPlayer(); EpicPlayer epicPlayer = EpicSystem.getEpicPlayer(player.getUniqueId()); List<EpicQuestTask> taskList = epicPlayer.getTasksByType(TaskTypes.LEVEL_UP); for(EpicQuestTask task : taskList){ int oldlevel = event.getOldLevel(); int newlevel = event.getNewLevel(); if(newlevel > oldlevel){ task.ProgressTask(1, epicPlayer, true); } } }
@SuppressWarnings("unchecked") @Override public boolean setTime(final int time) { return super.setTime(time, getExpr(), PlayerLevelChangeEvent.class, PlayerDeathEvent.class); }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerDeath(PlayerLevelChangeEvent evt) { if (evt.getNewLevel() % 5 == 0) { evt.getPlayer().sendMessage(ChatColor.LIGHT_PURPLE + "Hey " + ChatColor.YELLOW + evt.getPlayer().getName() + ChatColor.LIGHT_PURPLE + "! Consider buying a perk using " + ChatColor.GREEN + "/perk" + ChatColor.LIGHT_PURPLE + " command!"); } }
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerLevelChange(PlayerLevelChangeEvent event) { this.module.getStatSystem().setStat("status.levels", event.getPlayer().getName(), event.getNewLevel()); }
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerLevelChange (PlayerLevelChangeEvent event) { sorcererManager.getSorcerer(event.getPlayer()).setLevel( event.getNewLevel()); }