Search in sources :

Example 6 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class SpawnCommand method spawnCustomBossCommand.

public static void spawnCustomBossCommand(CommandSender commandSender, String fileName, String world, Vector coords) {
    try {
        Location location = new Location(Bukkit.getWorld(world), coords.getX(), coords.getY(), coords.getZ());
        CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
        if (customBossesConfigFields == null) {
            commandSender.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
            return;
        }
        CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
        customBossEntity.setSpawnLocation(location);
        customBossEntity.spawn(false);
    } catch (Exception e) {
        commandSender.sendMessage("[EliteMobs] World argument was not valid!");
    }
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) Location(org.bukkit.Location)

Example 7 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class CustomSummonPower method doGlobalSummonReinforcement.

private CustomBossReinforcement doGlobalSummonReinforcement(String filename) {
    CustomBossReinforcement customBossReinforcement = new CustomBossReinforcement(SummonType.GLOBAL, filename);
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(customBossReinforcement.bossFileName);
    if (customBossesConfigFields == null) {
        new WarningMessage("Reinforcement mob " + customBossReinforcement.bossFileName + " is not valid!");
        return null;
    }
    customBossReinforcement.entityType = customBossesConfigFields.getEntityType();
    customBossReinforcements.add(customBossReinforcement);
    return customBossReinforcement;
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage)

Example 8 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class CustomBossMount method generateMount.

public static CustomBossEntity generateMount(CustomBossEntity customBossEntity) {
    if (customBossEntity.customBossesConfigFields.getMountedEntity() == null)
        return null;
    try {
        EntityType entityType = EntityType.valueOf(customBossEntity.customBossesConfigFields.getMountedEntity());
        LivingEntity livingEntity = (LivingEntity) customBossEntity.getLivingEntity().getWorld().spawnEntity(customBossEntity.getLivingEntity().getLocation(), entityType);
        PreventMountExploit.bypass = true;
        livingEntity.addPassenger(customBossEntity.getLivingEntity());
        livingEntity.setRemoveWhenFarAway(false);
        customBossEntity.livingEntityMount = livingEntity;
    } catch (Exception ex) {
        // This runs when it's not an API entity
        CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(customBossEntity.customBossesConfigFields.getMountedEntity());
        if (customBossesConfigFields != null) {
            CustomBossEntity mountEntity = CustomBossEntity.createCustomBossEntity(customBossEntity.customBossesConfigFields.getMountedEntity());
            if (mountEntity == null) {
                new WarningMessage("Mount for boss " + customBossEntity.getCustomBossesConfigFields().getFilename() + " is not valid!");
                return null;
            }
            mountEntity.setSpawnLocation(customBossEntity.getLivingEntity().getLocation());
            mountEntity.setBypassesProtections(customBossEntity.getBypassesProtections());
            mountEntity.setPersistent(false);
            mountEntity.setMount(true);
            mountEntity.spawn(false);
            new BukkitRunnable() {

                @Override
                public void run() {
                    if (!mountEntity.isValid())
                        return;
                    PreventMountExploit.bypass = true;
                    mountEntity.getLivingEntity().addPassenger(customBossEntity.getLivingEntity());
                    customBossEntity.customBossMount = mountEntity;
                }
            }.runTaskLater(MetadataHandler.PLUGIN, 5);
            return mountEntity;
        }
        new WarningMessage("Attempted to make Custom Boss " + customBossEntity.customBossesConfigFields.getFilename() + " mount invalid" + " entity or boss " + customBossEntity.customBossesConfigFields.getMountedEntity() + " . Fix this in the configuration file.");
    }
    return null;
}
Also used : EntityType(org.bukkit.entity.EntityType) LivingEntity(org.bukkit.entity.LivingEntity) CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable)

Example 9 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class Minidungeon method quantifySchematicBosses.

