Bukkit  1.4.7-R1.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
Art.java
Go to the documentation of this file.
1 package org.bukkit;
2 
3 import java.util.HashMap;
4 
5 import org.apache.commons.lang.Validate;
6 
7 import com.google.common.collect.Maps;
8 
12 public enum Art {
13  KEBAB(0, 1, 1),
14  AZTEC(1, 1, 1),
15  ALBAN(2, 1, 1),
16  AZTEC2(3, 1, 1),
17  BOMB(4, 1, 1),
18  PLANT(5, 1, 1),
19  WASTELAND(6, 1, 1),
20  POOL(7, 2, 1),
21  COURBET(8, 2, 1),
22  SEA(9, 2, 1),
23  SUNSET(10, 2, 1),
24  CREEBET(11, 2, 1),
25  WANDERER(12, 1, 2),
26  GRAHAM(13, 1, 2),
27  MATCH(14, 2, 2),
28  BUST(15, 2, 2),
29  STAGE(16, 2, 2),
30  VOID(17, 2, 2),
31  SKULL_AND_ROSES(18, 2, 2),
32  WITHER(19, 2, 2),
33  FIGHTERS(20, 4, 2),
34  POINTER(21, 4, 4),
35  PIGSCENE(22, 4, 4),
36  BURNINGSKULL(23, 4, 4),
37  SKELETON(24, 4, 3),
38  DONKEYKONG(25, 4, 3);
39 
40  private int id, width, height;
41  private static final HashMap<String, Art> BY_NAME = Maps.newHashMap();
42  private static final HashMap<Integer, Art> BY_ID = Maps.newHashMap();
43 
44  private Art(int id, int width, int height) {
45  this.id = id;
46  this.width = width;
47  this.height = height;
48  }
49 
55  public int getBlockWidth() {
56  return width;
57  }
58 
64  public int getBlockHeight() {
65  return height;
66  }
67 
73  public int getId() {
74  return id;
75  }
76 
83  public static Art getById(int id) {
84  return BY_ID.get(id);
85  }
86 
95  public static Art getByName(String name) {
96  Validate.notNull(name, "Name cannot be null");
97 
98  return BY_NAME.get(name.toLowerCase().replaceAll("_", ""));
99  }
100 
101  static {
102  for (Art art : values()) {
103  BY_ID.put(art.id, art);
104  BY_NAME.put(art.toString().toLowerCase().replaceAll("_", ""), art);
105  }
106  }
107 }