Hymm działa lecz teraz mam problem z anulowaniem eventu bo gdy zabiera case to cofa bo anuluje event
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPlace(final BlockPlaceEvent e) {
final Player p = e.getPlayer();
final Location location = e.getBlock().getLocation();
final World world = p.getWorld();
ItemStack CASE = new ItemBuilder(Material.CHEST).setName(" &f&l>< &5&lPREMIUMCASE &f&l><").addLore(" &a&l&nPostaw na ziemii aby uzyc!").addLore("").addLore(" &8&l%> &b&l&nINFORMACJA &8&l<%").addLore(" &3Postaw na ziemi aby otworzyc").addLore(" &3Drop sprawdzisz pod: &b&n/premiumcase").build();
if (!p.getItemInHand().isSimilar(CASE)) {
return;
}else {
e.setCancelled(true);
p.getInventory().remove(CASE);
}
p.playSound(p.getLocation(), Sound.LEVEL_UP, 0.5f,(float) (Math.random() * 20.0) / 10.0f);
if (isPassed(2)) {
ItemStack BEACON = new ItemBuilder(Material.BEACON).build();
world.dropItem(location, BEACON);
}
if (isPassed(23)) {
ItemStack HELM = new ItemBuilder(Material.DIAMOND_HELMET).addEnchant(Enchantment.DURABILITY, 3).addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 4).build();
world.dropItem(location, HELM);