Guest User

WEffect.java

a guest
Dec 30th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. package com.gmail.lopezitospriter.Weed;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import org.bukkit.entity.LivingEntity;
  6. import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
  7. import org.bukkit.potion.PotionEffectType;
  8.  
  9. public abstract class WEffect {
  10.     protected int delay;
  11.     protected int duration;
  12.  
  13.     public abstract String getId();
  14.  
  15.     public int getDelay() {
  16.         return delay;
  17.     }
  18.  
  19.     public int getDuration() {
  20.         return duration;
  21.     }
  22.  
  23.     public abstract void apply(LivingEntity entity);
  24.  
  25.     public static boolean isPotion(String id) {
  26.         return id.startsWith("potion_");
  27.     }
  28.  
  29.     public static ArrayList<String> getAvailableEffects() {
  30.         ArrayList<String> e = new ArrayList<String>();
  31.  
  32.         for (PotionEffectType t : PotionEffectType.values())
  33.             if (t != null)
  34.                 e.add("potion_" + t.getName());
  35.         for (DamageCause d : DamageCause.values())
  36.             if (d != null)
  37.                 e.add("damage_" + d.toString());
  38.         return e;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment