本文整理汇总了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());
}
示例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;
}
示例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;
}
}
示例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));
}
}
}
示例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");
}
}
示例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);
}
}
示例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());
}
示例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);
}
}
}
示例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();
}
}
}
示例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;
}
示例11: isWater
private boolean isWater(Material material) {
return material == Material.WATER || material == Material.STATIONARY_WATER;
}
示例12: isLiquid
public boolean isLiquid() {
return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
}
示例13: isWater
public static boolean isWater(Material material) {
return material == Material.WATER || material == Material.STATIONARY_WATER;
}
示例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);
}
}
示例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;
}