use of de.Keyle.MyPet.api.util.configuration.ConfigurationNBT in project MyPet by xXKeyleXx.
the class SkillTreeLoaderNBT method loadSkillTrees.
public void loadSkillTrees(String configPath, List<String> mobtypes) {
ConfigurationNBT skilltreeConfig;
File skillFile;
for (String mobType : mobtypes) {
skillFile = new File(configPath + File.separator + mobType.toLowerCase() + ".st");
SkillTreeMobType skillTreeMobType;
if (mobType.equalsIgnoreCase("default")) {
skillTreeMobType = SkillTreeMobType.DEFAULT;
} else {
skillTreeMobType = SkillTreeMobType.getMobTypeByName(mobType);
}
if (!skillFile.exists()) {
continue;
}
skilltreeConfig = new ConfigurationNBT(skillFile);
if (skilltreeConfig.load()) {
try {
loadSkillTree(skilltreeConfig, skillTreeMobType);
} catch (Exception e) {
MyPetApi.getLogger().warning("Error while loading skilltrees from: " + mobType.toLowerCase() + ".st");
e.printStackTrace();
}
}
skillTreeMobType.cleanupPlaces();
}
}
use of de.Keyle.MyPet.api.util.configuration.ConfigurationNBT in project MyPet by xXKeyleXx.
the class SkillTreeLoaderNBT method saveSkillTrees.
public List<String> saveSkillTrees(String configPath, String[] mobtypes) {
ConfigurationNBT nbtConfig;
File skillFile;
List<String> savedPetTypes = new ArrayList<>();
for (String petType : mobtypes) {
skillFile = new File(configPath + File.separator + petType.toLowerCase() + ".st");
nbtConfig = new ConfigurationNBT(skillFile);
if (saveSkillTree(nbtConfig, petType)) {
savedPetTypes.add(petType);
}
}
return savedPetTypes;
}
use of de.Keyle.MyPet.api.util.configuration.ConfigurationNBT in project MyPet by xXKeyleXx.
the class NbtRepository method loadData.
private void loadData(File f) {
ConfigurationNBT nbtConfiguration = new ConfigurationNBT(f);
if (!nbtConfiguration.load()) {
return;
}
if (nbtConfiguration.getNBTCompound().containsKeyAs("Players", TagList.class)) {
int playerCount = loadPlayers(nbtConfiguration.getNBTCompound().getAs("Players", TagList.class));
MyPetApi.getLogger().info("[NBT] " + ChatColor.YELLOW + playerCount + ChatColor.RESET + " PetPlayer(s) loaded");
}
int petCount = loadPets(nbtConfiguration.getNBTCompound().getAs("Pets", TagList.class));
MyPetApi.getLogger().info("[NBT] " + ChatColor.YELLOW + petCount + ChatColor.RESET + " pet(s) loaded");
}
Aggregations