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


Java Material.WATER_BUCKET属性代码示例

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


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

示例1: isInteractableItem

/**
 * checks if this item is interactable
 */
public static boolean isInteractableItem(ItemStack item) {
	if (item == null || item.getType() == Material.AIR) {
		return false;
	}
	if (item.getType().isBlock()) {
		return true;
	}
	if (item.getType() == Material.REDSTONE || item.getType() == Material.WATER_BUCKET || item.getType() == Material.LAVA_BUCKET) {
		return true;
	}
	if (item.getType() == Material.MONSTER_EGG) {
		return true;
	}
	if (item.getType() == Material.EGG || item.getType() == Material.SNOW_BALL || item.getType() == Material.BOW || item.getType() == Material.ENDER_PEARL || item.getType() == Material.EYE_OF_ENDER || item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.EXP_BOTTLE || item.getType() == Material.FIREWORK_CHARGE) {
		return true;
	}
	if (item.getType().isEdible()) {
		return true;
	}
	return false;
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:24,代码来源:HitboxUtils.java

示例2: onDamageSkull

@EventHandler
public void onDamageSkull(PlayerInteractEvent e) {
	if (cm.isAntiDamageSkull) {
		if (Action.RIGHT_CLICK_BLOCK == e.getAction()) {
			if (e.getItem() != null) {
				Material type = e.getItem().getType();
				if (Material.LAVA_BUCKET == type || Material.WATER_BUCKET == type) {
					fixSkull(e.getClickedBlock().getRelative(BlockFace.UP));
				} else if (Material.ANVIL == type) {
					for (BlockFace face : BLOCKFACE) {
						fixSkull(e.getClickedBlock().getRelative(face));
					}
				}
			}
		}
	}
}
 
开发者ID:jiongjionger,项目名称:NeverLag,代码行数:17,代码来源:AntiDamageSkull.java

示例3: onBucketEmpty

/**
 * Prevents emptying of buckets outside of island space
 * @param e
 */
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
    if (DEBUG) {
        plugin.getLogger().info(e.getEventName());
    }
    if (Util.inWorld(e.getPlayer())) {
        Player p = e.getPlayer();
        if (e.getBlockClicked() != null) {
            // This is where the water or lava actually will be dumped
            Block dumpBlock = e.getBlockClicked().getRelative(e.getBlockFace());
            if (actionAllowed(p, dumpBlock.getLocation(), SettingsFlag.BUCKET)) {
                // Check if biome is Nether and then allow water placement but fizz the water
                if (e.getBlockClicked().getBiome().equals(Biome.HELL)) {
                    if (plugin.getServer().getVersion().contains("(MC: 1.8") || plugin.getServer().getVersion().contains("(MC: 1.7")) {
                        if (e.getPlayer().getItemInHand().getType().equals(Material.WATER_BUCKET)) {
                            e.setCancelled(true);
                            e.getPlayer().getItemInHand().setType(Material.BUCKET);
                            e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.valueOf("FIZZ"), 1F, 2F);
                            Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
                        }
                    } else {
                        if (Util.playerIsHolding(e.getPlayer(), Material.WATER_BUCKET)) {
                            e.setCancelled(true);
                            if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) {
                                e.getPlayer().getInventory().setItemInMainHand(new ItemStack(Material.BUCKET));
                            } else if (e.getPlayer().getInventory().getItemInOffHand().getType() == Material.WATER_BUCKET) {
                                e.getPlayer().getInventory().setItemInOffHand(new ItemStack(Material.BUCKET));
                            }
                            e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1F, 2F);
                            Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("biome.set").replace("[biome]", "Nether"));
                        }
                    }
                }
                return;
            }
            // Not allowed
            Util.sendMessage(p, plugin.getLocale(p.getUniqueId()).get("island.protected"));
            e.setCancelled(true);
        }
    }
}
 
开发者ID:tastybento,项目名称:bskyblock,代码行数:45,代码来源:IslandGuard.java

示例4: isBucket

public static boolean isBucket(Material bucket) {
    return bucket == Material.BUCKET || bucket == Material.LAVA_BUCKET || bucket == Material.WATER_BUCKET || bucket == Material.MILK_BUCKET;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:3,代码来源:Materials.java


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