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


Java Material.WATER屬性代碼示例

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


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

示例1: onPlayerMove

@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
    if (this.hasPlayer(event.getPlayer()))
        return;

    if (event.getPlayer().getLocation().getBlock().getType() != Material.WATER && event.getPlayer().getLocation().getBlock().getType() != Material.STATIONARY_WATER)
        return;

    if (this.hub.getPlayerManager().isBusy(event.getPlayer()))
        return;

    if (PlayerManager.VIP_ZONE.isInArea(event.getPlayer().getLocation()))
        return;

    this.play(event.getPlayer());
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:17,代碼來源:SonicSquid.java

示例2: calculateRadiationDamage

/**
 * Method to calculate the radiation damage based on conditions.
 * 
 * @param player
 *            The player whose damage should be calculated
 * @return The calculated damage
 */
private double calculateRadiationDamage(Player player) {
	double receivedDamage = main.getDataManager().getDefaultRadiationDamage();
	double stormDamage = main.getDataManager().getStormRadiationDamage();
	double waterDamage = main.getDataManager().getWaterRadiationDamage();

	if (isPlayerInBuilding(player)) {
		return 0D;
	}

	if (player.getWorld().hasStorm()) {
		receivedDamage += stormDamage;
	}

	if (player.getLocation().getBlock().getType() == Material.WATER
			|| player.getLocation().getBlock().getType() == Material.STATIONARY_WATER) {
		receivedDamage += waterDamage;
	}

	return receivedDamage;
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:27,代碼來源:RadiationManager.java

示例3: isSwimming

public static boolean isSwimming(Location location, Material liquidType) {
    Material material = location.getBlock().getType();
    switch(liquidType) {
        case WATER:
        case STATIONARY_WATER:
            return material == Material.WATER || material == Material.STATIONARY_WATER;

        case LAVA:
        case STATIONARY_LAVA:
            return material == Material.LAVA || material == Material.STATIONARY_LAVA;

        default:
            return false;
    }
}
 
開發者ID:WarzoneMC,項目名稱:Warzone,代碼行數:15,代碼來源:PlayerBlockChecker.java

示例4: participantDefuse

private void participantDefuse(Player player, Entity entity) {
    if(!AntiGrief.Defuse.enabled()) return;

    // check tnt
    if(!(entity instanceof TNTPrimed)) return;

    TNTMatchModule tntmm = mm.getMatch(player.getWorld()).getMatchModule(TNTMatchModule.class);
    if(tntmm != null && !tntmm.getProperties().friendlyDefuse) return;

    MatchPlayer clicker = this.mm.getPlayer(player);
    if(clicker == null || !clicker.canInteract()) return;

    // check water
    Block block = entity.getLocation().getBlock();
    if(block != null && (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)) {
        clicker.sendMessage(ChatColor.RED + PGMTranslations.t("defuse.water", clicker));
        return;
    }

    // check owner
    MatchPlayer owner = this.mm.getPlayer(entityResolver.getOwner(entity));
    if(owner == null || (owner != clicker && owner.getParty() == clicker.getParty())) { // cannot defuse own TNT
        // defuse TNT
        entity.remove();
        if(owner != null) {
            this.notifyDefuse(clicker, entity, ChatColor.RED + PGMTranslations.t("defuse.player", clicker, owner.getDisplayName(clicker) + ChatColor.RED));
            adminChannel.broadcast(clicker.getDisplayName() +
                                   ChatColor.WHITE + " defused " +
                                   owner.getDisplayName()
                                   + ChatColor.WHITE + "'s " +
                                   ChatColor.DARK_RED + "TNT");
        } else {
            this.notifyDefuse(clicker, entity, ChatColor.RED + PGMTranslations.t("defuse.world", clicker));
        }
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:36,代碼來源:DefuseListener.java

示例5: materialInBucket

public static Material materialInBucket(Material bucket) {
    switch(bucket) {
        case BUCKET:
        case MILK_BUCKET:
            return Material.AIR;

        case LAVA_BUCKET: return Material.LAVA;
        case WATER_BUCKET: return Material.WATER;

        default: throw new IllegalArgumentException(bucket + " is not a bucket");
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:12,代碼來源:Materials.java

示例6: onDrop

@EventHandler
public void onDrop(ItemSpawnEvent event)
{
	if(event.isCancelled()) return;
	final Item itemDrop = event.getEntity();
	if(itemDrop.getItemStack().getType() == Material.BOWL)
	{
	    final Runnable task = new Runnable()
	    {
	    	public void run()
	    	{
	    		if(itemDrop.getItemStack().getAmount() != 1) return;
	    		Location itemLocation = itemDrop.getLocation();
	    		if(itemLocation.getBlock().getType() == Material.WATER || itemLocation.getBlock().getType() == Material.STATIONARY_WATER)
	    		{
	    			itemDrop.remove();
	    			
	    	      	ItemStack i_beetroot = new ItemStack(Material.BEETROOT_SOUP, 1);
	    	      	ItemMeta beetrootMeta= i_beetroot.getItemMeta();
	    	      	beetrootMeta.setDisplayName(ChatColor.RESET + Survival.instance.Words.get("Water Bowl"));
	    	      	i_beetroot.setItemMeta(beetrootMeta);
	    	      	
	    			itemDrop.getWorld().dropItem(itemLocation, i_beetroot);
	    		}
            }
	    };
	    
	    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, task, 20L);
	}
}
 
開發者ID:FattyMieo,項目名稱:SurvivalPlus,代碼行數:30,代碼來源:WaterBowl.java

示例7: EntitySonicSquid

EntitySonicSquid(World world, Player player)
{
    super(world);

    try
    {
        Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
        bField.setAccessible(true);
        Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
        cField.setAccessible(true);

        bField.set(this.goalSelector, Sets.newLinkedHashSet());
        bField.set(this.targetSelector, Sets.newLinkedHashSet());
        cField.set(this.goalSelector, Sets.newLinkedHashSet());
        cField.set(this.targetSelector, Sets.newLinkedHashSet());

        ((Navigation) getNavigation()).a(true);
    }
    catch (ReflectiveOperationException ignored) {}

    Location copy = player.getLocation().clone();

    while (copy.getBlock().getType() == Material.WATER || copy.getBlock().getType() == Material.STATIONARY_WATER)
        copy.add(0.0D, 1.0D, 0.0D);

    this.setPosition(player.getLocation().getX(), copy.getY() - 1.35D, player.getLocation().getZ());
}
 
開發者ID:SamaGames,項目名稱:Hub,代碼行數:27,代碼來源:EntitySonicSquid.java

示例8: WaterPower

@EventHandler
public void WaterPower(PlayerMoveEvent event) {
	Player p = event.getPlayer();
	if (Kit.getKit(p).getName().equalsIgnoreCase("poseidon")) {
		Material m = p.getLocation().getBlock().getType();
		if (m == Material.STATIONARY_WATER || m == Material.WATER) {
			p.addPotionEffect(new PotionEffect(
					PotionEffectType.INCREASE_DAMAGE, 200, 1));
			p.setRemainingAir(300);
		}
	}
}
 
開發者ID:thekeenant,項目名稱:mczone,代碼行數:12,代碼來源:KitEvents.java

示例9: onVehicleCreate

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onVehicleCreate(VehicleCreateEvent event) {
    Vehicle vehicle = event.getVehicle();
    if (vehicle instanceof Boat) {
        Boat boat = (Boat) vehicle;
        Block belowBlock = boat.getLocation().add(0, -1, 0).getBlock();
        if (belowBlock.getType() != Material.WATER && belowBlock.getType() != Material.STATIONARY_WATER) {
            boat.remove();
        }
    }
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:11,代碼來源:BoatGlitchFixListener.java

示例10: isInWater

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

示例11: isWater

private boolean isWater(Material material) {
	return material == Material.WATER || material == Material.STATIONARY_WATER;
}
 
開發者ID:davidm98,項目名稱:Crescent,代碼行數:3,代碼來源:WaterWalkA.java

示例12: isLiquid

public boolean isLiquid() {
    return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:3,代碼來源:CraftBlock.java

示例13: isWater

public static boolean isWater(Material material) {
    return material == Material.WATER || material == Material.STATIONARY_WATER;
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:3,代碼來源:Materials.java

示例14: run

public void run() {
	for (final Player player : Bukkit.getOnlinePlayers()) {
		// Only affect survival and adventure mode players
		if (player.getGameMode() != GameMode.SURVIVAL && player.getGameMode() != GameMode.ADVENTURE) {
			continue;
		}

		// If the player has sunscreen
		if (settings.hasSunscreen(player)) {
			continue;
		}

		// Skip if disabled world.
		final World world = player.getWorld();
		if (settings.isDisabledWorld(world)) {
			continue;
		}

		// If it is raining.
		if (world.hasStorm() || world.isThundering()) {
			continue;
		}

		// If there is a block above them.
		final Location locHead = player.getLocation().add(0, 1, 0);
		final Location locFeet = player.getLocation();

		if (locHead.getY() <= world.getHighestBlockAt(locHead).getY()) {
			continue;
		}

		// If the player is in water
		final Block blockFeet = locFeet.getBlock();
		final Block blockHead = locHead.getBlock();
		if (blockFeet.getType() == Material.WATER || blockFeet.getType() == Material.STATIONARY_WATER
				|| blockHead.getType() == Material.WATER || blockHead.getType() == Material.STATIONARY_WATER) {
			continue;
		}

		// If the light level at the location isn't bright enough
		if (locHead.getBlock().getLightLevel() < 15 && locFeet.getBlock().getLightLevel() < 15) {
			continue;
		}

		// If the player is wearing a helmet.
		if (player.getInventory().getHelmet() != null
				&& player.getInventory().getHelmet().getType() != Material.AIR) {
			continue;
		}

		// Set the player on fire.
		player.setFireTicks(80);
	}
}
 
開發者ID:homiedion,項目名稱:Sunscreen,代碼行數:54,代碼來源:PlayerCombustTask.java

示例15: isClimbableBlock

public static boolean isClimbableBlock(Block block) {
    return block.getType() == Material.VINE || block.getType() == Material.LADDER || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER;
}
 
開發者ID:Notoh,項目名稱:DynamicAC,代碼行數:3,代碼來源:Utilities.java


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