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


Java Material.SOUL_SAND属性代码示例

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


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

示例1: checkXZSpeed

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,代码行数:45,代码来源:Speed.java


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