当前位置: 首页>>代码示例>>Java>>正文


Java PlayerFishEvent.setExpToDrop方法代码示例

本文整理汇总了Java中org.bukkit.event.player.PlayerFishEvent.setExpToDrop方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerFishEvent.setExpToDrop方法的具体用法?Java PlayerFishEvent.setExpToDrop怎么用?Java PlayerFishEvent.setExpToDrop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.event.player.PlayerFishEvent的用法示例。


在下文中一共展示了PlayerFishEvent.setExpToDrop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlayerFish

import org.bukkit.event.player.PlayerFishEvent; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerFish(PlayerFishEvent event) {
    double amount = event.getExpToDrop();
    if (amount > 0) {
        amount = Math.ceil(amount * SettingsYML.EXP_MULTIPLIER_FISHING);
        ProjectileSource projectileSource = event.getHook().getShooter();
        if (projectileSource instanceof Player) {
            ItemStack stack = ((Player) projectileSource).getItemInHand();
            int enchantmentLevel = stack.getEnchantmentLevel(Enchantment.LUCK);
            if (enchantmentLevel > 0L) {
                amount = Math.ceil(amount * (enchantmentLevel * SettingsYML.EXP_MULTIPLIER_LUCK_PER_LEVEL));
            }
        }

        event.setExpToDrop((int) amount);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:18,代码来源:ExpMultiplierListener.java

示例2: onFish

import org.bukkit.event.player.PlayerFishEvent; //导入方法依赖的package包/类
@EventHandler
public void onFish(PlayerFishEvent e) {
    Player p = e.getPlayer();
    if (!RUtils.isInInfectedWorld(p)) return;
    e.setExpToDrop(0);
    PConfManager pcm = PConfManager.getPConfManager(p);
    float thirst = pcm.getFloat("thirst");
    if (!pcm.isSet("thirst")) {
        thirst = 1F;
        pcm.set("thirst", thirst);
    }
    p.setExp(thirst);
}
 
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:14,代码来源:SurvivorsListener.java

示例3: onPlayerFishHighest

import org.bukkit.event.player.PlayerFishEvent; //导入方法依赖的package包/类
/**
 * Handle PlayerFishEvents at the highest priority.
 * <p>
 * These events are used for the purpose of handling our anti-exploit
 * code, as well as dealing with ice fishing.
 *
 * @param event The event to modify
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerFishHighest(PlayerFishEvent event) {
    Player player = event.getPlayer();

    if (!UserManager.hasPlayerDataKey(player) || !SkillType.FISHING.getPermissions(player)) {
        return;
    }

    FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();

    switch (event.getState()) {
        case FISHING:
            if (!Permissions.krakenBypass(player)) {
                event.setCancelled(fishingManager.exploitPrevention());
            }
            return;

        case CAUGHT_FISH:
            //TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
            Item fishingCatch = (Item) event.getCaught();

            if (Config.getInstance().getFishingOverrideTreasures() && fishingCatch.getItemStack().getType() != Material.RAW_FISH) {
                fishingCatch.setItemStack(new ItemStack(Material.RAW_FISH, 1));
            }

            if (Permissions.vanillaXpBoost(player, SkillType.FISHING)) {
                event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
            }
            return;

        case IN_GROUND:
            Block block = player.getTargetBlock(null, 100);

            if (fishingManager.canIceFish(block)) {
                event.setCancelled(true);
                fishingManager.iceFishing(event.getHook(), block);
            }
            return;

        default:
            return;
    }
}
 
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:52,代码来源:PlayerListener.java


注:本文中的org.bukkit.event.player.PlayerFishEvent.setExpToDrop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。