Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Art.java
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 
9 /**
10  * Represents the art on a painting
11  */
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 
50  /**
51  * Gets the width of the painting, in blocks
52  *
53  * @return The width of the painting, in blocks
54  */
55  public int getBlockWidth() {
56  return width;
57  }
58 
59  /**
60  * Gets the height of the painting, in blocks
61  *
62  * @return The height of the painting, in blocks
63  */
64  public int getBlockHeight() {
65  return height;
66  }
67 
68  /**
69  * Get the ID of this painting.
70  *
71  * @return The ID of this painting
72  * @deprecated Magic value
73  */
74  @Deprecated
75  public int getId() {
76  return id;
77  }
78 
79  /**
80  * Get a painting by its numeric ID
81  *
82  * @param id The ID
83  * @return The painting
84  * @deprecated Magic value
85  */
86  @Deprecated
87  public static Art getById(int id) {
88  return BY_ID.get(id);
89  }
90 
91  /**
92  * Get a painting by its unique name
93  * <p>
94  * This ignores underscores and capitalization
95  *
96  * @param name The name
97  * @return The painting
98  */
99  public static Art getByName(String name) {
100  Validate.notNull(name, "Name cannot be null");
101 
102  return BY_NAME.get(name.toLowerCase().replaceAll("_", ""));
103  }
104 
105  static {
106  for (Art art : values()) {
107  BY_ID.put(art.id, art);
108  BY_NAME.put(art.toString().toLowerCase().replaceAll("_", ""), art);
109  }
110  }
111 }
int getId()
Definition: Art.java:75
int getBlockWidth()
Definition: Art.java:55
static Art getByName(String name)
Definition: Art.java:99
int getBlockHeight()
Definition: Art.java:64
static Art getById(int id)
Definition: Art.java:87