Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.map;
2
3import org.bukkit.World;
4
5import java.util.List;
6
7/**
8 * Represents a map item.
9 */
10public interface MapView {
11
12 /**
13 * An enum representing all possible scales a map can be set to.
14 */
15 public static enum Scale {
16 CLOSEST(0), CLOSE(1), NORMAL(2), FAR(3), FARTHEST(4);
17
18 private byte value;
19
20 private Scale(int value) {
21 this.value = (byte) value;
22 }
23
24 /**
25 * Get the scale given the raw value.
26 */
27 public static Scale valueOf(byte value) {
28 switch (value) {
29 case 0:
30 return CLOSEST;
31 case 1:
32 return CLOSE;
33 case 2:
34 return NORMAL;
35 case 3:
36 return FAR;
37 case 4:
38 return FARTHEST;
39 default:
40 return null;
41 }
42 }
43
44 /**
45 * Get the raw value of this scale level.
46 */
47 public byte getValue() {
48 return value;
49 }
50 }
51
52 /**
53 * Get the ID of this map item. Corresponds to the damage value of a map
54 * in an inventory.
55 *
56 * @return The ID of the map.
57 */
58 public short getId();
59
60 /**
61 * Check whether this map is virtual. A map is virtual if its lowermost
62 * MapRenderer is plugin-provided.
63 *
64 * @return Whether the map is virtual.
65 */
66 public boolean isVirtual();
67
68 /**
69 * Get the scale of this map.
70 *
71 * @return The scale of the map.
72 */
73 public Scale getScale();
74
75 /**
76 * Set the scale of this map.
77 *
78 * @param scale The scale to set.
79 */
80 public void setScale(Scale scale);
81
82 /**
83 * Get the center X position of this map.
84 *
85 * @return The center X position.
86 */
87 public int getCenterX();
88
89 /**
90 * Get the center Z position of this map.
91 *
92 * @return The center Z position.
93 */
94 public int getCenterZ();
95
96 /**
97 * Set the center X position of this map.
98 *
99 * @param x The center X position.
100 */
101 public void setCenterX(int x);
102
103 /**
104 * Set the center Z position of this map.
105 *
106 * @param z The center Z position.
107 */
108 public void setCenterZ(int z);
109
110 /**
111 * Get the world that this map is associated with. Primarily used by the
112 * internal renderer, but may be used by external renderers. May return
113 * null if the world the map is associated with is not loaded.
114 *
115 * @return The World this map is associated with.
116 */
117 public World getWorld();
118
119 /**
120 * Set the world that this map is associated with. The world is used by
121 * the internal renderer, and may also be used by external renderers.
122 *
123 * @param world The World to associate this map with.
124 */
125 public void setWorld(World world);
126
127 /**
128 * Get a list of MapRenderers currently in effect.
129 *
130 * @return A List<MapRenderer> containing each map renderer.
131 */
132 public List<MapRenderer> getRenderers();
133
134 /**
135 * Add a renderer to this map.
136 *
137 * @param renderer The MapRenderer to add.
138 */
139 public void addRenderer(MapRenderer renderer);
140
141 /**
142 * Remove a renderer from this map.
143 *
144 * @param renderer The MapRenderer to remove.
145 * @return True if the renderer was successfully removed.
146 */
147 public boolean removeRenderer(MapRenderer renderer);
148
149}