diff options
Diffstat (limited to 'src/main/java/org/bukkit/TreeSpecies.java')
-rw-r--r-- | src/main/java/org/bukkit/TreeSpecies.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/org/bukkit/TreeSpecies.java b/src/main/java/org/bukkit/TreeSpecies.java index cc286731..d01b79f4 100644 --- a/src/main/java/org/bukkit/TreeSpecies.java +++ b/src/main/java/org/bukkit/TreeSpecies.java @@ -1,8 +1,9 @@ package org.bukkit; -import java.util.HashMap; import java.util.Map; +import com.google.common.collect.Maps; + /** * Represents the different species of trees regardless of size. */ @@ -11,21 +12,21 @@ public enum TreeSpecies { /** * Represents the common tree species. */ - GENERIC((byte) 0x0), + GENERIC(0x0), /** * Represents the darker barked/leaved tree species. */ - REDWOOD((byte) 0x1), + REDWOOD(0x1), /** * Represents birches. */ - BIRCH((byte) 0x2); + BIRCH(0x2); private final byte data; - private final static Map<Byte, TreeSpecies> species = new HashMap<Byte, TreeSpecies>(); + private final static Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap(); - private TreeSpecies(final byte data) { - this.data = data; + private TreeSpecies(final int data) { + this.data = (byte) data; } /** @@ -40,18 +41,17 @@ public enum TreeSpecies { /** * Gets the TreeSpecies with the given data value * - * @param data - * Data value to fetch + * @param data Data value to fetch * @return The {@link TreeSpecies} representing the given value, or null if * it doesn't exist */ public static TreeSpecies getByData(final byte data) { - return species.get(data); + return BY_DATA.get(data); } static { - for (TreeSpecies s : TreeSpecies.values()) { - species.put(s.getData(), s); + for (TreeSpecies species : values()) { + BY_DATA.put(species.data, species); } } } |