package de.hessj.pokeballs;

import java.util.ArrayList;
import java.util.List;

import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.block.data.type.Fence;
import org.bukkit.block.data.type.Stairs;
import org.bukkit.entity.Allay;
import org.bukkit.entity.Armadillo;
import org.bukkit.entity.Axolotl;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Cat;
import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Donkey;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Fox;
import org.bukkit.entity.Frog;
import org.bukkit.entity.GlowSquid;
import org.bukkit.entity.Goat;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Llama;
import org.bukkit.entity.Mule;
import org.bukkit.entity.MushroomCow;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.entity.PolarBear;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Rabbit;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Squid;
import org.bukkit.entity.Turtle;
import org.bukkit.entity.Wolf;
import org.bukkit.entity.Axolotl.Variant;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import de.hessj.helper.Helper.Type;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
import net.md_5.bungee.api.ChatColor;

public class PokeballsListeners implements Listener {
    public static de.hessj.helper.Helper helper = new de.hessj.helper.Helper();

    @EventHandler
    public void craftBlocker(PrepareItemCraftEvent evt) {
        if (evt.getRecipe() != null && evt.getRecipe().getResult() != null) {
            if (!evt.getRecipe().getResult().equals(App.main.newPokeball)) {
                if (evt.getInventory().containsAtLeast(App.main.newPokeball, 1)
                        || evt.getInventory().containsAtLeast(App.main.usedPokeball, 1)) {
                    evt.getInventory().setResult(null);
                }
            }

        }
    }

    @EventHandler
    public void onLogin(PlayerJoinEvent e) {
        App.main.isThrownHM.put(e.getPlayer(), false);
        e.getPlayer().discoverRecipe(App.main.nskPokeball);
    }

