001 package org.bukkit.map; 002 003 import java.util.List; 004 import org.bukkit.World; 005 006 /** 007 * Represents a map item. 008 */ 009 public interface MapView { 010 011 /** 012 * An enum representing all possible scales a map can be set to. 013 */ 014 public static enum Scale { 015 CLOSEST(0), 016 CLOSE(1), 017 NORMAL(2), 018 FAR(3), 019 FARTHEST(4); 020 021 private byte value; 022 023 private Scale(int value) { 024 this.value = (byte) value; 025 } 026 027 /** 028 * Get the scale given the raw value. 029 * 030 * @param value The raw scale 031 * @return The enum scale, or null for an invalid input 032 * @deprecated Magic value 033 */ 034 @Deprecated 035 public static Scale valueOf(byte value) { 036 switch (value) { 037 case 0: return CLOSEST; 038 case 1: return CLOSE; 039 case 2: return NORMAL; 040 case 3: return FAR; 041 case 4: return FARTHEST; 042 default: return null; 043 } 044 } 045 046 /** 047 * Get the raw value of this scale level. 048 * 049 * @return The scale value 050 * @deprecated Magic value 051 */ 052 @Deprecated 053 public byte getValue() { 054 return value; 055 } 056 } 057 058 /** 059 * Get the ID of this map item. Corresponds to the damage value of a map 060 * in an inventory. 061 * 062 * @return The ID of the map. 063 * @deprecated Magic value 064 */ 065 @Deprecated 066 public short getId(); 067 068 /** 069 * Check whether this map is virtual. A map is virtual if its lowermost 070 * MapRenderer is plugin-provided. 071 * 072 * @return Whether the map is virtual. 073 */ 074 public boolean isVirtual(); 075 076 /** 077 * Get the scale of this map. 078 * 079 * @return The scale of the map. 080 */ 081 public Scale getScale(); 082 083 /** 084 * Set the scale of this map. 085 * 086 * @param scale The scale to set. 087 */ 088 public void setScale(Scale scale); 089 090 /** 091 * Get the center X position of this map. 092 * 093 * @return The center X position. 094 */ 095 public int getCenterX(); 096 097 /** 098 * Get the center Z position of this map. 099 * 100 * @return The center Z position. 101 */ 102 public int getCenterZ(); 103 104 /** 105 * Set the center X position of this map. 106 * 107 * @param x The center X position. 108 */ 109 public void setCenterX(int x); 110 111 /** 112 * Set the center Z position of this map. 113 * 114 * @param z The center Z position. 115 */ 116 public void setCenterZ(int z); 117 118 /** 119 * Get the world that this map is associated with. Primarily used by the 120 * internal renderer, but may be used by external renderers. May return 121 * null if the world the map is associated with is not loaded. 122 * 123 * @return The World this map is associated with. 124 */ 125 public World getWorld(); 126 127 /** 128 * Set the world that this map is associated with. The world is used by 129 * the internal renderer, and may also be used by external renderers. 130 * 131 * @param world The World to associate this map with. 132 */ 133 public void setWorld(World world); 134 135 /** 136 * Get a list of MapRenderers currently in effect. 137 * 138 * @return A List<MapRenderer> containing each map renderer. 139 */ 140 public List<MapRenderer> getRenderers(); 141 142 /** 143 * Add a renderer to this map. 144 * 145 * @param renderer The MapRenderer to add. 146 */ 147 public void addRenderer(MapRenderer renderer); 148 149 /** 150 * Remove a renderer from this map. 151 * 152 * @param renderer The MapRenderer to remove. 153 * @return True if the renderer was successfully removed. 154 */ 155 public boolean removeRenderer(MapRenderer renderer); 156 157 }