Search in sources :

Example 1 with Trigger

use of net.poweredbyhate.wildtp.TeleportGoneWild.Trigger in project WildernessTp by AcmeProject.

the class WorldConfig method hurryPeter.

private HashMap<Trigger, PotionEffect[]> hurryPeter(ConfigurationSection v, ConfigurationSection d, int w) {
    HashMap<Trigger, PotionEffect[]> map = new HashMap<Trigger, PotionEffect[]>();
    for (Trigger when : Trigger.values()) {
        HashSet<PotionEffect> effects = new HashSet<PotionEffect>();
        String emmaString = "Effects." + when.toString();
        List<String> emmaGivDis = (v != null && v.contains(emmaString)) ? v.getStringList(emmaString) : d.getStringList(emmaString);
        emmaGivDis.forEach(patronus -> {
            String[] spell = patronus.split(":");
            PotionEffectType agrud = PotionEffectType.getByName(spell[0]);
            if (agrud == null)
                return;
            int voldo = 0;
            if (spell.length == 2)
                try {
                    voldo = Integer.parseInt(spell[1]);
                } catch (NumberFormatException e) {
                }
            effects.add(new PotionEffect(agrud, w + 1200, voldo, false, false, false));
        });
        map.put(when, (PotionEffect[]) effects.toArray(new PotionEffect[] {}));
    }
    return map;
}
Also used : Trigger(net.poweredbyhate.wildtp.TeleportGoneWild.Trigger) HashMap(java.util.HashMap) PotionEffect(org.bukkit.potion.PotionEffect) PotionEffectType(org.bukkit.potion.PotionEffectType) HashSet(java.util.HashSet)

Aggregations

HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Trigger (net.poweredbyhate.wildtp.TeleportGoneWild.Trigger)1 PotionEffect (org.bukkit.potion.PotionEffect)1 PotionEffectType (org.bukkit.potion.PotionEffectType)1