2011-01-26 20:28:08 +00:00
|
|
|
/*
|
2014-04-04 22:03:18 +00:00
|
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
|
|
* Copyright (C) WorldEdit team and contributors
|
2011-01-26 20:28:08 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
2011-01-26 20:28:08 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
2011-01-26 20:28:08 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2011-01-26 20:28:08 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-04 22:03:18 +00:00
|
|
|
*/
|
2011-01-26 20:28:08 +00:00
|
|
|
|
|
|
|
package com.sk89q.worldedit.blocks;
|
|
|
|
|
|
|
|
import java.util.EnumSet;
|
2018-07-30 13:26:06 +00:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
2011-01-26 20:28:08 +00:00
|
|
|
|
|
|
|
/**
|
2014-07-26 07:28:19 +00:00
|
|
|
* The colors for wool.
|
2011-01-26 20:28:08 +00:00
|
|
|
*
|
2014-07-26 07:28:19 +00:00
|
|
|
* <p>This class may be removed in the future.</p>
|
2011-01-26 20:28:08 +00:00
|
|
|
*/
|
|
|
|
public enum ClothColor {
|
2014-07-26 07:28:19 +00:00
|
|
|
|
2018-07-01 12:03:22 +00:00
|
|
|
WHITE("White", "white"),
|
|
|
|
ORANGE("Orange", "orange"),
|
|
|
|
MAGENTA("Magenta", "magenta"),
|
|
|
|
LIGHT_BLUE("Light blue", "lightblue"),
|
|
|
|
YELLOW("Yellow", "yellow"),
|
|
|
|
LIGHT_GREEN("Light green", "lightgreen"),
|
|
|
|
PINK("Pink", "pink", "lightred"),
|
|
|
|
GRAY("Gray", "grey", "gray"),
|
|
|
|
LIGHT_GRAY("Light gray", "lightgrey", "lightgray"),
|
|
|
|
CYAN("Cyan", "cyan", "turquoise"),
|
|
|
|
PURPLE("Purple", "purple", "violet"),
|
|
|
|
BLUE("Blue", "blue"),
|
|
|
|
BROWN("Brown", "brown", "cocoa", "coffee"),
|
|
|
|
DARK_GREEN("Dark green", "green", "darkgreen", "cactusgreen", "cactigreen"),
|
|
|
|
RED("Red", "red"),
|
|
|
|
BLACK("Black", "black");
|
2011-01-26 20:28:08 +00:00
|
|
|
/**
|
|
|
|
* Stores a map of the names for fast access.
|
|
|
|
*/
|
2018-06-16 06:36:55 +00:00
|
|
|
private static final Map<String, ClothColor> lookup = new HashMap<>();
|
2011-01-26 20:28:08 +00:00
|
|
|
|
|
|
|
private final String name;
|
|
|
|
private final String[] lookupKeys;
|
|
|
|
|
|
|
|
static {
|
|
|
|
for (ClothColor type : EnumSet.allOf(ClothColor.class)) {
|
|
|
|
for (String key : type.lookupKeys) {
|
|
|
|
lookup.put(key, type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct the type.
|
|
|
|
*
|
2014-07-26 07:28:19 +00:00
|
|
|
* @param name the name of the color
|
2018-07-01 12:03:22 +00:00
|
|
|
* @param lookupKeys a name to refer to the color by
|
2011-01-26 20:28:08 +00:00
|
|
|
*/
|
2018-07-01 12:03:22 +00:00
|
|
|
ClothColor(String name, String ... lookupKeys) {
|
2011-01-26 20:28:08 +00:00
|
|
|
this.name = name;
|
|
|
|
this.lookupKeys = lookupKeys;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return type from name. May return null.
|
|
|
|
*
|
2014-07-26 07:28:19 +00:00
|
|
|
* @param name the name of the color
|
|
|
|
* @return a color or null
|
2011-01-26 20:28:08 +00:00
|
|
|
*/
|
2014-07-26 07:28:19 +00:00
|
|
|
@Nullable
|
2011-01-26 20:28:08 +00:00
|
|
|
public static ClothColor lookup(String name) {
|
|
|
|
return lookup.get(name.toLowerCase());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get user-friendly item name.
|
|
|
|
*
|
2014-07-26 07:28:19 +00:00
|
|
|
* @return the name
|
2011-01-26 20:28:08 +00:00
|
|
|
*/
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
2014-07-26 07:28:19 +00:00
|
|
|
|
2011-11-23 01:29:48 +00:00
|
|
|
}
|