java类org.bukkit.event.player.PlayerLevelChangeEvent的实例源码

AchieveXPListener.java 文件源码 项目:AdvancedAchievements 阅读 24 收藏 0 点赞 0 评论 0
@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);
}
GoogleAnalyticsEventListener.java 文件源码 项目:GoogleAnalyticsPlugin 阅读 25 收藏 0 点赞 0 评论 0
@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());
        }
    }
}
MinecraftXP.java 文件源码 项目:SwornRPG 阅读 27 收藏 0 点赞 0 评论 0
@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);
}
ExpLevelListener.java 文件源码 项目:ExpTreasury 阅读 26 收藏 0 点赞 0 评论 0
@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);
    }

}
PlayerListener.java 文件源码 项目:ArchersBattle 阅读 27 收藏 0 点赞 0 评论 0
@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);
    }
}
PlayerLvlListener.java 文件源码 项目:BasicSurvivalPlus 阅读 28 收藏 0 点赞 0 评论 0
@EventHandler
public void onPlayerLvlChanged(PlayerLevelChangeEvent event){
    Player player = event.getPlayer();
    if (player.getLevel() >= 60){
        return;
    }
    //增加血槽
    double healAdded = event.getNewLevel();
    player.setMaxHealth(20 + healAdded);

}
ExprLevel.java 文件源码 项目:Skript 阅读 26 收藏 0 点赞 0 评论 0
@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();
        }
    });
}
ExperienceObjective.java 文件源码 项目:BetonQuest 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler
public void onLevelUp(PlayerLevelChangeEvent event) {
    String playerID = PlayerConverter.getID(event.getPlayer());
    if (!containsPlayer(playerID)) {
        return;
    }
    if (event.getNewLevel() >= level && checkConditions(playerID)) {
        completeObjective(playerID);
    }
}
TypeLevelUp.java 文件源码 项目:EpicQuest 阅读 24 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
ExprLevel.java 文件源码 项目:Skript 阅读 28 收藏 0 点赞 0 评论 0
@SuppressWarnings("unchecked")
@Override
public boolean setTime(final int time) {
    return super.setTime(time, getExpr(), PlayerLevelChangeEvent.class, PlayerDeathEvent.class);
}
PerkNotifier.java 文件源码 项目:world-of-icerealm 阅读 51 收藏 0 点赞 0 评论 0
@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!");
    }
}
StatsListener.java 文件源码 项目:Peacecraft 阅读 26 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLevelChange(PlayerLevelChangeEvent event) {
    this.module.getStatSystem().setStat("status.levels", event.getPlayer().getName(), event.getNewLevel());
}
PlayerListener.java 文件源码 项目:Merlin 阅读 24 收藏 0 点赞 0 评论 0
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerLevelChange (PlayerLevelChangeEvent event)
  {
    sorcererManager.getSorcerer(event.getPlayer()).setLevel(
        event.getNewLevel());
  }


问题


面经


文章

微信
公众号

扫码关注公众号