Search in sources :

Example 1 with PetDefault

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;
}
Also used : PetDefault(simplepets.brainsynder.pet.PetDefault) TypeManager(simplepets.brainsynder.pet.TypeManager)

Example 2 with PetDefault

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);
}
Also used : PetDefault(simplepets.brainsynder.pet.PetDefault) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable)

Example 3 with PetDefault

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);
}
Also used : PetDefault(simplepets.brainsynder.pet.PetDefault) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable)

Example 4 with PetDefault

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);
    }
}
Also used : PetDefault(simplepets.brainsynder.pet.PetDefault)

Example 5 with PetDefault

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;
}
Also used : JSONObject(org.json.simple.JSONObject) PetDefault(simplepets.brainsynder.pet.PetDefault) JSONArray(org.json.simple.JSONArray) MenuItem(simplepets.brainsynder.menu.menuItems.base.MenuItem) JSONObject(org.json.simple.JSONObject)

Aggregations

PetDefault (simplepets.brainsynder.pet.PetDefault)14 Player (org.bukkit.entity.Player)8 ItemStack (org.bukkit.inventory.ItemStack)4 Inventory (org.bukkit.inventory.Inventory)3 JSONArray (org.json.simple.JSONArray)3 StorageList (simple.brainsynder.storage.StorageList)3 ObjectPager (simple.brainsynder.utils.ObjectPager)3 CustomInventory (simplepets.brainsynder.menu.inventory.CustomInventory)3 Item (simplepets.brainsynder.menu.items.Item)3 Air (simplepets.brainsynder.menu.items.list.Air)3 TypeManager (simplepets.brainsynder.pet.TypeManager)3 PetTypeStorage (simplepets.brainsynder.storage.PetTypeStorage)3 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)2 JSONObject (org.json.simple.JSONObject)2 ItemBuilder (simple.brainsynder.api.ItemBuilder)2 PetCommandSummonEvent (simplepets.brainsynder.api.event.inventory.PetCommandSummonEvent)2 PetInventoryOpenEvent (simplepets.brainsynder.api.event.inventory.PetInventoryOpenEvent)2 SelectionHolder (simplepets.brainsynder.menu.holders.SelectionHolder)2 ShulkerDefault (simplepets.brainsynder.pet.types.ShulkerDefault)2 PetOwner (simplepets.brainsynder.player.PetOwner)2