Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 1.79 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class Wands {
  2.     public static Wand MAGICAL_WAND;
  3.     public static Wand ANCIENT_WAND;
  4.     public static Wand WAND_OF_FOCUS;
  5.     public static Wand WAND_OF_POWER;
  6.     public static Wand WAND_OF_TIME;
  7.  
  8.     public static void init(ShadowIsland plugin) {
  9.         MAGICAL_WAND = new Wand(plugin, WandType.DEFAULT);
  10.         ANCIENT_WAND = new Wand(plugin, WandType.ANCIENT);
  11.         WAND_OF_FOCUS = new Wand(plugin, WandType.FOCUS);
  12.         WAND_OF_POWER = new Wand(plugin, WandType.POWER);
  13.         WAND_OF_TIME = new Wand(plugin, WandType.TIME);
  14.     }
  15. }
  16. public class Wand extends GenericCustomItem {
  17.     private final ShadowIsland plugin;
  18.     private final WandType type;
  19.  
  20.     public Wand(ShadowIsland plugin, WandType type) {
  21.         super(plugin, type.getReadableName(), getTexture(type));
  22.         this.plugin = plugin;
  23.         this.type = type;
  24.     }
  25.    
  26.     public WandType getType() {
  27.         return type;
  28.     }
  29.  
  30.     private final static String getTexture(WandType type) {
  31.         String base = ShadowIsland.GRAPHICS + "wands" + File.separator;
  32.         switch (type) {
  33.         case ANCIENT:
  34.             return base + "Ancient_Wand.png";
  35.         case TIME:
  36.             return base + "Wand_of_Time.png";
  37.         case POWER:
  38.             return base + "Wand_of_Power.png";
  39.         case FOCUS:
  40.             return base + "Wand_of_Focus.png";
  41.         }
  42.         return base + "Magical_Wand.png";
  43.     }
  44.  
  45. }
  46. public enum WandType {
  47.     DEFAULT("Magic Wand"), FOCUS("Wand of Focus"), POWER("Wand of Power"), TIME(
  48.             "Wand of Time"), ANCIENT("Ancient Wand");
  49.  
  50.     private final String readableName;
  51.  
  52.     private WandType(String readableName) {
  53.         this.readableName = readableName;
  54.     }
  55.  
  56.     public String getReadableName() {
  57.         return readableName;
  58.     }
  59. }