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!");
}
}
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;
}
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;
}
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++;
}
}
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);
}
Aggregations