本文整理汇总了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;
}
示例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));
}
}
}
}
}
}
示例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);
}
}
}
示例4: isBucket
public static boolean isBucket(Material bucket) {
return bucket == Material.BUCKET || bucket == Material.LAVA_BUCKET || bucket == Material.WATER_BUCKET || bucket == Material.MILK_BUCKET;
}