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


Java Player.getWalkSpeed方法代码示例

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


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

示例1: items

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void items(Player p){
    WCCore.getInstance().debugLog("Task Items");
    if(files.getUsers().contains("Users." + p.getName() + ".bypass")
            && files.getUsers().getBoolean("Users." + p.getName() + ".bypass")) return;

    if (p.getInventory().getItemInMainHand() == null) {
        return;
    }
    //Comprobación extra
    //Palo
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.STICK.getItemStack())){
        if(p.getMaxHealth() != 30){
            p.setMaxHealth(30);
        }
        if(p.getWalkSpeed() > 0.2f){
            p.setWalkSpeed(0.2f);
        }
        return;
    }

    //Picos
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P1.getItemStack())){
        if(p.getMaxHealth() != 35){
            p.setMaxHealth(35);
        }
        if(p.getWalkSpeed() != 0.4f){
            p.setWalkSpeed(0.4f);
        }
        return;
    }
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P2.getItemStack())){
        if(p.getMaxHealth() != 35){
            p.setMaxHealth(35);
        }
        if(p.getWalkSpeed() != 0.4f){
            p.setWalkSpeed(0.4f);
        }
        return;

    }
    if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P3.getItemStack())){
        if(p.getMaxHealth() != 35){
            p.setMaxHealth(35);
        }
        if(p.getWalkSpeed() != 0.4f){
            p.setWalkSpeed(0.4f);
        }
        return;

    }

    if(!(p.getInventory().getItemInMainHand().isSimilar(itemsClass.STICK.getItemStack())
            || p.getInventory().getItemInMainHand().isSimilar(itemsClass.P1.getItemStack())
            || p.getInventory().getItemInMainHand().isSimilar(itemsClass.P2.getItemStack())
            || p.getInventory().getItemInMainHand().isSimilar(itemsClass.P3.getItemStack()))){
        if(p.getMaxHealth() > 20){
            p.setMaxHealth(20);
        }
        if(p.getWalkSpeed() > 0.2f){
            p.setWalkSpeed(0.2f);
        }
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:64,代码来源:MainRun.java

示例2: checkXZSpeed

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void checkXZSpeed(Player player, double x, double z) {
    if(player.getVehicle() == null && !player.isFlying() && !Flight.movingExempt.containsKey(player)) {
        String reason = "";
        double max = 0.25;
        if(player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
            if(player.isSprinting()) {
                reason = "on soulsand while sprinting";
                max = 0.2;
            } else if(player.hasPotionEffect(PotionEffectType.SPEED)) {
                max = 0.16;
                reason = "on soulsand with speed pot";
            } else {
                max = 0.13;
            }
        } else if(player.hasPotionEffect(PotionEffectType.SPEED)) {
            if(player.isSprinting()) {
                reason = "with speed pot while sprinting";
                max = 0.95;
            } else {
                reason = "with speed pot";
                max = 0.7;
            }
        } else if(player.isSprinting()) {
            max = 0.65;
            reason = "while sprinting";
        }

        float speed = player.getWalkSpeed();
        max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;

        if(x > max || z > max) {
            speedViolation.put(player, speedViolation.containsKey(player) ? speedViolation.get(player) + 1 : 1);
            if(speedViolation.get(player) > MagicNumbers.SPEED_MAX) {
                for(Player pla : DynamicAC.instance.onlinestaff) {
                    pla.sendMessage(ChatColor.RED + "[DAC] " + ChatColor.GREEN + player.getName() + " failed " +
                            "Speed " + reason + "!");
                }
                DACManager.getUserManager().incrementUser(DACManager.getUserManager().getUser(player.getName()),
                        "Speed " + reason);
            }
        } else {
            speedViolation.put(player, 0);
        }
    }
}
 
开发者ID:Notoh,项目名称:DynamicAC,代码行数:46,代码来源:Speed.java

示例3: setPlayerSpeed

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Sets the player walk speed in a manner where resetSpeed will function.
 * @param player
 * @param speed
 */
public static void setPlayerSpeed(Player player, float speed) {
    if (player.getWalkSpeed() != speed)
        player.setWalkSpeed(speed);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:10,代码来源:PlayerUtils.java


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