use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.
the class RegionalBossEntity method save.
public static void save() {
for (CustomBossesConfigFields customBossesConfigFields : regionalBossesFromConfigFields.keySet()) {
if (!customBossesConfigFields.isFilesOutOfSync())
continue;
customBossesConfigFields.setFilesOutOfSync(false);
List<String> spawnLocations = new ArrayList<>();
for (RegionalBossEntity regionalBossEntity : regionalBossesFromConfigFields.get(customBossesConfigFields)) spawnLocations.add(regionalBossEntity.rawString);
customBossesConfigFields.getFileConfiguration().set("spawnLocations", spawnLocations);
try {
customBossesConfigFields.getFileConfiguration().save(customBossesConfigFields.getFile());
} catch (Exception ex) {
new WarningMessage("Failed to save respawn timer for " + customBossesConfigFields.getFileConfiguration().getName() + " !");
}
}
}
use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.
the class TransitiveBlockCommand method processCommand.
public static TransitiveBlockCommand processCommand(Player player, String filename, String transitiveBlockType, boolean edit) {
CustomBossesConfigFields customBossesConfigFields = CustomBossesConfig.getCustomBoss(filename);
if (customBossesConfigFields == null) {
player.sendMessage("Boss file isn't valid! Try again with a valid filename for your custom boss.");
return null;
}
if (!customBossesConfigFields.isRegionalBoss()) {
player.sendMessage(ChatColor.RED + "Boss file isn't for a regional boss! This feature only works for regional bosses.");
player.sendMessage(ChatColor.GREEN + "Ignore this warning if you are setting blocks for a phase boss whose first phase is a regional boss!");
}
TransitiveBlockType tbt = null;
try {
tbt = TransitiveBlockType.valueOf(transitiveBlockType);
} catch (Exception ex) {
player.sendMessage("Not a valid transitive block type, use ON_SPAWN or ON_REMOVE !");
return null;
}
if (activePlayers.containsKey(player)) {
activePlayers.get(player).commitLocations();
return null;
} else
return new TransitiveBlockCommand(player, customBossesConfigFields, tbt, edit);
}
use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.
the class CustomBossCommandHandler method addRelativeSpawnLocation.
public static void addRelativeSpawnLocation(Player player, String customBossConfigFieldsString, String minidungeonString) {
Minidungeon minidungeon = Minidungeon.getMinidungeons().get(minidungeonString);
if (minidungeon == null) {
player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Minidungeon is not valid!"));
return;
}
CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
if (customBossesConfigFields == null)
player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed to add relative location! Custom boss is not valid!"));
else {
Location safeSpawnLocation = autoSeekSafeSpawnLocation(player.getLocation());
if (safeSpawnLocation == null)
player.sendMessage("[EliteMobs] No safe spawn location found! Make sure the area is passable!");
else
minidungeon.initializeRelativeLocationAddition(customBossesConfigFields, safeSpawnLocation);
}
}
use of com.magmaguy.elitemobs.config.custombosses.CustomBossesConfigFields in project EliteMobs by MagmaGuy.
the class CustomBossCommandHandler method setLeashRadius.
public static void setLeashRadius(String customBossConfigFieldsString, CommandSender commandSender, int leashRadius) {
CustomBossesConfigFields customBossesConfigFields = CustomBossesConfigFields.getRegionalElites().get(customBossConfigFieldsString);
if (customBossesConfigFields == null) {
commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Failed set the leash radius! Was the boss a valid regional boss?"));
return;
}
customBossesConfigFields.runtimeSetLeashRadius(leashRadius);
for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntitySet()) if (customBossesConfigFields.getFilename().equals(regionalBossEntity.getCustomBossesConfigFields().getFilename()))
regionalBossEntity.setLeashRadius(leashRadius);
}
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) {
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.spawn(false);
}
Aggregations