Search in sources :

Example 1 with LlamaMenu

use of com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.llama.LlamaMenu in project buildinggame by stefvanschie.

the class EntityOptionsMenu method onEntityInteract.

/**
 * Called whenever a player interacts with an entity
 *
 * @param e the event that is called when a player interacts with an entity
 * @since 5.3.0
 */
@EventHandler
public void onEntityInteract(PlayerInteractEntityEvent e) {
    SettingsManager settingsManager = SettingsManager.getInstance();
    if (e.getHand() != EquipmentSlot.HAND || !settingsManager.getConfig().getBoolean("mobs.options.enable")) {
        return;
    }
    var entity = e.getRightClicked();
    EntityType entityType = entity.getType();
    Player player = e.getPlayer();
    if (SHIFT_CLICK_TYPES.contains(entityType) && !player.isSneaking()) {
        return;
    }
    Plot plot = null;
    loop: for (var arena : ArenaManager.getInstance().getArenas()) {
        for (Plot p : arena.getUsedPlots()) {
            if (p.getEntities().containsKey(entity)) {
                plot = p;
                break loop;
            }
        }
    }
    if (plot == null || plot.getArena().getState() != GameState.BUILDING) {
        return;
    }
    switch(entityType) {
        case CHICKEN:
        case COW:
        case GOAT:
        case OCELOT:
        case SKELETON_HORSE:
        case POLAR_BEAR:
        case HUSK:
        case ZOMBIE:
        case TURTLE:
        case PIGLIN:
        case HOGLIN:
        case STRIDER:
        case ZOGLIN:
            new BabyMenu(plot, entity).show(player);
            break;
        case DONKEY:
        case MULE:
            new ChestMenu(plot, (ChestedHorse) entity).show(player);
            break;
        case VILLAGER:
        case ZOMBIE_VILLAGER:
            new VillagerlikeMenu(plot, (Creature) entity).show(player);
            break;
        case PHANTOM:
        case MAGMA_CUBE:
        case SLIME:
            new SizeMenu(plot, (Mob) entity).show(player);
            break;
        case AXOLOTL:
            new AxolotlMenu(plot, (Axolotl) entity).show(player);
            break;
        case PIG:
            new PigMenu(plot, (Pig) entity).show(player);
            break;
        case RABBIT:
            new RabbitMenu(plot, (Rabbit) entity).show(player);
            break;
        case SHEEP:
            new SheepMenu(plot, (Sheep) entity).show(player);
            break;
        case CREEPER:
            new CreeperMenu(plot, (Creeper) entity).show(player);
            break;
        case SHULKER:
            new ShulkerMenu(plot, (Shulker) entity).show(player);
            break;
        case HORSE:
            new HorseMenu(plot, (Horse) entity).show(player);
            break;
        case LLAMA:
            new LlamaMenu(plot, (Llama) entity).show(player);
            break;
        case PARROT:
            new ParrotMenu(plot, (Parrot) entity).show(player);
            break;
        case WOLF:
            new ColorMenu(plot, (Animals) entity).show(player);
            break;
        case SNOWMAN:
            new SnowGolemMenu(plot, (Snowman) entity).show(player);
            break;
        case PUFFERFISH:
            new PufferfishMenu(plot, (PufferFish) entity).show(player);
            break;
        case TROPICAL_FISH:
            new TropicalFishMenu(plot, (TropicalFish) entity).show(player);
            break;
        case MUSHROOM_COW:
            new MooshroomMenu(plot, (MushroomCow) entity).show(player);
            break;
        case PANDA:
            new PandaMenu(plot, (Panda) entity).show(player);
            break;
        case CAT:
            new CatMenu(plot, (Cat) entity).show(player);
            break;
        case FOX:
            new FoxMenu(plot, (Fox) entity).show(player);
            break;
        case BEE:
            new BeeMenu(plot, (Bee) entity).show(player);
            break;
        case IRON_GOLEM:
            new IronGolemMenu(plot, (IronGolem) entity).show(player);
            break;
        default:
            new RemoveMenu(plot, entity).show(player);
            break;
    }
    e.setCancelled(true);
}
Also used : TropicalFishMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.tropicalfish.TropicalFishMenu) LlamaMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.llama.LlamaMenu) ChestMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.ChestMenu) PufferfishMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.pufferfish.PufferfishMenu) Plot(com.gmail.stefvanschiedev.buildinggame.utils.plot.Plot) BabyMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.BabyMenu) VillagerlikeMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.villagerlike.VillagerlikeMenu) ParrotMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.parrot.ParrotMenu) FoxMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.fox.FoxMenu) AxolotlMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.axolotl.AxolotlMenu) ColorMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.color.ColorMenu) RabbitMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.rabbit.RabbitMenu) IronGolemMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.irongolem.IronGolemMenu) MooshroomMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.mooshroom.MooshroomMenu) SettingsManager(com.gmail.stefvanschiedev.buildinggame.managers.files.SettingsManager) HorseMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.horse.HorseMenu) RemoveMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.RemoveMenu) SizeMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.size.SizeMenu) PandaMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.panda.PandaMenu) CatMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.cat.CatMenu) EventHandler(org.bukkit.event.EventHandler)

Aggregations

SettingsManager (com.gmail.stefvanschiedev.buildinggame.managers.files.SettingsManager)1 BabyMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.BabyMenu)1 ChestMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.ChestMenu)1 RemoveMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.RemoveMenu)1 ColorMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.color.ColorMenu)1 AxolotlMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.axolotl.AxolotlMenu)1 CatMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.cat.CatMenu)1 FoxMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.fox.FoxMenu)1 HorseMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.horse.HorseMenu)1 IronGolemMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.irongolem.IronGolemMenu)1 LlamaMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.llama.LlamaMenu)1 MooshroomMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.mooshroom.MooshroomMenu)1 PandaMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.panda.PandaMenu)1 ParrotMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.parrot.ParrotMenu)1 PufferfishMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.pufferfish.PufferfishMenu)1 RabbitMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.rabbit.RabbitMenu)1 TropicalFishMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.tropicalfish.TropicalFishMenu)1 VillagerlikeMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.mobs.villagerlike.VillagerlikeMenu)1 SizeMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.moboptions.size.SizeMenu)1 Plot (com.gmail.stefvanschiedev.buildinggame.utils.plot.Plot)1