Deprecate magic values

By: Wesley Wolfe <weswolf@aol.com>
This commit is contained in:
Bukkit/Spigot
2013-08-19 13:32:18 -05:00
parent d9f3848e22
commit f9bec6eadd
108 changed files with 1194 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ package org.bukkit.map;
* Represents a cursor on a map.
*/
public final class MapCursor {
private byte x, y;
private byte direction, type;
private boolean visible;
@@ -17,7 +16,9 @@ public final class MapCursor {
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible by default.
* @deprecated Magic value
*/
@Deprecated
public MapCursor(byte x, byte y, byte direction, byte type, boolean visible) {
this.x = x;
this.y = y;
@@ -66,7 +67,9 @@ public final class MapCursor {
* Get the type of this cursor.
*
* @return The type (color/style) of the map cursor.
* @deprecated Magic value
*/
@Deprecated
public byte getRawType() {
return type;
}
@@ -123,7 +126,9 @@ public final class MapCursor {
* Set the type of this cursor.
*
* @param type The type (color/style) of the map cursor.
* @deprecated Magic value
*/
@Deprecated
public void setRawType(byte type) {
if (type < 0 || type > 15) {
throw new IllegalArgumentException("Type must be in the range 0-15");
@@ -158,10 +163,20 @@ public final class MapCursor {
this.value = (byte) value;
}
/**
*
* @deprecated Magic value
*/
@Deprecated
public byte getValue() {
return value;
}
/**
*
* @deprecated Magic value
*/
@Deprecated
public static Type byValue(byte value) {
for (Type t : values()) {
if (t.value == value) return t;

View File

@@ -8,7 +8,6 @@ import java.util.List;
* MapCursorCollection is linked to a specific {@link MapRenderer}.
*/
public final class MapCursorCollection {
private List<MapCursor> cursors = new ArrayList<MapCursor>();
/**
@@ -71,7 +70,9 @@ public final class MapCursorCollection {
* @param direction The facing of the cursor, from 0 to 15.
* @param type The type (color/style) of the map cursor.
* @return The newly added MapCursor.
* @deprecated Magic value
*/
@Deprecated
public MapCursor addCursor(int x, int y, byte direction, byte type) {
return addCursor(x, y, direction, type, true);
}
@@ -85,7 +86,9 @@ public final class MapCursorCollection {
* @param type The type (color/style) of the map cursor.
* @param visible Whether the cursor is visible.
* @return The newly added MapCursor.
* @deprecated Magic value
*/
@Deprecated
public MapCursor addCursor(int x, int y, byte direction, byte type, boolean visible) {
return addCursor(new MapCursor((byte) x, (byte) y, direction, type, visible));
}

View File

@@ -7,6 +7,9 @@ import java.awt.image.BufferedImage;
/**
* Represents the palette that map items use.
* <p>
* These fields are hee base color ranges. Each entry corresponds to four
* colors of varying shades with values entry to entry + 3.
*/
public final class MapPalette {
@@ -48,22 +51,74 @@ public final class MapPalette {
// Interface
/**
* The base color ranges. Each entry corresponds to four colors of varying
* shades with values entry to entry + 3.
* @deprecated Magic value
*/
@Deprecated
public static final byte TRANSPARENT = 0;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte LIGHT_GREEN = 4;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte LIGHT_BROWN = 8;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte GRAY_1 = 12;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte RED = 16;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte PALE_BLUE = 20;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte GRAY_2 = 24;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte DARK_GREEN = 28;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte WHITE = 32;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte LIGHT_GRAY = 36;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte BROWN = 40;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte DARK_GRAY = 44;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte BLUE = 48;
/**
* @deprecated Magic value
*/
@Deprecated
public static final byte DARK_BROWN = 52;
/**
@@ -85,7 +140,9 @@ public final class MapPalette {
*
* @param image The image to convert.
* @return A byte[] containing the pixels of the image.
* @deprecated Magic value
*/
@Deprecated
public static byte[] imageToBytes(Image image) {
BufferedImage temp = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = temp.createGraphics();
@@ -109,7 +166,9 @@ public final class MapPalette {
* @param b The blue component of the color.
* @param g The green component of the color.
* @return The index in the palette.
* @deprecated Magic value
*/
@Deprecated
public static byte matchColor(int r, int g, int b) {
return matchColor(new Color(r, g, b));
}
@@ -119,7 +178,9 @@ public final class MapPalette {
*
* @param color The Color to match.
* @return The index in the palette.
* @deprecated Magic value
*/
@Deprecated
public static byte matchColor(Color color) {
if (color.getAlpha() < 128) return 0;
@@ -142,7 +203,9 @@ public final class MapPalette {
*
* @param index The index in the palette.
* @return The Color of the palette entry.
* @deprecated Magic value
*/
@Deprecated
public static Color getColor(byte index) {
if (index < 0 || index >= colors.length) {
throw new IndexOutOfBoundsException();

View File

@@ -29,7 +29,9 @@ public interface MapView {
*
* @param value The raw scale
* @return The enum scale, or null for an invalid input
* @deprecated Magic value
*/
@Deprecated
public static Scale valueOf(byte value) {
switch (value) {
case 0: return CLOSEST;
@@ -45,7 +47,9 @@ public interface MapView {
* Get the raw value of this scale level.
*
* @return The scale value
* @deprecated Magic value
*/
@Deprecated
public byte getValue() {
return value;
}
@@ -56,7 +60,9 @@ public interface MapView {
* in an inventory.
*
* @return The ID of the map.
* @deprecated Magic value
*/
@Deprecated
public short getId();
/**