Java 类org.bukkit.material.Cauldron 实例源码

项目:HCFCore    文件:ProtectionListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractEvent event) {
    if (!event.hasBlock()) {
        return;
    }

    Block block = event.getClickedBlock();
    Action action = event.getAction();
    if (action == Action.PHYSICAL) { // Prevent players from trampling on crops or pressure plates, etc.
        if (!attemptBuild(event.getPlayer(), block.getLocation(), null)) {
            event.setCancelled(true);
        }
    } else if (action == Action.RIGHT_CLICK_BLOCK) {
        boolean canBuild = !BLOCK_INTERACTABLES.contains(block.getType());

        // Special case for cauldron
        if (canBuild) {
            Material itemType = event.hasItem() ? event.getItem().getType() : null;
            if (itemType != null && ITEM_BLOCK_INTERACTABLES.containsKey(itemType) && ITEM_BLOCK_INTERACTABLES.get(itemType).contains(event.getClickedBlock().getType())) {
                if (block.getType() != Material.WORKBENCH || !event.getPlayer().hasPermission("utilities.openchestsilent") || !plugin.getFactionManager().getFactionAt(block).isSafezone()) {
                    canBuild = false;
                }
            } else {
                MaterialData materialData = block.getState().getData();
                if (materialData instanceof Cauldron) {
                    Cauldron cauldron = (Cauldron) materialData;
                    if (!cauldron.isEmpty() && event.hasItem() && event.getItem().getType() == Material.GLASS_BOTTLE) {
                        canBuild = false;
                    }
                }
            }
        }

        if (!canBuild && !attemptBuild(event.getPlayer(), block.getLocation(), ChatColor.YELLOW + "You cannot do this in the territory of %1$s" + ChatColor.YELLOW + '.', true)) {
            event.setCancelled(true);
        }
    }
}
项目:HCFCore    文件:ProtectionListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractEvent event) {
    if (!event.hasBlock()) {
        return;
    }

    if(HCF.getPlugin().getFactionManager().getFactionAt(event.getPlayer().getLocation()).getName().equalsIgnoreCase("Warzone") && event.getAction() == Action.PHYSICAL && (event.getClickedBlock().getType().equals(Material.STONE_PLATE) || event.getClickedBlock().getType().equals(Material.WOOD_PLATE)) ) {
        return;
    }

    Block block = event.getClickedBlock();
    Action action = event.getAction();
    if (action == Action.PHYSICAL) { // Prevent players from trampling on crops or pressure plates, etc.
        if (!attemptBuild(event.getPlayer(), block.getLocation(), null)) {
            event.setCancelled(true);
        }
    } else if (action == Action.RIGHT_CLICK_BLOCK) {
        boolean canBuild = !BLOCK_INTERACTABLES.contains(block.getType());

        // Special case for cauldron
        if (canBuild) {
            Material itemType = event.hasItem() ? event.getItem().getType() : null;
            if (itemType != null && ITEM_BLOCK_INTERACTABLES.containsKey(itemType) && ITEM_BLOCK_INTERACTABLES.get(itemType).contains(event.getClickedBlock().getType())) {
                if (block.getType() != Material.WORKBENCH || !event.getPlayer().hasPermission("utilities.openchestsilent") || !plugin.getFactionManager().getFactionAt(block).isSafezone()) {
                    canBuild = false;
                }
            } else {
                MaterialData materialData = block.getState().getData();
                if (materialData instanceof Cauldron) {
                    Cauldron cauldron = (Cauldron) materialData;
                    if (!cauldron.isEmpty() && event.hasItem() && event.getItem().getType() == Material.GLASS_BOTTLE) {
                        canBuild = false;
                    }
                }
            }
        }

        if (!canBuild && !attemptBuild(event.getPlayer(), block.getLocation(), ChatColor.YELLOW + "You cannot do this in the territory of %1$s" + ChatColor.YELLOW + '.', true)) {
            event.setCancelled(true);
        }
    }
}
项目:BedrockAPI    文件:Cauldron.java   
public Cauldron() {
}
项目:BedrockAPI    文件:Cauldron.java   
@Deprecated public Cauldron(int type, byte data) {
}
项目:BedrockAPI    文件:Cauldron.java   
@Deprecated public Cauldron(byte data) {
}
项目:BedrockAPI    文件:Cauldron.java   
public Cauldron clone() {
    return null;
}