package com.mehmet_27.ipeksikazma; import java.util.List; import java.util.Map; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { List bloklar; @EventHandler public void blokKoyma(BlockPlaceEvent event) { Block blok = event.getBlock(); if (event.getBlock().getType().equals(Material.SPAWNER)) { if (!bloklar.contains(blok)) { bloklar.add(blok); } } } @EventHandler public void blokKirma(BlockBreakEvent event) { Block blok = event.getBlock(); Player p = event.getPlayer(); if (event.getBlock().getType().equals(Material.SPAWNER)) { if (p.getInventory().getItemInMainHand().getType().equals(Material.WOODEN_PICKAXE) || p.getInventory().getItemInMainHand().getType().equals(Material.STONE_PICKAXE) || p.getInventory().getItemInMainHand().getType().equals(Material.IRON_PICKAXE) || p.getInventory().getItemInMainHand().getType().equals(Material.GOLDEN_PICKAXE) || p.getInventory().getItemInMainHand().getType().equals(Material.DIAMOND_PICKAXE) || p.getInventory().getItemInMainHand().getType().equals(Material.NETHERITE_PICKAXE)) { if(!bloklar.contains(blok)) { Map buyuler = p.getInventory().getItemInMainHand().getItemMeta().getEnchants(); if(buyuler.containsKey(Enchantment.SILK_TOUCH)) { int seviye = buyuler.get(Enchantment.SILK_TOUCH); if(seviye < 2) { event.setCancelled(true); p.sendMessage(ChatColor.GOLD + "Survival" + ChatColor.GRAY + " » " + ChatColor.RED + "Bir spawneri ilk defa kırıyorsanız elinizde ipeksi 2 büyüsü olan bir kazma olması gerekir."); } } } } } } }