當前位置: 首頁>>代碼示例>>Java>>正文


Java Material.WEB屬性代碼示例

本文整理匯總了Java中org.bukkit.Material.WEB屬性的典型用法代碼示例。如果您正苦於以下問題:Java Material.WEB屬性的具體用法?Java Material.WEB怎麽用?Java Material.WEB使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.bukkit.Material的用法示例。


在下文中一共展示了Material.WEB屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerRunes

private void registerRunes() {
	Rune rune;
	
	rune = new Rune("Freeze", Material.ICE, 15, -1);
	rune.addDescription(ChatColor.GRAY + "Freezes target");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "10 blocks");
	rune.addDescription(ChatColor.GRAY + "Freeze duration: " + ChatColor.RED + "3 second");
	runes.add(rune);
	
	rune = new Rune("Fire Storm", Material.BLAZE_POWDER, 25, 30);
	rune.addDescription(ChatColor.GRAY + "Sets everyone around on fire");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "2 blocks");
	rune.addDescription(ChatColor.GRAY + "Burning duration: " + ChatColor.RED + "2 seconds");
	runes.add(rune);
	
	rune = new Rune("Slowdown", Material.WEB, 15, 30);
	rune.addDescription(ChatColor.GRAY + "Slows everyone around");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "3 blocks");
	rune.addDescription(ChatColor.GRAY + "Slow Level: " + ChatColor.RED + "I");
	rune.addDescription(ChatColor.GRAY + "Slow duration: " + ChatColor.RED + "5 seconds");
	runes.add(rune);
	
	rune = new Rune("Invisibility", Material.GRASS, 10, 5);
	rune.addDescription(ChatColor.GRAY + "Gives uninterruptible invisibility");
	runes.add(rune);
	
	rune = new Rune("Lightning", Material.FIREWORK, 15, -1);
	rune.addDescription(ChatColor.GRAY + "Strikes lightning at target position");
	rune.addDescription(ChatColor.GRAY + "Range: " + ChatColor.RED + "20 blocks");
	rune.addDescription(ChatColor.GRAY + "Damage: " + ChatColor.RED + "5 hearts");
	runes.add(rune);
	
	rune = new Rune("Detonate", Material.TNT, 20, -1);
	rune.addDescription(ChatColor.GRAY + "Strikes explosion at your location");
	rune.addDescription(ChatColor.GRAY + "Explosion range: " + ChatColor.RED + "4 blocks");
	rune.addDescription(ChatColor.GRAY + "Damage: " + ChatColor.RED + "3 hearts");
	runes.add(rune);
}
 
開發者ID:benNek,項目名稱:AsgardAscension,代碼行數:38,代碼來源:RuneManager.java

示例2: isInWeb

/**
 * @return If the player is in a cobweb or not.
 */
public final boolean isInWeb() {
	return getBlockPlayerIsIn().getType() == Material.WEB;
}
 
開發者ID:davidm98,項目名稱:Crescent,代碼行數:6,代碼來源:Behaviour.java

示例3: getImminentDeath

/**
 * Get the cause of the player's imminent death, or null if they are not about to die
 * NOTE: not idempotent, has the side effect of clearing the recentDamage cache
 */
public @Nullable ImminentDeath getImminentDeath(Player player) {
    // If the player is already dead or in creative mode, we don't care
    if(player.isDead() || player.getGameMode() == GameMode.CREATIVE) return null;

    // If the player was on the ground, or is flying, or is able to fly, they are fine
    if(!(player.isOnGround() || player.isFlying() || player.getAllowFlight())) {
        // If the player is falling, detect an imminent falling death
        double fallDistance = player.getFallDistance();
        Block landingBlock = null;
        int waterDepth = 0;
        Location location = player.getLocation();

        if(location.getY() > 256) {
            // If player is above Y 256, assume they fell at least to there
            fallDistance += location.getY() - 256;
            location.setY(256);
        }

        // Search the blocks directly beneath the player until we find what they would have landed on
        Block block = null;
        for(; location.getY() >= 0; location.add(0, -1, 0)) {
            block = location.getBlock();
            if(block != null) {
                landingBlock = block;

                if(Materials.isWater(landingBlock.getType())) {
                    // If the player falls through water, reset fall distance and inc the water depth
                    fallDistance = -1;
                    waterDepth += 1;

                    // Break if they have fallen through enough water to stop falling
                    if(waterDepth >= BREAK_FALL_WATER_DEPTH) break;
                } else {
                    // If the block is not water, reset the water depth
                    waterDepth = 0;

                    if(Materials.isColliding(landingBlock.getType()) || Materials.isLava(landingBlock.getType())) {
                        // Break if the player hits a solid block or lava
                        break;
                    } else if(landingBlock.getType() == Material.WEB) {
                        // If they hit web, reset their fall distance, but assume they keep falling
                        fallDistance = -1;
                    }
                }
            }

            fallDistance += 1;
        }

        double resistanceFactor = getResistanceFactor(player);
        boolean fireResistance = hasFireResistance(player);

        // Now decide if the landing would have killed them
        if(location.getBlockY() < 0) {
            // The player would have fallen into the void
            return new ImminentDeath(EntityDamageEvent.DamageCause.VOID, location, null, false);
        } else if(landingBlock != null) {
            if(Materials.isColliding(landingBlock.getType()) && player.getHealth() <= resistanceFactor * (fallDistance - SAFE_FALL_DISTANCE)) {
                // The player would have landed on a solid block and taken enough fall damage to kill them
                return new ImminentDeath(EntityDamageEvent.DamageCause.FALL, landingBlock.getLocation().add(0, 0.5, 0), null, false);
            } else if (Materials.isLava(landingBlock.getType()) && resistanceFactor > 0 && !fireResistance) {
                // The player would have landed in lava, and we give the lava the benefit of the doubt
                return new ImminentDeath(EntityDamageEvent.DamageCause.LAVA, landingBlock.getLocation(), landingBlock, false);
            }
        }
    }

    // If we didn't predict a falling death, detect combat log due to recent damage
    Damage damage = this.recentDamage.remove(player);
    if(damage != null && damage.time.plus(RECENT_DAMAGE_THRESHOLD).isAfter(Instant.now())) {
        // Player logged out too soon after taking damage
        return new ImminentDeath(damage.event.getCause(), player.getLocation(), null, true);
    }

    return null;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:80,代碼來源:CombatLogTracker.java

示例4: isInWeb

public static boolean isInWeb(Player player) {
    return player.getLocation().getBlock().getType() == Material.WEB || player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.WEB || player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.WEB;
}
 
開發者ID:Notoh,項目名稱:DynamicAC,代碼行數:3,代碼來源:Utilities.java


注:本文中的org.bukkit.Material.WEB屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。