package foleon.mmsomines;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.ChatColor;

import java.util.Arrays;

public class Mmsomines extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    public static String TranslateColors(String input) {
        return ChatColor.translateAlternateColorCodes('&', input);
    }

    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        if (event.isCancelled()) {
            return;
        }

        Player player = event.getPlayer();
        Material handMaterial = player.getInventory().getItemInMainHand().getType();

        Block block = event.getBlock();
        Material material = block.getType();

        if (material.equals(Material.STONE)) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.STONE);
                }
            }.runTaskLater(this, 200L);

            ItemStack customStone = new ItemStack(Material.STONE);
            ItemMeta customStoneMeta = customStone.getItemMeta();
            customStoneMeta.setDisplayName(TranslateColors("&f&lКамень"));
            customStoneMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customStone.setItemMeta(customStoneMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customStone);
        } else if (material.equals(Material.COAL_ORE) && (handMaterial.equals(Material.STONE_PICKAXE) || handMaterial.equals(Material.IRON_PICKAXE) || handMaterial.equals(Material.GOLD_PICKAXE) || handMaterial.equals(Material.DIAMOND_PICKAXE))) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.COAL_ORE);
                }
            }.runTaskLater(this, 300L);

            ItemStack customCoal = new ItemStack(Material.COAL);
            ItemMeta customCoalMeta = customCoal.getItemMeta();
            customCoalMeta.setDisplayName(TranslateColors("&f&lУголь"));
            customCoalMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customCoal.setItemMeta(customCoalMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customCoal);
        } else if (material.equals(Material.IRON_ORE) && (handMaterial.equals(Material.STONE_PICKAXE) || handMaterial.equals(Material.IRON_PICKAXE) || handMaterial.equals(Material.GOLD_PICKAXE) || handMaterial.equals(Material.DIAMOND_PICKAXE))) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.IRON_ORE);
                }
            }.runTaskLater(this, 300L);

            ItemStack customIron = new ItemStack(Material.IRON_ORE);
            ItemMeta customIronMeta = customIron.getItemMeta();
            customIronMeta.setDisplayName(TranslateColors("&f&lЖелезная руда"));
            customIronMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customIron.setItemMeta(customIronMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customIron);
        } else if (material.equals(Material.GOLD_ORE) && (handMaterial.equals(Material.IRON_PICKAXE) || handMaterial.equals(Material.GOLD_PICKAXE) || handMaterial.equals(Material.DIAMOND_PICKAXE))) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.GOLD_ORE);
                }
            }.runTaskLater(this, 400L);

            ItemStack customGold = new ItemStack(Material.GOLD_ORE);
            ItemMeta customGoldMeta = customGold.getItemMeta();
            customGoldMeta.setDisplayName(TranslateColors("&f&lЗолотая руда"));
            customGoldMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customGold.setItemMeta(customGoldMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customGold);
        } else if (material.equals(Material.REDSTONE_ORE) && (handMaterial.equals(Material.IRON_PICKAXE) || handMaterial.equals(Material.GOLD_PICKAXE) || handMaterial.equals(Material.DIAMOND_PICKAXE))) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.REDSTONE_ORE);
                }
            }.runTaskLater(this, 100L);

            ItemStack customRedstone = new ItemStack(Material.REDSTONE);
            ItemMeta customRedstoneMeta = customRedstone.getItemMeta();
            customRedstoneMeta.setDisplayName(TranslateColors("&f&lКрасный камень"));
            customRedstoneMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customRedstone.setItemMeta(customRedstoneMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customRedstone);
        } else if (material.equals(Material.LAPIS_ORE) && (handMaterial.equals(Material.GOLD_PICKAXE) || handMaterial.equals(Material.DIAMOND_PICKAXE))) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.LAPIS_ORE);
                }
            }.runTaskLater(this, 400L);

            ItemStack customLapis = new ItemStack(Material.LAPIS_ORE);
            ItemMeta customLapisMeta = customLapis.getItemMeta();
            customLapisMeta.setDisplayName(TranslateColors("&f&lЛазуритовая руда"));
            customLapisMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customLapis.setItemMeta(customLapisMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customLapis);
        } else if (material.equals(Material.DIAMOND_ORE) && (handMaterial.equals(Material.GOLD_PICKAXE) || handMaterial.equals(Material.DIAMOND_PICKAXE))) {
            block.setType(Material.BEDROCK);
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.DIAMOND_ORE);
                }
            }.runTaskLater(this, 500L);

            ItemStack customDiamond = new ItemStack(Material.DIAMOND_ORE);
            ItemMeta customDiamondMeta = customDiamond.getItemMeta();
            customDiamondMeta.setDisplayName(TranslateColors("&f&lАлмазная руда"));
            customDiamondMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customDiamond.setItemMeta(customDiamondMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customDiamond);
        }
        else if (material.equals(Material.GRAY_GLAZED_TERRACOTTA) && (handMaterial.equals(Material.PRISMARINE_SHARD))) {
            block.setType(Material.BEDROCK;
            new BukkitRunnable() {
                @Override
                public void run() {
                    block.setType(Material.GRAY_GLAZED_TERRACOTTA);
                }
            }.runTaskLater(this, 600L);

            ItemStack customBrick = new ItemStack(Material.BRICK);
            ItemMeta customBrickMeta = customBrick.getItemMeta();
            customBrickMeta.setDisplayName(TranslateColors("&f&lТитан"));
            customBrickMeta.setLore(Arrays.asList(TranslateColors("&f&lКачество: &7&lБесполезный")));
            customBrick.setItemMeta(customBrickMeta);

            block.getWorld().dropItemNaturally(block.getLocation(), customBrick);
        }
        else {
            event.setCancelled(true);
            player.sendMessage(ChatColor.RED + "Твоя кирка слишком слабая, чтобы сломать этот блок.");
        }
    }
} Добавь в этот код чтобы когда ты ломал блок камня выдавался 1 mining exp в плагине аурелиум скиллс игроку. когда ломаешь руду угля - 3 опыта, когда ломаешь руду железа - 6 опыта, когда ломаешь редстоун - 8 опыта, когда ломаешь лазурит 12 опыта, когда ломаешь алмаз 16 опыта и когда ломаешь серую глазурованную керамику 26 опыта.