use of simplepets.brainsynder.pet.PetDefault in project SimplePets by brainsynder-Dev.
the class PetOwner method getOwnedPetList.
public List<PetDefault> getOwnedPetList() {
List<PetDefault> list = new ArrayList<>();
if (!ownedPets.isEmpty()) {
TypeManager manager = PetCore.get().getTypeManager();
ownedPets.forEach(o -> {
PetDefault type = manager.getType(String.valueOf(o));
if (type != null)
list.add(type);
});
}
return list;
}
use of simplepets.brainsynder.pet.PetDefault in project SimplePets by brainsynder-Dev.
the class PetOwner method respawnPet.
public void respawnPet() {
if (hasPet())
return;
if (!hasPetToRespawn())
return;
if (!petToRespawn.hasKey("PetType"))
return;
PetDefault type = PetCore.get().getTypeManager().getType(petToRespawn.getString("PetType"));
type.setPet(player);
new BukkitRunnable() {
@Override
public void run() {
if (hasPet()) {
getPet().getVisableEntity().applyCompound(petToRespawn);
petToRespawn = null;
}
}
}.runTaskLater(PetCore.get(), 2);
}
use of simplepets.brainsynder.pet.PetDefault in project SimplePets by brainsynder-Dev.
the class PetOwner method respawnPet.
public void respawnPet(StorageTagCompound compound) {
if (!compound.hasKey("PetType"))
return;
if (hasPet()) {
removePet();
}
PetDefault type = PetCore.get().getTypeManager().getType(compound.getString("PetType"));
type.setPet(player);
new BukkitRunnable() {
@Override
public void run() {
if (hasPet()) {
getPet().getVisableEntity().applyCompound(compound);
}
}
}.runTaskLater(PetCore.get(), 2);
}
use of simplepets.brainsynder.pet.PetDefault in project SimplePets by brainsynder-Dev.
the class EconomyFile method loadDefaults.
public void loadDefaults() {
setDefault("prefix", "&eSimplePets &6>>");
setDefault("PurchaseSuccessful", "{prefix} &7You have Successfully Purchased the %type% Pet.");
setDefault("InsufficientFunds", "{prefix} &cYou do not have enough money to buy this pet, you need to have %price%");
setDefault("Price-Free", "Free");
setDefault("Bypass.Price", "BYPASSED");
setDefault("Bypass.Hide-Price-If-Bypassed", true);
setDefault("Pay-Per-Use.Enabled", false);
setDefault("Pay-Per-Use.Paid", "{prefix} &7You have Successfully Paid for the %type% Pet.");
setDefault("Pay-Per-Use.Lore-Lines", Collections.singletonList("&6Price: &e%cost%"));
setDefault("Lore-Lines", Arrays.asList("&6Price: &e%cost%", "&6Purchased: &e%contains%"));
for (PetDefault type : PetCore.get().getTypeManager().getTypes()) {
setDefault("Pet." + type.getConfigName() + ".Price", 2000.0);
}
}
use of simplepets.brainsynder.pet.PetDefault in project SimplePets by brainsynder-Dev.
the class ReflectionUtil method getMenuItemsJSON.
public static JSONObject getMenuItemsJSON(List<Class<? extends MenuItem>> c, PetDefault type) {
JSONObject a = new JSONObject();
for (Class<? extends MenuItem> cl : c) {
JSONArray as = new JSONArray();
MenuItem menuItem = initiateClass(fillConstructor(cl, PetDefault.class), type);
try {
for (Object object : menuItem.getDefaultItems()) {
as.add(((ItemBuilder) object).toJSON());
}
} catch (NullPointerException e) {
e.printStackTrace();
}
a.put(menuItem.getTargetName(), as);
}
return a;
}
Aggregations