    @EventHandler
    public void onEmptyBallThrow(PlayerInteractEvent e) {
        if (e.getPlayer().getInventory().getItemInMainHand() != null
                && e.getPlayer().getInventory().getItemInMainHand().getItemMeta() != null && e.getPlayer()
                        .getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer() != null) {
            if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
                    .has(App.main.nskPokeball, PersistentDataType.STRING)) {

                if (e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR
                        || e.getAction() == Action.PHYSICAL) {
                    return;
                }

                if (e.getClickedBlock() != null && e.getClickedBlock().getBlockData() != null
                        && (e.getClickedBlock().getBlockData() instanceof Stairs
                                || e.getClickedBlock().getBlockData() instanceof Fence)) {
                } else if (e.getClickedBlock() != null && helper.isInteractable(e.getClickedBlock())) {
                    return;
                }

                e.setCancelled(true);
                if (!App.main.isThrownHM.get(e.getPlayer())) {
                    App.main.isThrownHM.put(e.getPlayer(), true);
                    Snowball b = e.getPlayer().launchProjectile(Snowball.class);
                    b.customName(Component.text(ChatColor.WHITE + "Pokéball"));
                    b.setItem(App.main.newPokeball);
                    e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1,
                            1);

                    e.getPlayer().getInventory().getItemInMainHand().subtract(1);
                } else {
                    e.getPlayer().sendMessage(helper.R3SMessage(Type.ERROR,
                            "[Pokéball] Du kannst nur einen Pokéball nach dem anderen werfen!"));

                }
            }

        }
    }

    @EventHandler
    public void onUsedBallThrow(PlayerInteractEvent e) {
        if (e.getPlayer().getInventory().getItemInMainHand() != null
                && e.getPlayer().getInventory().getItemInMainHand().getItemMeta() != null && e.getPlayer()
                        .getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer() != null) {
            if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
                    .has(App.main.nskUsedPokeball, PersistentDataType.STRING)) {

                if (e.getAction() == Action.LEFT_CLICK_BLOCK || e.getAction() == Action.LEFT_CLICK_AIR
                        || e.getAction() == Action.PHYSICAL) {
                    return;
                }

                if (e.getClickedBlock() != null && e.getClickedBlock().getBlockData() != null
                        && (e.getClickedBlock().getBlockData() instanceof Stairs
                                || e.getClickedBlock().getBlockData() instanceof Fence)) {
                } else if (e.getClickedBlock() != null && helper.isInteractable(e.getClickedBlock())) {
                    return;
                }

                e.setCancelled(true);

                if (!App.main.isThrownHM.get(e.getPlayer())) {
                    App.main.isThrownHM.put(e.getPlayer(), true);

                    Snowball b = e.getPlayer().launchProjectile(Snowball.class);
                    String enti = e.getPlayer().getInventory().getItemInMainHand().getItemMeta()
                            .getPersistentDataContainer()
                            .get(App.main.nskEntityPokeball, PersistentDataType.STRING);
                    Integer variant = null;
                    Integer type = null;
                    Integer age = null;

                    if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta()
                            .getPersistentDataContainer().has(App.main.nskEntVariantPokeball)) {
                        variant = e.getPlayer().getInventory().getItemInMainHand().getItemMeta()
                                .getPersistentDataContainer()
                                .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER);
                    }
                    if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
                            .has(App.main.nskEntStylePokeball)) {
                        type = e.getPlayer().getInventory().getItemInMainHand().getItemMeta()
                                .getPersistentDataContainer()
                                .get(App.main.nskEntStylePokeball, PersistentDataType.INTEGER);
                    }
                    if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getPersistentDataContainer()
                            .has(App.main.nskAgePokeball)) {
                        age = e.getPlayer().getInventory().getItemInMainHand().getItemMeta()
                                .getPersistentDataContainer()
                                .get(App.main.nskAgePokeball, PersistentDataType.INTEGER);
                    }

                    App.main.usedPokeball = App.main.newPokeball.clone();
                    ItemMeta usedPBm = App.main.usedPokeball.getItemMeta();
                    usedPBm.getPersistentDataContainer().remove(App.main.nskPokeball);
                    usedPBm.getPersistentDataContainer().set(App.main.nskUsedPokeball, PersistentDataType.STRING,
                            "R3S_UsedPokeball");
                    usedPBm.getPersistentDataContainer().set(App.main.nskEntityPokeball, PersistentDataType.STRING,
                            enti);
                    if (variant != null) {
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                variant);
                    }
                    if (type != null) {
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntStylePokeball,
                                PersistentDataType.INTEGER,
                                type);
                    }
                    if (age != null) {
                        usedPBm.getPersistentDataContainer().set(App.main.nskAgePokeball,
                                PersistentDataType.INTEGER,
                                age);
                    }
                    usedPBm.displayName(Component.translatable(ChatColor.WHITE + enti + " - Pokéball"));
                    App.main.usedPokeball.setItemMeta(usedPBm);
                    b.setItem(App.main.usedPokeball);

                    e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 1,
                            1);

                    e.getPlayer().getInventory().getItemInMainHand().subtract(1);
                } else {
                    e.getPlayer().sendMessage(helper.R3SMessage(Type.ERROR,
                            "[Pokéball] Du kannst nur einen Pokéball nach dem anderen werfen!"));

                }
            }

        }
    }

    public Boolean isEmptyBall(Projectile ball) {
        if (ball instanceof Snowball && ((Snowball) ball).getItem().getItemMeta()
                .getPersistentDataContainer().has(App.main.nskPokeball, PersistentDataType.STRING)) {
            return true;
        }
        return false;
    }

    public Boolean isPokeBall(Projectile ball) {
        if (ball instanceof Snowball && ((Snowball) ball).getItem().getItemMeta()
                .getPersistentDataContainer().has(App.main.nskUsedPokeball, PersistentDataType.STRING)) {
            return true;
        }
        return false;
    }

    @EventHandler
    public void EmptyBallHitEntity(ProjectileHitEvent e) {
        if (!(((Projectile) e.getEntity()).getShooter() instanceof Player)) {
            return;
        }
        if (isEmptyBall(e.getEntity())) {
            e.setCancelled(true);
        }
        if (isEmptyBall(e.getEntity()) && e.getHitEntity() != null) {

            switch (e.getHitEntity().getType()) {
                case AXOLOTL:
                    whichHitEntity(e, EntityType.AXOLOTL, "Axolotl", ((Axolotl) e.getHitEntity()).getVariant(), null,
                            ((Axolotl) e.getHitEntity()).getAge());
                    break;
                case SQUID:
                    whichHitEntity(e, EntityType.SQUID, "Tintenfisch", null, null, null);
                    break;
                case GLOW_SQUID:
                    whichHitEntity(e, EntityType.GLOW_SQUID, "Leuchttintenfisch", null, null, null);
                    break;
                case BEE:
                    whichHitEntity(e, EntityType.BEE, "Biene", null, null, ((Bee) e.getHitEntity()).getAge());
                    break;
                case CHICKEN:
                    whichHitEntity(e, EntityType.CHICKEN, "Huhn", null, null, ((Chicken) e.getHitEntity()).getAge());
                    break;
                case COW:
                    whichHitEntity(e, EntityType.COW, "Kuh", null, null, ((Cow) e.getHitEntity()).getAge());
                    break;
                case DONKEY:
                    if (((Donkey) e.getHitEntity()).isCarryingChest()) {
                        ((Player) e.getEntity().getShooter())
                                .sendMessage(helper.R3SMessage(Type.ERROR,
                                        "Dieser Esel hat ein Inventar ausgerüstet!"));
                    } else {
                        whichHitEntity(e, EntityType.DONKEY, "Esel", null, null, ((Donkey) e.getHitEntity()).getAge());
                    }
                    break;
                case FOX:
                    whichHitEntity(e, EntityType.FOX, "Fuchs", null, null, ((Fox) e.getHitEntity()).getAge());
                    break;
                case GOAT:
                    whichHitEntity(e, EntityType.GOAT, "Ziege", null, null, ((Goat) e.getHitEntity()).getAge());
                    break;
                case HORSE:
                    if (((Horse) e.getHitEntity()) instanceof ChestedHorse) {
                        ((Player) e.getEntity().getShooter())
                                .sendMessage(helper.R3SMessage(Type.ERROR,
                                        "Dieses Pferd hat ein Inventar ausgerüstet!"));
                    } else {
                        whichHitEntity(e, EntityType.HORSE, "Pferd", ((Horse) e.getHitEntity()).getColor(),
                                ((Horse) e.getHitEntity()).getStyle(), ((Horse) e.getHitEntity()).getAge());
                    }
                    break;
                case LLAMA:
                    whichHitEntity(e, EntityType.LLAMA, "Lama", null, null, ((Llama) e.getHitEntity()).getAge());
                    break;
                case MULE:
                    if (((Mule) e.getHitEntity()).isCarryingChest()) {
                        ((Player) e.getEntity().getShooter())
                                .sendMessage(helper.R3SMessage(Type.ERROR,
                                        "Dieses Maultier hat ein Inventar ausgerüstet!"));
                    } else {
                        whichHitEntity(e, EntityType.MULE, "Maultier", null, null, ((Mule) e.getHitEntity()).getAge());
                    }
                    break;
                case MOOSHROOM:
                    whichHitEntity(e, EntityType.MOOSHROOM, "Pilzkuh", null, null,
                            ((MushroomCow) e.getHitEntity()).getAge());
                    break;
                case OCELOT:
                    whichHitEntity(e, EntityType.OCELOT, "Ozelot", null, null, ((Ocelot) e.getHitEntity()).getAge());
                    break;
                case PANDA:
                    whichHitEntity(e, EntityType.PANDA, "Panda", null, null, ((Panda) e.getHitEntity()).getAge());
                    break;
                case PARROT:
                    whichHitEntity(e, EntityType.PARROT, "Papagei", ((Parrot) e.getHitEntity()).getVariant(), null,
                            ((Parrot) e.getHitEntity()).getAge());
                    break;
                case PIG:
                    whichHitEntity(e, EntityType.PIG, "Schwein", null, null, ((Pig) e.getHitEntity()).getAge());
                    break;
                case POLAR_BEAR:
                    whichHitEntity(e, EntityType.POLAR_BEAR, "Eisbär", null, null,
                            ((PolarBear) e.getHitEntity()).getAge());
                    break;
                case RABBIT:
                    whichHitEntity(e, EntityType.RABBIT, "Hase", ((Rabbit) e.getHitEntity()).getRabbitType(), null,
                            ((Rabbit) e.getHitEntity()).getAge());
                    break;
                case SHEEP:
                    whichHitEntity(e, EntityType.SHEEP, "Schaf", ((Sheep) e.getHitEntity()).getColor(), null,
                            ((Sheep) e.getHitEntity()).getAge());
                    break;
                case TURTLE:
                    whichHitEntity(e, EntityType.TURTLE, "Schildkröte", null, null,
                            ((Turtle) e.getHitEntity()).getAge());
                    break;
                case FROG:
                    whichHitEntity(e, EntityType.FROG, "Frosch", ((Frog) e.getHitEntity()).getVariant(), null,
                            ((Frog) e.getHitEntity()).getAge());
                    break;
                case ALLAY:
                    whichHitEntity(e, EntityType.ALLAY, "Hilfsgeist", null, null, null);
                    break;
                case WOLF:
                    if (!((Wolf) e.getHitEntity()).isTamed()) {
                        whichHitEntity(e, EntityType.WOLF, "Wolf", null, null, ((Wolf) e.getHitEntity()).getAge());
                    } else {
                        ((Player) e.getEntity().getShooter())
                                .sendMessage(helper.R3SMessage(Type.ERROR,
                                        "Wer versucht, den Hund eines anderen zu stehlen, ist ein gemeiner Dieb!"));
                    }
                    break;
                case CAT:
                    if (!((Cat) e.getHitEntity()).isTamed()) {
                        whichHitEntity(e, EntityType.CAT, "Katze", ((Cat) e.getHitEntity()).getCatType(), null,
                                ((Cat) e.getHitEntity()).getAge());
                    } else {
                        ((Player) e.getEntity().getShooter()).sendMessage(helper.R3SMessage(Type.ERROR,
                                "Wer versucht, die Katze eines anderen zu stehlen, ist ein gemeiner Dieb!"));
                    }
                    break;
                case ARMADILLO:
                    whichHitEntity(e, EntityType.ARMADILLO, "Gürteltier", null, null, ((Armadillo) e.getHitEntity()).getAge());
                    break;
                default:
                    break;
            }
            e.getEntity().remove();
        }
        App.main.isThrownHM.put((Player) e.getEntity().getShooter(), false);

    }

    @EventHandler
    public void PokeBallHitEntity(ProjectileHitEvent e) {
        if (!(((Projectile) e.getEntity()).getShooter() instanceof Player)) {
            return;
        }
        if (isPokeBall(e.getEntity())) {
            e.setCancelled(true);
        }
        if (isPokeBall(e.getEntity())
                && e.getHitEntity() == null) {

            Location loc = new Location(e.getHitBlock().getWorld(), e.getHitBlock().getX(), e.getHitBlock().getY(),
                    e.getHitBlock().getZ());
            loc.setY(e.getHitBlock().getLocation().getY() + 1);
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Axolotl")) {
                Axolotl a = e.getEntity().getWorld().spawn(loc, Axolotl.class);
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        a.setVariant(Variant.BLUE);
                        break;
                    case 1:
                        a.setVariant(Variant.CYAN);
                        break;
                    case 2:
                        a.setVariant(Variant.GOLD);
                        break;
                    case 3:
                        a.setVariant(Variant.LUCY);
                        break;
                    case 4:
                        a.setVariant(Variant.WILD);
                        break;
                }
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Tintenfisch")) {
                e.getEntity().getWorld().spawn(loc, Squid.class);
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Leuchttintenfisch")) {
                e.getEntity().getWorld().spawn(loc, GlowSquid.class);
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Biene")) {
                Bee bee = e.getEntity().getWorld().spawn(loc, Bee.class);
                bee.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Huhn")) {
                Chicken chicken = e.getEntity().getWorld().spawn(loc, Chicken.class);
                chicken.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Kuh")) {
                Cow cow = e.getEntity().getWorld().spawn(loc, Cow.class);
                cow.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Esel")) {
                Donkey donkey = e.getEntity().getWorld().spawn(loc, Donkey.class);
                donkey.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Fuchs")) {
                Fox fox = e.getEntity().getWorld().spawn(loc, Fox.class);
                fox.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Ziege")) {
                Goat goat = e.getEntity().getWorld().spawn(loc, Goat.class);
                goat.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Pferd")) {
                Horse h = e.getEntity().getWorld().spawn(loc, Horse.class);
                h.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        h.setColor(Color.BLACK);
                        break;
                    case 1:
                        h.setColor(Color.BROWN);
                        break;
                    case 2:
                        h.setColor(Color.CHESTNUT);
                        break;
                    case 3:
                        h.setColor(Color.CREAMY);
                        break;
                    case 4:
                        h.setColor(Color.DARK_BROWN);
                        break;
                    case 5:
                        h.setColor(Color.GRAY);
                        break;
                    case 6:
                        h.setColor(Color.WHITE);
                        break;
                }
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntStylePokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        h.setStyle(Style.BLACK_DOTS);
                        break;
                    case 1:
                        h.setStyle(Style.NONE);
                        break;
                    case 2:
                        h.setStyle(Style.WHITE);
                        break;
                    case 3:
                        h.setStyle(Style.WHITEFIELD);
                        break;
                    case 4:
                        h.setStyle(Style.WHITE_DOTS);
                        break;
                }

            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Lama")) {
                Llama llama = e.getEntity().getWorld().spawn(loc, Llama.class);
                llama.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Maultier")) {
                Mule mule = e.getEntity().getWorld().spawn(loc, Mule.class);
                mule.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Pilzkuh")) {
                MushroomCow mCow = e.getEntity().getWorld().spawn(loc, MushroomCow.class);
                mCow.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Ozelot")) {
                Ocelot ocelot = e.getEntity().getWorld().spawn(loc, Ocelot.class);
                ocelot.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Panda")) {
                Panda panda = e.getEntity().getWorld().spawn(loc, Panda.class);
                panda.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Papagei")) {
                Parrot p = e.getEntity().getWorld().spawn(loc, Parrot.class);
                p.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        p.setVariant(org.bukkit.entity.Parrot.Variant.BLUE);
                        break;
                    case 1:
                        p.setVariant(org.bukkit.entity.Parrot.Variant.CYAN);
                        break;
                    case 2:
                        p.setVariant(org.bukkit.entity.Parrot.Variant.GRAY);
                        break;
                    case 3:
                        p.setVariant(org.bukkit.entity.Parrot.Variant.GREEN);
                        break;
                    case 4:
                        p.setVariant(org.bukkit.entity.Parrot.Variant.RED);
                        break;
                }
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Schwein")) {
                Pig pig = e.getEntity().getWorld().spawn(loc, Pig.class);
                pig.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Eisbär")) {
                PolarBear polarBear = e.getEntity().getWorld().spawn(loc, PolarBear.class);
                polarBear.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Hase")) {
                Rabbit r = e.getEntity().getWorld().spawn(loc, Rabbit.class);
                r.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        r.setRabbitType(Rabbit.Type.BLACK);
                        break;
                    case 1:
                        r.setRabbitType(Rabbit.Type.BLACK_AND_WHITE);
                        break;
                    case 2:
                        r.setRabbitType(Rabbit.Type.BROWN);
                        break;
                    case 3:
                        r.setRabbitType(Rabbit.Type.GOLD);
                        break;
                    case 4:
                        r.setRabbitType(Rabbit.Type.SALT_AND_PEPPER);
                        break;
                    case 5:
                        r.setRabbitType(Rabbit.Type.THE_KILLER_BUNNY);
                        break;
                    case 6:
                        r.setRabbitType(Rabbit.Type.WHITE);
                        break;
                }
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Schaf")) {
                Sheep s = e.getEntity().getWorld().spawn(loc, Sheep.class);
                s.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        s.setColor(DyeColor.WHITE);
                        break;
                    case 1:
                        s.setColor(DyeColor.BLACK);
                        break;
                    case 2:
                        s.setColor(DyeColor.BLUE);
                        break;
                    case 3:
                        s.setColor(DyeColor.BROWN);
                        break;
                    case 4:
                        s.setColor(DyeColor.CYAN);
                        break;
                    case 5:
                        s.setColor(DyeColor.GRAY);
                        break;
                    case 6:
                        s.setColor(DyeColor.GREEN);
                        break;
                    case 7:
                        s.setColor(DyeColor.LIGHT_BLUE);
                        break;
                    case 8:
                        s.setColor(DyeColor.LIGHT_GRAY);
                        break;
                    case 9:
                        s.setColor(DyeColor.LIME);
                        break;
                    case 10:
                        s.setColor(DyeColor.MAGENTA);
                        break;
                    case 11:
                        s.setColor(DyeColor.ORANGE);
                        break;
                    case 12:
                        s.setColor(DyeColor.PINK);
                        break;
                    case 13:
                        s.setColor(DyeColor.PURPLE);
                        break;
                    case 14:
                        s.setColor(DyeColor.RED);
                        break;
                    case 15:
                        s.setColor(DyeColor.YELLOW);
                        break;

                }
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Schildkröte")) {
                Turtle turtle = e.getEntity().getWorld().spawn(loc, Turtle.class);
                turtle.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Frosch")) {
                Frog f = e.getEntity().getWorld().spawn(loc, Frog.class);
                f.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        f.setVariant(org.bukkit.entity.Frog.Variant.COLD);
                        break;
                    case 1:
                        f.setVariant(org.bukkit.entity.Frog.Variant.TEMPERATE);
                        break;
                    case 2:
                        f.setVariant(org.bukkit.entity.Frog.Variant.WARM);
                        break;
                }
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Hilfsgeist")) {
                e.getEntity().getWorld().spawn(loc, Allay.class);
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Wolf")) {
                Wolf wolf = e.getEntity().getWorld().spawn(loc, Wolf.class);
                wolf.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                    .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Katze")) {
                Cat c = e.getEntity().getWorld().spawn(loc, Cat.class);
                c.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
                switch (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                        .get(App.main.nskEntVariantPokeball, PersistentDataType.INTEGER)) {
                    case 0:
                        c.setCatType(Cat.Type.ALL_BLACK);
                        break;
                    case 1:
                        c.setCatType(Cat.Type.BLACK);
                        break;
                    case 2:
                        c.setCatType(Cat.Type.BRITISH_SHORTHAIR);
                        break;
                    case 3:
                        c.setCatType(Cat.Type.CALICO);
                        break;
                    case 4:
                        c.setCatType(Cat.Type.JELLIE);
                        break;
                    case 5:
                        c.setCatType(Cat.Type.PERSIAN);
                        break;
                    case 6:
                        c.setCatType(Cat.Type.RAGDOLL);
                        break;
                    case 7:
                        c.setCatType(Cat.Type.RED);
                        break;
                    case 8:
                        c.setCatType(Cat.Type.SIAMESE);
                        break;
                    case 9:
                        c.setCatType(Cat.Type.TABBY);
                        break;
                    case 10:
                        c.setCatType(Cat.Type.WHITE);
                        break;
                }
            
            }
            if (((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
            .get(App.main.nskEntityPokeball, PersistentDataType.STRING).equals("Gürteltier")) {
        Armadillo armadillo = e.getEntity().getWorld().spawn(loc, Armadillo.class);
        armadillo.setAge(((Snowball) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer()
                .get(App.main.nskAgePokeball, PersistentDataType.INTEGER));
    }
            e.getEntity().getWorld().spawnParticle(Particle.FLASH, loc, 1);
            App.main.isThrownHM.put((Player) e.getEntity().getShooter(), false);

        }
    }

    private void whichHitEntity(ProjectileHitEvent e, EntityType et, String entityName, Object variant, Object type,
            Object age) {

        e.setCancelled(true);
        Location mobLoc = e.getHitEntity().getLocation();
        e.getHitEntity().getWorld().spawnParticle(Particle.FLASH, mobLoc, 1);
        e.getHitEntity().remove();
        App.main.usedPokeball = App.main.newPokeball.clone();
        ItemMeta usedPBm = App.main.usedPokeball.getItemMeta();
        List<Component> lore = new ArrayList<Component>();
        TextComponent tLore;
        usedPBm.getPersistentDataContainer().remove(App.main.nskPokeball);
        usedPBm.getPersistentDataContainer().set(App.main.nskUsedPokeball, PersistentDataType.STRING,
                "R3S_UsedPokeball");
        usedPBm.getPersistentDataContainer().set(App.main.nskEntityPokeball, PersistentDataType.STRING, entityName);
        if (age != null) {
            usedPBm.getPersistentDataContainer().set(App.main.nskAgePokeball,
                    PersistentDataType.INTEGER,
                    (int) age);
        }
        if (variant != null) {
            if (variant instanceof DyeColor) {
                switch ((DyeColor) variant) {
                    case WHITE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.WHITE + "Weiß"));
                        break;
                    case BLACK:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                1);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLACK + "Schwarz"));
                        break;
                    case BLUE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                2);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLUE + "Blau"));
                        break;
                    case BROWN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                3);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ").append(Component.text("Braun")
                                .decoration(TextDecoration.ITALIC, false).color(TextColor.fromHexString("#74492A")));
                        lore.add(tLore);
                        break;
                    case CYAN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                4);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Türkis", TextColor.fromHexString("#36ABCE"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case GRAY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                5);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau"));
                        break;
                    case GREEN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                6);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GREEN + "Grün"));
                        break;
                    case LIGHT_BLUE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                7);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Hellblau", TextColor.fromHexString("#33A8CE"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case LIGHT_GRAY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                8);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Hellgrau", TextColor.fromHexString("#93948B"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case LIME:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                9);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Hellgrün", TextColor.fromHexString("#6FB719"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case MAGENTA:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                10);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Magenta", TextColor.fromHexString("#CE55C4"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case ORANGE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                11);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Orange", TextColor.fromHexString("#F07413"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case PINK:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                12);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Rosa", TextColor.fromHexString("#EA8EAA"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case PURPLE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                13);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.LIGHT_PURPLE + "Lila"));
                        break;
                    case RED:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                14);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.RED + "Rot"));
                        break;
                    case YELLOW:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER,
                                15);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.YELLOW + "Gelb"));
                        break;
                }

            } else if (variant instanceof Variant) {
                switch (((Variant) variant)) {
                    case BLUE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLUE + "Blau"));
                        break;
                    case CYAN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 1);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Türkis", TextColor.fromHexString("#36ABCE"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case GOLD:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 2);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GOLD + "Gold"));
                        break;
                    case LUCY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 3);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Rosa", TextColor.fromHexString("#EA8EAA"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case WILD:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 4);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;

                }
            } else if (variant instanceof org.bukkit.entity.Frog.Variant) {
                switch (((org.bukkit.entity.Frog.Variant) variant).toString()) {
                    case "COLD":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GREEN + "Grün"));
                        break;
                    case "TEMPERATE":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 1);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Orange", TextColor.fromHexString("#F07413"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case "WARM":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 2);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau"));
                        break;
                    default:
                        break;
                }
            } else if (variant instanceof org.bukkit.entity.Parrot.Variant) {
                switch ((org.bukkit.entity.Parrot.Variant) variant) {
                    case BLUE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLUE + "BLAU"));
                        break;
                    case CYAN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 1);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Türkis", TextColor.fromHexString("#36ABCE"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case GRAY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 2);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau"));
                        break;
                    case GREEN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 3);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GREEN + "Grün"));
                        break;
                    case RED:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 4);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.RED + "Rot"));
                        break;

                }
            } else if (variant instanceof Rabbit.Type) {
                switch ((Rabbit.Type) variant) {
                    case BLACK:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLACK + "Schwarz"));
                        break;
                    case BLACK_AND_WHITE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 1);
                        lore.add(Component.text(
                                ChatColor.WHITE + "Farbe: " + ChatColor.BLACK + "Schwarz" + ChatColor.WHITE + "weiß"));
                        break;
                    case BROWN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 2);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case GOLD:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 3);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GOLD + "Gold"));
                        break;
                    case SALT_AND_PEPPER:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 4);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau"));
                        break;
                    case THE_KILLER_BUNNY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 5);
                        break;
                    case WHITE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 6);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.WHITE + "Weiß"));
                        break;
                }
            } else if (variant instanceof Cat.Type) {
                switch (((Cat.Type) variant).toString()) {
                    case "ALL_BLACK":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLACK + "Schwarz"));
                        break;
                    case "BLACK":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 1);
                        lore.add(Component.text(
                                ChatColor.WHITE + "Farbe: " + ChatColor.BLACK + "Schwarz" + ChatColor.WHITE + "weiß"));
                        break;
                    case "BRITISH_SHORTHAIR":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 2);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau"));
                        break;
                    case "CALICO":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 3);

                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Orange", TextColor.fromHexString("#F07413"))
                                        .decoration(TextDecoration.ITALIC, false))
                                .append(Component.text(ChatColor.WHITE + "weiß").decoration(TextDecoration.ITALIC,
                                        false))
                                .append(Component.text("braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);

                        break;
                    case "JELLIE":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 4);
                        lore.add(Component.text(
                                ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau" + ChatColor.WHITE + "weiß"));
                        break;
                    case "PERSIAN":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 5);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Creme", TextColor.fromHexString("#FCDCB0"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case "RAGDOLL":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 6);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false))
                                .append(Component.text(ChatColor.WHITE + "weiß").decoration(TextDecoration.ITALIC,
                                        false));
                        lore.add(tLore);
                        break;
                    case "RED":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 7);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Orange", TextColor.fromHexString("#F07413"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case "SIAMESE":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 8);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text(ChatColor.GRAY + "Grau").decoration(TextDecoration.ITALIC,
                                        false))
                                .append(Component.text("braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case "TABBY":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 9);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case "WHITE":
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 10);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.WHITE + "Weiß"));
                        break;
                    default:
                    break;
                }
            } else if (variant instanceof Horse.Color) {
                switch ((Horse.Color) variant) {
                    case BLACK:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 0);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.BLACK + "Schwarz"));
                        break;
                    case BROWN:

                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 1);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Braun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);

                        break;
                    case CHESTNUT:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 2);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Orange", TextColor.fromHexString("#F07413"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case CREAMY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 3);

                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Creme", TextColor.fromHexString("#FCDCB0"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case DARK_BROWN:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 4);
                        tLore = Component.text(ChatColor.WHITE + "Farbe: ")
                                .append(Component.text("Dunkelbraun", TextColor.fromHexString("#74492A"))
                                        .decoration(TextDecoration.ITALIC, false));
                        lore.add(tLore);
                        break;
                    case GRAY:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 5);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.GRAY + "Grau"));
                        break;
                    case WHITE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntVariantPokeball,
                                PersistentDataType.INTEGER, 6);
                        lore.add(Component.text(ChatColor.WHITE + "Farbe: " + ChatColor.WHITE + "Weiß"));
                        break;
                }

                TextComponent tmLore;
                switch ((Horse.Style) type) {
                    case BLACK_DOTS:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntStylePokeball,
                                PersistentDataType.INTEGER, 0);
                        tmLore = Component.text(ChatColor.WHITE + "Muster: ")
                                .append(Component.text(ChatColor.BLACK + "Schwarz "))
                                .decoration(TextDecoration.ITALIC, false)
                                .append(Component.text(ChatColor.WHITE + "gepunktet"))
                                .decoration(TextDecoration.ITALIC, false);
                        lore.add(tmLore);
                        break;
                    case NONE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntStylePokeball,
                                PersistentDataType.INTEGER, 1);
                        tmLore = Component.text(ChatColor.WHITE + "Muster: ")
                                .append(Component.text(ChatColor.WHITE + "Keines"))
                                .decoration(TextDecoration.ITALIC, false);
                        lore.add(tmLore);
                        break;
                    case WHITE:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntStylePokeball,
                                PersistentDataType.INTEGER, 2);
                        tmLore = Component.text(ChatColor.WHITE + "Muster: Weiße Beine")
                                .decoration(TextDecoration.ITALIC, false);
                        lore.add(tmLore);
                        break;
                    case WHITEFIELD:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntStylePokeball,
                                PersistentDataType.INTEGER, 3);
                        tmLore = Component.text(ChatColor.WHITE + "Muster: Wolken").decoration(TextDecoration.ITALIC,
                                false);
                        lore.add(tmLore);

                        break;
                    case WHITE_DOTS:
                        usedPBm.getPersistentDataContainer().set(App.main.nskEntStylePokeball,
                                PersistentDataType.INTEGER, 4);
                        tmLore = Component.text(ChatColor.WHITE + "Muster: Weiß Gepunktet")
                                .decoration(TextDecoration.ITALIC, false);
                        lore.add(tmLore);
                        break;
                }
            }
        }

        usedPBm.displayName(Component.translatable(ChatColor.WHITE + entityName + " - Pokéball"));
        usedPBm.lore(lore);
        App.main.usedPokeball.setItemMeta(usedPBm);
        App.main.getServer().getWorlds().get(0).dropItem(mobLoc, App.main.usedPokeball);

    }

}