本文整理汇总了Java中org.bukkit.Material.STONE_HOE属性的典型用法代码示例。如果您正苦于以下问题:Java Material.STONE_HOE属性的具体用法?Java Material.STONE_HOE怎么用?Java Material.STONE_HOE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.STONE_HOE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerInteract
/**
* Handle blocks that need special treatment
* Tilling of coarse dirt into dirt using off-hand (regular hand is in 1.8)
* Usually prevented because it could lead to an endless supply of dirt with gravel
*
* @param e
*/
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 " + e.getEventName());
}
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!Util.inWorld(e.getPlayer())) {
return;
}
if (e.getPlayer().isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|| VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "craft.dirt")) {
return;
}
// Prevents tilling of coarse dirt into dirt
ItemStack inHand = e.getPlayer().getInventory().getItemInOffHand();
if (inHand.getType() == Material.WOOD_HOE || inHand.getType() == Material.IRON_HOE || inHand.getType() == Material.GOLD_HOE
|| inHand.getType() == Material.DIAMOND_HOE || inHand.getType() == Material.STONE_HOE) {
// plugin.getLogger().info("1.8 " + "DEBUG: hoe in hand");
Block block = e.getClickedBlock();
// plugin.getLogger().info("1.8 " + "DEBUG: block is " + block.getType() +
// ":" + block.getData());
// Check if coarse dirt
if (block.getType() == Material.DIRT && block.getData() == (byte) 1) {
// plugin.getLogger().info("1.8 " + "DEBUG: hitting coarse dirt!");
e.setCancelled(true);
}
}
}
示例2: onPlayerInteract
/**
* Handle V1.8 blocks that need special treatment
* Tilling of coarse dirt into dirt
* Usually prevented because it could lead to an endless supply of dirt with gravel
*
* @param e
*/
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.8 " + e.getEventName());
}
if (!e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
return;
}
if (!Util.inWorld(e.getPlayer())) {
return;
}
if (e.getPlayer().isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")
|| VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "craft.dirt")) {
return;
}
// Prevents tilling of coarse dirt into dirt
ItemStack inHand = e.getPlayer().getItemInHand();
if (inHand.getType() == Material.WOOD_HOE || inHand.getType() == Material.IRON_HOE || inHand.getType() == Material.GOLD_HOE
|| inHand.getType() == Material.DIAMOND_HOE || inHand.getType() == Material.STONE_HOE) {
// plugin.getLogger().info("1.8 " + "DEBUG: hoe in hand");
Block block = e.getClickedBlock();
// plugin.getLogger().info("1.8 " + "DEBUG: block is " + block.getType() +
// ":" + block.getData());
// Check if coarse dirt
if (block.getType() == Material.DIRT && block.getData() == (byte) 1) {
// plugin.getLogger().info("1.8 " + "DEBUG: hitting coarse dirt!");
e.setCancelled(true);
}
}
}
示例3: isTool
static boolean isTool(ItemStack item) {
if (item == null) return false;
final Material material = item.getType();
// shears
if (material == Material.SHEARS) return true;
// wood tools
if (material == Material.WOOD_SWORD || material == Material.WOOD_AXE || material == Material.WOOD_HOE || material == Material.WOOD_PICKAXE || material == Material.WOOD_SPADE) {
return true;
}
// stone tools
if (material == Material.STONE_SWORD || material == Material.STONE_AXE || material == Material.STONE_HOE || material == Material.STONE_PICKAXE || material == Material.STONE_SPADE) {
return true;
}
// iron tools
if (material == Material.IRON_SWORD || material == Material.IRON_AXE || material == Material.IRON_HOE || material == Material.IRON_PICKAXE || material == Material.IRON_SPADE) {
return true;
}
// gold tools
if (material == Material.GOLD_SWORD || material == Material.GOLD_AXE || material == Material.GOLD_HOE || material == Material.GOLD_PICKAXE || material == Material.GOLD_SPADE) {
return true;
}
// diamond tools
if (material == Material.DIAMOND_SWORD || material == Material.DIAMOND_AXE || material == Material.DIAMOND_HOE || material == Material.DIAMOND_PICKAXE || material == Material.DIAMOND_SPADE) {
return true;
}
return false;
}
示例4: Olympia
public Olympia(int id){
super(id, Material.STONE_HOE, "Olympia", lore);
setAmmo(new Shotgun());
setShootCooldown(1500);
}