public void quantifySchematicBosses(boolean freshInstall) {
    if (!isInstalled)
        return;
    if (!freshInstall) {
        this.relativeBossLocations = new RelativeDungeonLocations(dungeonPackagerConfigFields.getRelativeBossLocations(), true);
        this.relativeTreasureChestLocations = new RelativeDungeonLocations(dungeonPackagerConfigFields.getRelativeTreasureChestLocations(), false);
        this.realDungeonLocations = new RealDungeonLocations();
    }
    this.teleportLocation = getRotatedFinalLocation(dungeonPackagerConfigFields.getAnchorPoint(), dungeonPackagerConfigFields.getTeleportPoint());
    for (String regionalBossLocations : dungeonPackagerConfigFields.getRelativeBossLocations()) {
        String bossFileName = regionalBossLocations.split(":")[0];
        CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(bossFileName);
        quantificationFilter(customBossesConfigFields);
        RegionalBossEntity.getRegionalBossEntities(customBossesConfigFields).forEach((regionalBossEntity -> regionalBossEntity.setMinidungeon(this)));
        if (customBossesConfigFields != null && customBossesConfigFields.isRegionalBoss())
            regionalBossCount++;
    }
}
Also used : TreasureChest(com.magmaguy.elitemobs.treasurechest.TreasureChest) Setter(lombok.Setter) java.util(java.util) WarningMessage(com.magmaguy.elitemobs.utils.WarningMessage) Getter(lombok.Getter) CustomBossesConfig(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig) Text(net.md_5.bungee.api.chat.hover.content.Text) ClickEvent(net.md_5.bungee.api.chat.ClickEvent) EventCaller(com.magmaguy.elitemobs.utils.EventCaller) CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) Player(org.bukkit.entity.Player) TextComponent(net.md_5.bungee.api.chat.TextComponent) DungeonPackagerConfigFields(com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields) CustomTreasureChestsConfig(com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig) MinidungeonWorldLoader(com.magmaguy.elitemobs.dungeons.worlds.MinidungeonWorldLoader) Location(org.bukkit.Location) NewMinidungeonRelativeBossLocationEvent(com.magmaguy.elitemobs.api.internal.NewMinidungeonRelativeBossLocationEvent) World(org.bukkit.World) MetadataHandler(com.magmaguy.elitemobs.MetadataHandler) GenericRotationMatrixMath(com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath) InfoMessage(com.magmaguy.elitemobs.utils.InfoMessage) Bukkit(org.bukkit.Bukkit) HoverEvent(net.md_5.bungee.api.chat.HoverEvent) RemovalReason(com.magmaguy.elitemobs.api.internal.RemovalReason) Files(java.nio.file.Files) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) CustomTreasureChestConfigFields(com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields) EntityTracker(com.magmaguy.elitemobs.entitytracker.EntityTracker) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) File(java.io.File) Vector(org.bukkit.util.Vector) Paths(java.nio.file.Paths) WorldGuardCompatibility(com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility) SpigotMessage(com.magmaguy.elitemobs.utils.SpigotMessage) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity) ChatColorConverter(com.magmaguy.elitemobs.ChatColorConverter) CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)

Example 10 with CustomBossesConfigFields

use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.

the class SpawnCommand method spawnCustomBossCommand.

public static void spawnCustomBossCommand(Player player, String fileName, int level) {
    CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(fileName);
    if (customBossesConfigFields == null) {
        player.sendMessage("Filename " + fileName + " is not valid! Make sure you are writing the name of a configuration file in the custombosses folder!");
        return;
    }
    CustomBossEntity customBossEntity = new CustomBossEntity(customBossesConfigFields);
    customBossEntity.setSpawnLocation(getLocation(player));
    customBossEntity.setLevel(level);
    customBossEntity.spawn(false);
}
Also used : CustomBossesConfigFields(com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)

Aggregations

CustomBossesConfigFields (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields)11 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)5 WarningMessage (com.magmaguy.elitemobs.utils.WarningMessage)4 Location (org.bukkit.Location)4 RegionalBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)2 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)2 ChatColorConverter (com.magmaguy.elitemobs.ChatColorConverter)1 MetadataHandler (com.magmaguy.elitemobs.MetadataHandler)1 NewMinidungeonRelativeBossLocationEvent (com.magmaguy.elitemobs.api.internal.NewMinidungeonRelativeBossLocationEvent)1 RemovalReason (com.magmaguy.elitemobs.api.internal.RemovalReason)1 CustomBossesConfig (com.magmaguy.elitemobs.config.custombosses.CustomBossesConfig)1 CustomTreasureChestConfigFields (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestConfigFields)1 CustomTreasureChestsConfig (com.magmaguy.elitemobs.config.customtreasurechests.CustomTreasureChestsConfig)1 DungeonPackagerConfigFields (com.magmaguy.elitemobs.config.dungeonpackager.DungeonPackagerConfigFields)1 Minidungeon (com.magmaguy.elitemobs.dungeons.Minidungeon)1 MinidungeonWorldLoader (com.magmaguy.elitemobs.dungeons.worlds.MinidungeonWorldLoader)1 EntityTracker (com.magmaguy.elitemobs.entitytracker.EntityTracker)1 EliteEntity (com.magmaguy.elitemobs.mobconstructor.EliteEntity)1 GenericRotationMatrixMath (com.magmaguy.elitemobs.powerstances.GenericRotationMatrixMath)1 WorldGuardCompatibility (com.magmaguy.elitemobs.thirdparty.worldguard.WorldGuardCompatibility)1