geforkt von Mirrors/FastAsyncWorldEdit
Improved item/block name matching.
Dieser Commit ist enthalten in:
Ursprung
126815fcf5
Commit
f0b2fcc13f
@ -163,4 +163,111 @@ public class StringUtil {
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Find the Levenshtein distance between two Strings.</p>
|
||||
*
|
||||
* <p>This is the number of changes needed to change one String into
|
||||
* another, where each change is a single character modification (deletion,
|
||||
* insertion or substitution).</p>
|
||||
*
|
||||
* <p>The previous implementation of the Levenshtein distance algorithm
|
||||
* was from <a href="http://www.merriampark.com/ld.htm">http://www.merriampark.com/ld.htm</a></p>
|
||||
*
|
||||
* <p>Chas Emerick has written an implementation in Java, which avoids an OutOfMemoryError
|
||||
* which can occur when my Java implementation is used with very large strings.<br>
|
||||
* This implementation of the Levenshtein distance algorithm
|
||||
* is from <a href="http://www.merriampark.com/ldjava.htm">http://www.merriampark.com/ldjava.htm</a></p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.getLevenshteinDistance(null, *) = IllegalArgumentException
|
||||
* StringUtil.getLevenshteinDistance(*, null) = IllegalArgumentException
|
||||
* StringUtil.getLevenshteinDistance("","") = 0
|
||||
* StringUtil.getLevenshteinDistance("","a") = 1
|
||||
* StringUtil.getLevenshteinDistance("aaapppp", "") = 7
|
||||
* StringUtil.getLevenshteinDistance("frog", "fog") = 1
|
||||
* StringUtil.getLevenshteinDistance("fly", "ant") = 3
|
||||
* StringUtil.getLevenshteinDistance("elephant", "hippo") = 7
|
||||
* StringUtil.getLevenshteinDistance("hippo", "elephant") = 7
|
||||
* StringUtil.getLevenshteinDistance("hippo", "zzzzzzzz") = 8
|
||||
* StringUtil.getLevenshteinDistance("hello", "hallo") = 1
|
||||
* </pre>
|
||||
*
|
||||
* @param s the first String, must not be null
|
||||
* @param t the second String, must not be null
|
||||
* @return result distance
|
||||
* @throws IllegalArgumentException if either String input <code>null</code>
|
||||
*/
|
||||
public static int getLevenshteinDistance(String s, String t) {
|
||||
if (s == null || t == null) {
|
||||
throw new IllegalArgumentException("Strings must not be null");
|
||||
}
|
||||
|
||||
/*
|
||||
* The difference between this impl. and the previous is that, rather
|
||||
* than creating and retaining a matrix of size s.length()+1 by
|
||||
* t.length()+1, we maintain two single-dimensional arrays of length
|
||||
* s.length()+1. The first, d, is the 'current working' distance array
|
||||
* that maintains the newest distance cost counts as we iterate through
|
||||
* the characters of String s. Each time we increment the index of
|
||||
* String t we are comparing, d is copied to p, the second int[]. Doing
|
||||
* so allows us to retain the previous cost counts as required by the
|
||||
* algorithm (taking the minimum of the cost count to the left, up one,
|
||||
* and diagonally up and to the left of the current cost count being
|
||||
* calculated). (Note that the arrays aren't really copied anymore, just
|
||||
* switched...this is clearly much better than cloning an array or doing
|
||||
* a System.arraycopy() each time through the outer loop.)
|
||||
*
|
||||
* Effectively, the difference between the two implementations is this
|
||||
* one does not cause an out of memory condition when calculating the LD
|
||||
* over two very large strings.
|
||||
*/
|
||||
|
||||
int n = s.length(); // length of s
|
||||
int m = t.length(); // length of t
|
||||
|
||||
if (n == 0) {
|
||||
return m;
|
||||
} else if (m == 0) {
|
||||
return n;
|
||||
}
|
||||
|
||||
int p[] = new int[n + 1]; // 'previous' cost array, horizontally
|
||||
int d[] = new int[n + 1]; // cost array, horizontally
|
||||
int _d[]; // placeholder to assist in swapping p and d
|
||||
|
||||
// indexes into strings s and t
|
||||
int i; // iterates through s
|
||||
int j; // iterates through t
|
||||
|
||||
char t_j; // jth character of t
|
||||
|
||||
int cost; // cost
|
||||
|
||||
for (i = 0; i <= n; i++) {
|
||||
p[i] = i;
|
||||
}
|
||||
|
||||
for (j = 1; j <= m; j++) {
|
||||
t_j = t.charAt(j - 1);
|
||||
d[0] = j;
|
||||
|
||||
for (i = 1; i <= n; i++) {
|
||||
cost = s.charAt(i - 1) == t_j ? 0 : 1;
|
||||
// minimum of cell to the left+1, to the top+1, diagonally left
|
||||
// and up +cost
|
||||
d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1), p[i - 1]
|
||||
+ cost);
|
||||
}
|
||||
|
||||
// copy current distance counts to 'previous row' distance counts
|
||||
_d = p;
|
||||
p = d;
|
||||
d = _d;
|
||||
}
|
||||
|
||||
// our last action in the above loop was to switch d and p, so p now
|
||||
// actually has the most recent cost counts
|
||||
return p[n];
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ package com.sk89q.worldedit.blocks;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map.Entry;
|
||||
import com.sk89q.util.StringUtil;
|
||||
|
||||
/**
|
||||
* Block types.
|
||||
@ -30,115 +32,98 @@ import java.util.EnumSet;
|
||||
*/
|
||||
public enum BlockType {
|
||||
AIR(0, "Air", "air"),
|
||||
STONE(1, "Stone", new String[] {"stone", "rock"}),
|
||||
STONE(1, "Stone", "stone", "rock"),
|
||||
GRASS(2, "Grass", "grass"),
|
||||
DIRT(3, "Dirt", "dirt"),
|
||||
COBBLESTONE(4, "Cobblestone", new String[] {"cobblestone", "cobble"}),
|
||||
WOOD(5, "Wood", new String[] {"wood", "woodplank", "plank", "woodplanks", "planks"}),
|
||||
SAPLING(6, "Sapling", "sapling"),
|
||||
BEDROCK(7, "Bedrock", new String[] {"adminium", "bedrock"}),
|
||||
WATER(8, "Water", new String[] {"watermoving", "movingwater"}),
|
||||
STATIONARY_WATER(9, "Water (stationary)",
|
||||
new String[] {"water", "waterstationary", "stationarywater", "stillwater"}),
|
||||
LAVA(10, "Lava", new String[] {"lavamoving", "movinglava"}),
|
||||
STATIONARY_LAVA(11, "Lava (stationary)",
|
||||
new String[] {"lava", "lavastationary", "stationarylava", "stilllava"}),
|
||||
COBBLESTONE(4, "Cobblestone", "cobblestone", "cobble"),
|
||||
WOOD(5, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
||||
SAPLING(6, "Sapling", "sapling", "seedling"),
|
||||
BEDROCK(7, "Bedrock", "adminium", "bedrock"),
|
||||
WATER(8, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
||||
STATIONARY_WATER(9, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
||||
LAVA(10, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
||||
STATIONARY_LAVA(11, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
||||
SAND(12, "Sand", "sand"),
|
||||
GRAVEL(13, "Gravel", "gravel"),
|
||||
GOLD_ORE(14, "Gold ore", "goldore"),
|
||||
IRON_ORE(15, "Iron ore", "ironore"),
|
||||
COAL_ORE(16, "Coal ore", "coalore"),
|
||||
LOG(17, "Log", new String[] {"log", "tree", "pine", "oak", "birch", "redwood"}),
|
||||
LEAVES(18, "Leaves", new String[] {"leaves", "leaf"}),
|
||||
LOG(17, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
||||
LEAVES(18, "Leaves", "leaves", "leaf"),
|
||||
SPONGE(19, "Sponge", "sponge"),
|
||||
GLASS(20, "Glass", "glass"),
|
||||
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", new String[] {"lapislazuliore", "blueore", "lapisore"}),
|
||||
LAPIS_LAZULI(22, "Lapis lazuli", new String[] {"lapislazuli", "lapislazuliblock", "bluerock"}),
|
||||
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
||||
LAPIS_LAZULI(22, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
||||
DISPENSER(23, "Dispenser", "dispenser"),
|
||||
SANDSTONE(24, "Sandstone", "sandstone"),
|
||||
NOTE_BLOCK(25, "Note block", new String[] {"musicblock", "noteblock", "note", "music", "instrument"}),
|
||||
NOTE_BLOCK(25, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
||||
BED(26, "Bed", "bed"),
|
||||
POWERED_RAIL(27, "Powered Rail",
|
||||
new String[] {"poweredrail", "boosterrail", "poweredtrack", "boostertrack"}),
|
||||
DETECTOR_RAIL(28, "Detector Rail", "detectorrail"),
|
||||
WEB(30, "Web", new String[] {"web", "spiderweb"}),
|
||||
LONG_GRASS(31, "Long grass", new String[] {"longgrass", "tallgrass"}),
|
||||
DEAD_BUSH(32, "Shrub", new String[] {"deadbush", "shrub", "deadshrub", "tumbleweed"}),
|
||||
CLOTH(35, "Wool", new String[] {"cloth", "wool"}),
|
||||
YELLOW_FLOWER(37, "Yellow flower", new String[] {"yellowflower", "flower"}),
|
||||
RED_FLOWER(38, "Red rose", new String[] {"redflower", "redrose", "rose"}),
|
||||
BROWN_MUSHROOM(39, "Brown mushroom", new String[] {"brownmushroom", "mushroom"}),
|
||||
POWERED_RAIL(27, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
||||
DETECTOR_RAIL(28, "Detector Rail", "detectorrail", "detector"),
|
||||
WEB(30, "Web", "web", "spiderweb"),
|
||||
LONG_GRASS(31, "Long grass", "longgrass", "tallgrass"),
|
||||
DEAD_BUSH(32, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
||||
CLOTH(35, "Wool", "cloth", "wool"),
|
||||
YELLOW_FLOWER(37, "Yellow flower", "yellowflower", "flower"),
|
||||
RED_FLOWER(38, "Red rose", "redflower", "redrose", "rose"),
|
||||
BROWN_MUSHROOM(39, "Brown mushroom", "brownmushroom", "mushroom"),
|
||||
RED_MUSHROOM(40, "Red mushroom", "redmushroom"),
|
||||
GOLD_BLOCK(41, "Gold block", new String[] {"gold", "goldblock"}),
|
||||
IRON_BLOCK(42, "Iron block", new String[] {"iron", "ironblock"}),
|
||||
DOUBLE_STEP(43, "Double step", new String[] {"doubleslab", "doublestoneslab", "doublestep"}),
|
||||
STEP(44, "Step", new String[] {"slab", "stoneslab", "step", "halfstep"}),
|
||||
BRICK(45, "Brick", new String[] {"brick", "brickblock"}),
|
||||
TNT(46, "TNT", "tnt"),
|
||||
BOOKCASE(47, "Bookcase", new String[] {"bookshelf", "bookshelves"}),
|
||||
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)",
|
||||
new String[] {"mossycobblestone", "mossstone", "mossystone",
|
||||
"mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"}),
|
||||
GOLD_BLOCK(41, "Gold block", "gold", "goldblock"),
|
||||
IRON_BLOCK(42, "Iron block", "iron", "ironblock"),
|
||||
DOUBLE_STEP(43, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
||||
STEP(44, "Step", "slab", "stoneslab", "step", "halfstep"),
|
||||
BRICK(45, "Brick", "brick", "brickblock"),
|
||||
TNT(46, "TNT", "tnt", "c4", "explosive"),
|
||||
BOOKCASE(47, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
||||
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
||||
OBSIDIAN(49, "Obsidian", "obsidian"),
|
||||
TORCH(50, "Torch", "torch"),
|
||||
FIRE(51, "Fire", new String[] {"fire", "flame", "flames"}),
|
||||
MOB_SPAWNER(52, "Mob spawner", new String[] {"mobspawner", "spawner"}),
|
||||
WOODEN_STAIRS(53, "Wooden stairs",
|
||||
new String[] {"woodstair", "woodstairs", "woodenstair", "woodenstairs"}),
|
||||
CHEST(54, "Chest", new String[] {"chest", "storage"}),
|
||||
REDSTONE_WIRE(55, "Redstone wire", "redstone"),
|
||||
TORCH(50, "Torch", "torch", "light", "candle"),
|
||||
FIRE(51, "Fire", "fire", "flame", "flames"),
|
||||
MOB_SPAWNER(52, "Mob spawner", "mobspawner", "spawner"),
|
||||
WOODEN_STAIRS(53, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
||||
CHEST(54, "Chest", "chest", "storage", "storagechest"),
|
||||
REDSTONE_WIRE(55, "Redstone wire", "redstone", "redstoneblock"),
|
||||
DIAMOND_ORE(56, "Diamond ore", "diamondore"),
|
||||
DIAMOND_BLOCK(57, "Diamond block", new String[] {"diamond", "diamondblock"}),
|
||||
WORKBENCH(58, "Workbench", new String[] {"workbench", "table", "craftingtable"}),
|
||||
CROPS(59, "Crops", new String[] {"crops", "crop", "plant", "plants"}),
|
||||
SOIL(60, "Soil", new String[] {"soil", "farmland"}),
|
||||
DIAMOND_BLOCK(57, "Diamond block", "diamond", "diamondblock"),
|
||||
WORKBENCH(58, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
||||
CROPS(59, "Crops", "crops", "crop", "plant", "plants"),
|
||||
SOIL(60, "Soil", "soil", "farmland"),
|
||||
FURNACE(61, "Furnace", "furnace"),
|
||||
BURNING_FURNACE(62, "Furnace (burning)", new String[] {"burningfurnace", "litfurnace"}),
|
||||
SIGN_POST(63, "Sign post", new String[] {"sign", "signpost"}),
|
||||
WOODEN_DOOR(64, "Wooden door", new String[] {"wooddoor", "woodendoor", "door"}),
|
||||
BURNING_FURNACE(62, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
||||
SIGN_POST(63, "Sign post", "sign", "signpost"),
|
||||
WOODEN_DOOR(64, "Wooden door", "wooddoor", "woodendoor", "door"),
|
||||
LADDER(65, "Ladder", "ladder"),
|
||||
MINECART_TRACKS(66, "Minecart tracks",
|
||||
new String[] {"track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"}),
|
||||
COBBLESTONE_STAIRS(67, "Cobblestone stairs",
|
||||
new String[] {"cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"}),
|
||||
MINECART_TRACKS(66, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
||||
COBBLESTONE_STAIRS(67, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
||||
WALL_SIGN(68, "Wall sign", "wallsign"),
|
||||
LEVER(69, "Lever", new String[] {"lever", "switch", "stonelever", "stoneswitch"}),
|
||||
STONE_PRESSURE_PLATE(70, "Stone pressure plate",
|
||||
new String[] {"stonepressureplate", "stoneplate"}),
|
||||
LEVER(69, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
||||
STONE_PRESSURE_PLATE(70, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
||||
IRON_DOOR(71, "Iron Door", "irondoor"),
|
||||
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate",
|
||||
new String[] {"woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate"}),
|
||||
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
||||
REDSTONE_ORE(73, "Redstone ore", "redstoneore"),
|
||||
GLOWING_REDSTONE_ORE(74, "Glowing redstone ore", "glowingredstoneore"),
|
||||
REDSTONE_TORCH_OFF(75, "Redstone torch (off)",
|
||||
new String[] {"redstonetorchoff", "rstorchoff"}),
|
||||
REDSTONE_TORCH_ON(76, "Redstone torch (on)",
|
||||
new String [] {"redstonetorch", "redstonetorchon", "rstorchon"}),
|
||||
STONE_BUTTON(77, "Stone Button", new String[] {"stonebutton", "button"}),
|
||||
REDSTONE_TORCH_OFF(75, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
||||
REDSTONE_TORCH_ON(76, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
||||
STONE_BUTTON(77, "Stone Button", "stonebutton", "button"),
|
||||
SNOW(78, "Snow", "snow"),
|
||||
ICE(79, "Ice", "ice"),
|
||||
SNOW_BLOCK(80, "Snow block", "snowblock"),
|
||||
CACTUS(81, "Cactus", new String[] {"cactus", "cacti"}),
|
||||
CACTUS(81, "Cactus", "cactus", "cacti"),
|
||||
CLAY(82, "Clay", "clay"),
|
||||
SUGAR_CANE(83, "Reed", new String[] {"reed", "cane", "sugarcane", "sugarcanes"}),
|
||||
JUKEBOX(84, "Jukebox", new String[] {"jukebox", "stereo", "recordplayer"}),
|
||||
SUGAR_CANE(83, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
||||
JUKEBOX(84, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
||||
FENCE(85, "Fence", "fence"),
|
||||
PUMPKIN(86, "Pumpkin", "pumpkin"),
|
||||
NETHERRACK(87, "Netherrack",
|
||||
new String[] {"redmossycobblestone", "redcobblestone", "redmosstone",
|
||||
"redcobble", "netherstone", "netherrack", "nether", "hellstone"}),
|
||||
SOUL_SAND(88, "Soul sand",
|
||||
new String[] {"slowmud", "mud", "soulsand", "hellmud"}),
|
||||
GLOWSTONE(89, "Glowstone",
|
||||
new String[] {"brittlegold", "glowstone", "lightstone", "brimstone", "australium"}),
|
||||
NETHERRACK(87, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
||||
SOUL_SAND(88, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
||||
GLOWSTONE(89, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
||||
PORTAL(90, "Portal", "portal"),
|
||||
JACK_O_LANTERN(91, "Pumpkin (on)",
|
||||
new String[] {"pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"}),
|
||||
CAKE(92, "Cake", new String[] {"cake", "cakeblock"}),
|
||||
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", new String[] {"diodeoff", "redstonerepeater", "repeater", "delayer"}),
|
||||
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", new String[] {"diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"}),
|
||||
LOCKED_CHEST(95, "Locked chest", new String[] {"lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"}),
|
||||
TRAP_DOOR(96, "Trap door", new String[] {"trapdoor", "hatch"});
|
||||
JACK_O_LANTERN(91, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
||||
CAKE(92, "Cake", "cake", "cakeblock"),
|
||||
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeater", "delayer"),
|
||||
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", "diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
||||
LOCKED_CHEST(95, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
||||
TRAP_DOOR(96, "Trap door", "trapdoor", "hatch", "floordoor");
|
||||
|
||||
/**
|
||||
* Stores a list of dropped blocks for blocks.
|
||||
@ -273,7 +258,7 @@ public enum BlockType {
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
BlockType(int id, String name, String[] lookupKeys) {
|
||||
BlockType(int id, String name, String ... lookupKeys) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.lookupKeys = lookupKeys;
|
||||
@ -296,7 +281,45 @@ public enum BlockType {
|
||||
* @return
|
||||
*/
|
||||
public static BlockType lookup(String name) {
|
||||
return lookup.get(name.toLowerCase());
|
||||
return lookup(name, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type from name. May return null.
|
||||
*
|
||||
* @param name
|
||||
* @param fuzzy
|
||||
* @return
|
||||
*/
|
||||
public static BlockType lookup(String name, boolean fuzzy) {
|
||||
String testName = name.replace(" ", "").toLowerCase();
|
||||
|
||||
BlockType type = lookup.get(testName);
|
||||
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
|
||||
if (!fuzzy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int minDist = -1;
|
||||
|
||||
for (Entry<String, BlockType> entry : lookup.entrySet()) {
|
||||
if (entry.getKey().charAt(0) != testName.charAt(0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int dist = StringUtil.getLevenshteinDistance(entry.getKey(), testName);
|
||||
|
||||
if ((dist < minDist || minDist == -1) && dist < 2) {
|
||||
minDist = dist;
|
||||
type = entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,9 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.blocks;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map.Entry;
|
||||
import com.sk89q.util.StringUtil;
|
||||
|
||||
/**
|
||||
* ItemType types.
|
||||
@ -31,228 +34,205 @@ import java.util.EnumSet;
|
||||
public enum ItemType {
|
||||
// Blocks
|
||||
AIR(0, "Air", "air"),
|
||||
STONE(1, "Stone", new String[] {"stone", "rock"}),
|
||||
STONE(1, "Stone", "stone", "rock"),
|
||||
GRASS(2, "Grass", "grass"),
|
||||
DIRT(3, "Dirt", "dirt"),
|
||||
COBBLESTONE(4, "Cobblestone", new String[] {"cobblestone", "cobble"}),
|
||||
WOOD(5, "Wood", new String[] {"wood", "woodplank", "plank", "woodplanks", "planks"}),
|
||||
SAPLING(6, "Sapling", "sapling"),
|
||||
BEDROCK(7, "Bedrock", new String[] {"adminium", "bedrock"}),
|
||||
WATER(8, "Water", new String[] {"watermoving", "movingwater"}),
|
||||
STATIONARY_WATER(9, "Water (stationary)",
|
||||
new String[] {"water", "waterstationary", "stationarywater", "stillwater"}),
|
||||
LAVA(10, "Lava", new String[] {"lavamoving", "movinglava"}),
|
||||
STATIONARY_LAVA(11, "Lava (stationary)",
|
||||
new String[] {"lava", "lavastationary", "stationarylava", "stilllava"}),
|
||||
COBBLESTONE(4, "Cobblestone", "cobblestone", "cobble"),
|
||||
WOOD(5, "Wood", "wood", "woodplank", "plank", "woodplanks", "planks"),
|
||||
SAPLING(6, "Sapling", "sapling", "seedling"),
|
||||
BEDROCK(7, "Bedrock", "adminium", "bedrock"),
|
||||
WATER(8, "Water", "watermoving", "movingwater", "flowingwater", "waterflowing"),
|
||||
STATIONARY_WATER(9, "Water (stationary)", "water", "waterstationary", "stationarywater", "stillwater"),
|
||||
LAVA(10, "Lava", "lavamoving", "movinglava", "flowinglava", "lavaflowing"),
|
||||
STATIONARY_LAVA(11, "Lava (stationary)", "lava", "lavastationary", "stationarylava", "stilllava"),
|
||||
SAND(12, "Sand", "sand"),
|
||||
GRAVEL(13, "Gravel", "gravel"),
|
||||
GOLD_ORE(14, "Gold ore", "goldore"),
|
||||
IRON_ORE(15, "Iron ore", "ironore"),
|
||||
COAL_ORE(16, "Coal ore", "coalore"),
|
||||
LOG(17, "Log", new String[] {"log", "tree", "pine", "oak", "birch", "redwood"}),
|
||||
LEAVES(18, "Leaves", new String[] {"leaves", "leaf"}),
|
||||
LOG(17, "Log", "log", "tree", "pine", "oak", "birch", "redwood"),
|
||||
LEAVES(18, "Leaves", "leaves", "leaf"),
|
||||
SPONGE(19, "Sponge", "sponge"),
|
||||
GLASS(20, "Glass", "glass"),
|
||||
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", new String[] {"lapislazuliore", "blueore", "lapisore"}),
|
||||
LAPIS_LAZULI(22, "Lapis lazuli", new String[] {"lapislazuli", "lapislazuliblock", "bluerock"}),
|
||||
LAPIS_LAZULI_ORE(21, "Lapis lazuli ore", "lapislazuliore", "blueore", "lapisore"),
|
||||
LAPIS_LAZULI(22, "Lapis lazuli", "lapislazuli", "lapislazuliblock", "bluerock"),
|
||||
DISPENSER(23, "Dispenser", "dispenser"),
|
||||
SANDSTONE(24, "Sandstone", "sandstone"),
|
||||
NOTE_BLOCK(25, "Note block", new String[] {"musicblock", "noteblock", "note", "music", "instrument"}),
|
||||
NOTE_BLOCK(25, "Note block", "musicblock", "noteblock", "note", "music", "instrument"),
|
||||
BED(26, "Bed", "bed"),
|
||||
POWERED_RAIL(27, "Powered Rail",
|
||||
new String[] {"poweredrail", "boosterrail", "poweredtrack", "boostertrack"}),
|
||||
DETECTOR_RAIL(28, "Detector Rail", "detectorrail"),
|
||||
WEB(30, "Web", new String[] {"web", "spiderweb"}),
|
||||
LONG_GRASS(31, "Long grass", new String[] {"longgrass", "tallgrass"}),
|
||||
DEAD_BUSH(32, "Shrub", new String[] {"deadbush", "shrub", "deadshrub", "tumbleweed"}),
|
||||
CLOTH(35, "Wool", new String[] {"cloth", "wool"}),
|
||||
YELLOW_FLOWER(37, "Yellow flower", new String[] {"yellowflower", "flower"}),
|
||||
RED_FLOWER(38, "Red rose", new String[] {"redflower", "redrose", "rose"}),
|
||||
BROWN_MUSHROOM(39, "Brown mushroom", new String[] {"brownmushroom", "mushroom"}),
|
||||
POWERED_RAIL(27, "Powered Rail", "poweredrail", "boosterrail", "poweredtrack", "boostertrack", "booster"),
|
||||
DETECTOR_RAIL(28, "Detector Rail", "detectorrail", "detector"),
|
||||
WEB(30, "Web", "web", "spiderweb"),
|
||||
LONG_GRASS(31, "Long grass", "longgrass", "tallgrass"),
|
||||
DEAD_BUSH(32, "Shrub", "deadbush", "shrub", "deadshrub", "tumbleweed"),
|
||||
CLOTH(35, "Wool", "cloth", "wool"),
|
||||
YELLOW_FLOWER(37, "Yellow flower", "yellowflower", "flower"),
|
||||
RED_FLOWER(38, "Red rose", "redflower", "redrose", "rose"),
|
||||
BROWN_MUSHROOM(39, "Brown mushroom", "brownmushroom", "mushroom"),
|
||||
RED_MUSHROOM(40, "Red mushroom", "redmushroom"),
|
||||
GOLD_BLOCK(41, "Gold block", new String[] {"gold", "goldblock"}),
|
||||
IRON_BLOCK(42, "Iron block", new String[] {"iron", "ironblock"}),
|
||||
DOUBLE_STEP(43, "Double step", new String[] {"doubleslab", "doublestoneslab", "doublestep"}),
|
||||
STEP(44, "Step", new String[] {"slab", "stoneslab", "step", "halfstep"}),
|
||||
BRICK(45, "Brick", new String[] {"brick", "brickblock"}),
|
||||
TNT(46, "TNT", "tnt"),
|
||||
BOOKCASE(47, "Bookcase", new String[] {"bookshelf", "bookshelves"}),
|
||||
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)",
|
||||
new String[] {"mossycobblestone", "mossstone", "mossystone",
|
||||
"mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"}),
|
||||
GOLD_BLOCK(41, "Gold block", "gold", "goldblock"),
|
||||
IRON_BLOCK(42, "Iron block", "iron", "ironblock"),
|
||||
DOUBLE_STEP(43, "Double step", "doubleslab", "doublestoneslab", "doublestep"),
|
||||
STEP(44, "Step", "slab", "stoneslab", "step", "halfstep"),
|
||||
BRICK(45, "Brick", "brick", "brickblock"),
|
||||
TNT(46, "TNT", "tnt", "c4", "explosive"),
|
||||
BOOKCASE(47, "Bookcase", "bookshelf", "bookshelves", "bookcase", "bookcases"),
|
||||
MOSSY_COBBLESTONE(48, "Cobblestone (mossy)", "mossycobblestone", "mossstone", "mossystone", "mosscobble", "mossycobble", "moss", "mossy", "sossymobblecone"),
|
||||
OBSIDIAN(49, "Obsidian", "obsidian"),
|
||||
TORCH(50, "Torch", "torch"),
|
||||
FIRE(51, "Fire", new String[] {"fire", "flame", "flames"}),
|
||||
MOB_SPAWNER(52, "Mob spawner", new String[] {"mobspawner", "spawner"}),
|
||||
WOODEN_STAIRS(53, "Wooden stairs",
|
||||
new String[] {"woodstair", "woodstairs", "woodenstair", "woodenstairs"}),
|
||||
CHEST(54, "Chest", new String[] {"chest", "storage"}),
|
||||
REDSTONE_WIRE(55, "Redstone wire", "redstone"),
|
||||
TORCH(50, "Torch", "torch", "light", "candle"),
|
||||
FIRE(51, "Fire", "fire", "flame", "flames"),
|
||||
MOB_SPAWNER(52, "Mob spawner", "mobspawner", "spawner"),
|
||||
WOODEN_STAIRS(53, "Wooden stairs", "woodstair", "woodstairs", "woodenstair", "woodenstairs"),
|
||||
CHEST(54, "Chest", "chest", "storage", "storagechest"),
|
||||
REDSTONE_WIRE(55, "Redstone wire", "redstone", "redstoneblock"),
|
||||
DIAMOND_ORE(56, "Diamond ore", "diamondore"),
|
||||
DIAMOND_BLOCK(57, "Diamond block", new String[] {"diamond", "diamondblock"}),
|
||||
WORKBENCH(58, "Workbench", new String[] {"workbench", "table", "craftingtable"}),
|
||||
CROPS(59, "Crops", new String[] {"crops", "crop", "plant", "plants"}),
|
||||
SOIL(60, "Soil", new String[] {"soil", "farmland"}),
|
||||
DIAMOND_BLOCK(57, "Diamond block", "diamond", "diamondblock"),
|
||||
WORKBENCH(58, "Workbench", "workbench", "table", "craftingtable", "crafting"),
|
||||
CROPS(59, "Crops", "crops", "crop", "plant", "plants"),
|
||||
SOIL(60, "Soil", "soil", "farmland"),
|
||||
FURNACE(61, "Furnace", "furnace"),
|
||||
BURNING_FURNACE(62, "Furnace (burning)", new String[] {"burningfurnace", "litfurnace"}),
|
||||
SIGN_POST(63, "Sign post", new String[] {"sign", "signpost"}),
|
||||
WOODEN_DOOR(64, "Wooden door", new String[] {"wooddoor", "woodendoor", "door"}),
|
||||
BURNING_FURNACE(62, "Furnace (burning)", "burningfurnace", "litfurnace"),
|
||||
SIGN_POST(63, "Sign post", "sign", "signpost"),
|
||||
WOODEN_DOOR(64, "Wooden door", "wooddoor", "woodendoor", "door"),
|
||||
LADDER(65, "Ladder", "ladder"),
|
||||
MINECART_TRACKS(66, "Minecart tracks",
|
||||
new String[] {"track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"}),
|
||||
COBBLESTONE_STAIRS(67, "Cobblestone stairs",
|
||||
new String[] {"cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"}),
|
||||
MINECART_TRACKS(66, "Minecart tracks", "track", "tracks", "minecrattrack", "minecarttracks", "rails", "rail"),
|
||||
COBBLESTONE_STAIRS(67, "Cobblestone stairs", "cobblestonestair", "cobblestonestairs", "cobblestair", "cobblestairs"),
|
||||
WALL_SIGN(68, "Wall sign", "wallsign"),
|
||||
LEVER(69, "Lever", new String[] {"lever", "switch", "stonelever", "stoneswitch"}),
|
||||
STONE_PRESSURE_PLATE(70, "Stone pressure plate",
|
||||
new String[] {"stonepressureplate", "stoneplate"}),
|
||||
LEVER(69, "Lever", "lever", "switch", "stonelever", "stoneswitch"),
|
||||
STONE_PRESSURE_PLATE(70, "Stone pressure plate", "stonepressureplate", "stoneplate"),
|
||||
IRON_DOOR(71, "Iron Door", "irondoor"),
|
||||
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate",
|
||||
new String[] {"woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate"}),
|
||||
WOODEN_PRESSURE_PLATE(72, "Wooden pressure plate", "woodpressureplate", "woodplate", "woodenpressureplate", "woodenplate", "plate", "pressureplate"),
|
||||
REDSTONE_ORE(73, "Redstone ore", "redstoneore"),
|
||||
GLOWING_REDSTONE_ORE(74, "Glowing redstone ore", "glowingredstoneore"),
|
||||
REDSTONE_TORCH_OFF(75, "Redstone torch (off)",
|
||||
new String[] {"redstonetorchoff", "rstorchoff"}),
|
||||
REDSTONE_TORCH_ON(76, "Redstone torch (on)",
|
||||
new String [] {"redstonetorch", "redstonetorchon", "rstorchon"}),
|
||||
STONE_BUTTON(77, "Stone Button", new String[] {"stonebutton", "button"}),
|
||||
REDSTONE_TORCH_OFF(75, "Redstone torch (off)", "redstonetorchoff", "rstorchoff"),
|
||||
REDSTONE_TORCH_ON(76, "Redstone torch (on)", "redstonetorch", "redstonetorchon", "rstorchon", "redtorch"),
|
||||
STONE_BUTTON(77, "Stone Button", "stonebutton", "button"),
|
||||
SNOW(78, "Snow", "snow"),
|
||||
ICE(79, "Ice", "ice"),
|
||||
SNOW_BLOCK(80, "Snow block", "snowblock"),
|
||||
CACTUS(81, "Cactus", new String[] {"cactus", "cacti"}),
|
||||
CACTUS(81, "Cactus", "cactus", "cacti"),
|
||||
CLAY(82, "Clay", "clay"),
|
||||
SUGAR_CANE(83, "Reed", new String[] {"reed", "cane", "sugarcane", "sugarcanes"}),
|
||||
JUKEBOX(84, "Jukebox", new String[] {"jukebox", "stereo", "recordplayer"}),
|
||||
SUGAR_CANE(83, "Reed", "reed", "cane", "sugarcane", "sugarcanes", "vine", "vines"),
|
||||
JUKEBOX(84, "Jukebox", "jukebox", "stereo", "recordplayer"),
|
||||
FENCE(85, "Fence", "fence"),
|
||||
PUMPKIN(86, "Pumpkin", "pumpkin"),
|
||||
NETHERRACK(87, "Netherrack",
|
||||
new String[] {"redmossycobblestone", "redcobblestone", "redmosstone",
|
||||
"redcobble", "netherstone", "netherrack", "nether", "hellstone"}),
|
||||
SOUL_SAND(88, "Soul sand",
|
||||
new String[] {"slowmud", "mud", "soulsand", "hellmud"}),
|
||||
GLOWSTONE(89, "Glowstone",
|
||||
new String[] {"brittlegold", "glowstone", "lightstone", "brimstone", "australium"}),
|
||||
NETHERRACK(87, "Netherrack", "redmossycobblestone", "redcobblestone", "redmosstone", "redcobble", "netherstone", "netherrack", "nether", "hellstone"),
|
||||
SOUL_SAND(88, "Soul sand", "slowmud", "mud", "soulsand", "hellmud"),
|
||||
GLOWSTONE(89, "Glowstone", "brittlegold", "glowstone", "lightstone", "brimstone", "australium"),
|
||||
PORTAL(90, "Portal", "portal"),
|
||||
JACK_O_LANTERN(91, "Pumpkin (on)",
|
||||
new String[] {"pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"}),
|
||||
CAKE(92, "Cake", new String[] {"cake", "cakeblock"}),
|
||||
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", new String[] {"diodeoff", "redstonerepeater", "repeater", "delayer"}),
|
||||
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", new String[] {"diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"}),
|
||||
LOCKED_CHEST(95, "Locked chest", new String[] {"lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"}),
|
||||
TRAP_DOOR(96, "Trap door", new String[] {"trapdoor", "hatch"}),
|
||||
|
||||
JACK_O_LANTERN(91, "Pumpkin (on)", "pumpkinlighted", "pumpkinon", "litpumpkin", "jackolantern"),
|
||||
CAKE(92, "Cake", "cake", "cakeblock"),
|
||||
REDSTONE_REPEATER_OFF(93, "Redstone repeater (off)", "diodeoff", "redstonerepeater", "repeater", "delayer"),
|
||||
REDSTONE_REPEATER_ON(94, "Redstone repeater (on)", "diode", "diodeon", "redstonerepeateron", "repeateron", "delayeron"),
|
||||
LOCKED_CHEST(95, "Locked chest", "lockedchest", "steveco", "supplycrate", "valveneedstoworkonep3nottf2kthx"),
|
||||
TRAP_DOOR(96, "Trap door", "trapdoor", "hatch", "floordoor"),
|
||||
|
||||
// Items
|
||||
IRON_SHOVEL(256, "Iron shovel", "ironshovel"),
|
||||
IRON_PICK(257, "Iron pick", new String[] {"ironpick", "ironpickaxe"}),
|
||||
IRON_PICK(257, "Iron pick", "ironpick", "ironpickaxe"),
|
||||
IRON_AXE(258, "Iron axe", "ironaxe"),
|
||||
FLINT_AND_TINDER(259, "Flint and tinder",
|
||||
new String[] {"flintandtinder", "lighter", "flintandsteel", "flintsteel",
|
||||
"flintandiron", "flintnsteel", "flintniron", "flintntinder"}),
|
||||
RED_APPLE(260, "Red apple", new String[] {"redapple", "apple"}),
|
||||
FLINT_AND_TINDER(259, "Flint and tinder", "flintandtinder", "lighter", "flintandsteel", "flintsteel", "flintandiron", "flintnsteel", "flintniron", "flintntinder"),
|
||||
RED_APPLE(260, "Red apple", "redapple", "apple"),
|
||||
BOW(261, "Bow", "bow"),
|
||||
ARROW(262, "Arrow", "arrow"),
|
||||
COAL(263, "Coal", "coal"),
|
||||
DIAMOND(264, "Diamond", "diamond"),
|
||||
IRON_BAR(265, "Iron bar", "ironbar"),
|
||||
GOLD_BAR(266, "Gold bar", "goldbar"),
|
||||
IRON_BAR(265, "Iron bar", "ironbar", "iron"),
|
||||
GOLD_BAR(266, "Gold bar", "goldbar", "gold"),
|
||||
IRON_SWORD(267, "Iron sword", "ironsword"),
|
||||
WOOD_SWORD(268, "Wooden sword", "woodsword"),
|
||||
WOOD_SHOVEL(269, "Wooden shovel", "woodshovel"),
|
||||
WOOD_PICKAXE(270, "Wooden pickaxe", new String[] {"woodpick", "woodpickaxe"}),
|
||||
WOOD_PICKAXE(270, "Wooden pickaxe", "woodpick", "woodpickaxe"),
|
||||
WOOD_AXE(271, "Wooden axe", "woodaxe"),
|
||||
STONE_SWORD(272, "Stone sword", "stonesword"),
|
||||
STONE_SHOVEL(273, "Stone shovel", "stoneshovel"),
|
||||
STONE_PICKAXE(274, "Stone pickaxe", new String[] {"stonepick", "stonepickaxe"}),
|
||||
STONE_PICKAXE(274, "Stone pickaxe", "stonepick", "stonepickaxe"),
|
||||
STONE_AXE(275, "Stone pickaxe", "stoneaxe"),
|
||||
DIAMOND_SWORD(276, "Diamond sword", "diamondsword"),
|
||||
DIAMOND_SHOVEL(277, "Diamond shovel", "diamondshovel"),
|
||||
DIAMOND_PICKAXE(278, "Diamond pickaxe", new String[] {"diamondpick", "diamondpickaxe"}),
|
||||
DIAMOND_PICKAXE(278, "Diamond pickaxe", "diamondpick", "diamondpickaxe"),
|
||||
DIAMOND_AXE(279, "Diamond axe", "diamondaxe"),
|
||||
STICK(280, "Stick", "stick"),
|
||||
BOWL(281, "Bowl", "bowl"),
|
||||
MUSHROOM_SOUP(282, "Mushroom soup", new String[] {"mushroomsoup", "soup", "brbsoup"}),
|
||||
MUSHROOM_SOUP(282, "Mushroom soup", "mushroomsoup", "soup", "brbsoup"),
|
||||
GOLD_SWORD(283, "Golden sword", "goldsword"),
|
||||
GOLD_SHOVEL(284, "Golden shovel", "goldshovel"),
|
||||
GOLD_PICKAXE(285, "Golden pickaxe", new String[] {"goldpick", "goldpickaxe"}),
|
||||
GOLD_PICKAXE(285, "Golden pickaxe", "goldpick", "goldpickaxe"),
|
||||
GOLD_AXE(286, "Golden axe", "goldaxe"),
|
||||
STRING(287, "String", "string"),
|
||||
FEATHER(288, "Feather", "feather"),
|
||||
SULPHUR(289, "Sulphur", new String[] {"sulphur", "sulfur", "gunpowder"}),
|
||||
SULPHUR(289, "Sulphur", "sulphur", "sulfur", "gunpowder"),
|
||||
WOOD_HOE(290, "Wooden hoe", "woodhoe"),
|
||||
STONE_HOE(291, "Stone hoe", "stonehoe"),
|
||||
IRON_HOE(292, "Iron hoe", "ironhoe"),
|
||||
DIAMOND_HOE(293, "Diamond hoe", "diamondhoe"),
|
||||
GOLD_HOE(294, "Golden hoe", "goldhoe"),
|
||||
SEEDS(295, "Seeds", new String[] {"seeds", "seed"}),
|
||||
SEEDS(295, "Seeds", "seeds", "seed"),
|
||||
WHEAT(296, "Wheat", "wheat"),
|
||||
BREAD(297, "Bread", "bread"),
|
||||
LEATHER_HELMET(298, "Leather helmet", "leatherhelmet"),
|
||||
LEATHER_CHEST(299, "Leather chestplate", "leatherchest"),
|
||||
LEATHER_PANTS(300, "Leather pants", "leatherpants"),
|
||||
LEATHER_BOOTS(301, "Leather boots", "leatherboots"),
|
||||
CHAINMAIL_HELMET(302, "Chainmail helmet", "chainmailhelmet"),
|
||||
CHAINMAIL_CHEST(303, "Chainmail chestplate", "chainmailchest"),
|
||||
CHAINMAIL_PANTS(304, "Chainmail pants", "chainmailpants"),
|
||||
CHAINMAIL_BOOTS(305, "Chainmail boots", "chainmailboots"),
|
||||
IRON_HELMET(306, "Iron helmet", "ironhelmet"),
|
||||
IRON_CHEST(307, "Iron chestplate", "ironchest"),
|
||||
IRON_PANTS(308, "Iron pants", "ironpants"),
|
||||
IRON_BOOTS(309, "Iron boots", "ironboots"),
|
||||
DIAMOND_HELMET(310, "Diamond helmet", "diamondhelmet"),
|
||||
DIAMOND_CHEST(311, "Diamond chestplate", "diamondchest"),
|
||||
DIAMOND_PANTS(312, "Diamond pants", "diamondpants"),
|
||||
DIAMOND_BOOTS(313, "Diamond boots", "diamondboots"),
|
||||
GOLD_HELMET(314, "Gold helmet", "goldhelmet"),
|
||||
GOLD_CHEST(315, "Gold chestplate", "goldchest"),
|
||||
GOLD_PANTS(316, "Gold pants", "goldpants"),
|
||||
GOLD_BOOTS(317, "Gold boots", "goldboots"),
|
||||
LEATHER_HELMET(298, "Leather helmet", "leatherhelmet", "leatherhat"),
|
||||
LEATHER_CHEST(299, "Leather chestplate", "leatherchest", "leatherchestplate", "leathervest", "leatherbreastplate", "leatherplate", "leathercplate", "leatherbody"),
|
||||
LEATHER_PANTS(300, "Leather pants", "leatherpants", "leathergreaves", "leatherlegs", "leatherleggings", "leatherstockings", "leatherbreeches"),
|
||||
LEATHER_BOOTS(301, "Leather boots", "leatherboots", "leathershoes", "leatherfoot", "leatherfeet"),
|
||||
CHAINMAIL_HELMET(302, "Chainmail helmet", "chainmailhelmet", "chainmailhat"),
|
||||
CHAINMAIL_CHEST(303, "Chainmail chestplate", "chainmailchest", "chainmailchestplate", "chainmailvest", "chainmailbreastplate", "chainmailplate", "chainmailcplate", "chainmailbody"),
|
||||
CHAINMAIL_PANTS(304, "Chainmail pants", "chainmailpants", "chainmailgreaves", "chainmaillegs", "chainmailleggings", "chainmailstockings", "chainmailbreeches"),
|
||||
CHAINMAIL_BOOTS(305, "Chainmail boots", "chainmailboots", "chainmailshoes", "chainmailfoot", "chainmailfeet"),
|
||||
IRON_HELMET(306, "Iron helmet", "ironhelmet", "ironhat"),
|
||||
IRON_CHEST(307, "Iron chestplate", "ironchest", "ironchestplate", "ironvest", "ironbreastplate", "ironplate", "ironcplate", "ironbody"),
|
||||
IRON_PANTS(308, "Iron pants", "ironpants", "irongreaves", "ironlegs", "ironleggings", "ironstockings", "ironbreeches"),
|
||||
IRON_BOOTS(309, "Iron boots", "ironboots", "ironshoes", "ironfoot", "ironfeet"),
|
||||
DIAMOND_HELMET(310, "Diamond helmet", "diamondhelmet", "diamondhat"),
|
||||
DIAMOND_CHEST(311, "Diamond chestplate", "diamondchest", "diamondchestplate", "diamondvest", "diamondbreastplate", "diamondplate", "diamondcplate", "diamondbody"),
|
||||
DIAMOND_PANTS(312, "Diamond pants", "diamondpants", "diamondgreaves", "diamondlegs", "diamondleggings", "diamondstockings", "diamondbreeches"),
|
||||
DIAMOND_BOOTS(313, "Diamond boots", "diamondboots", "diamondshoes", "diamondfoot", "diamondfeet"),
|
||||
GOLD_HELMET(314, "Gold helmet", "goldhelmet", "goldhat"),
|
||||
GOLD_CHEST(315, "Gold chestplate", "goldchest", "goldchestplate", "goldvest", "goldbreastplate", "goldplate", "goldcplate", "goldbody"),
|
||||
GOLD_PANTS(316, "Gold pants", "goldpants", "goldgreaves", "goldlegs", "goldleggings", "goldstockings", "goldbreeches"),
|
||||
GOLD_BOOTS(317, "Gold boots", "goldboots", "goldshoes", "goldfoot", "goldfeet"),
|
||||
FLINT(318, "Flint", "flint"),
|
||||
RAW_PORKCHOP(319, "Raw porkchop",
|
||||
new String[] {"rawpork", "rawporkchop", "rawbacon", "baconstrips", "rawmeat"}),
|
||||
COOKED_PORKCHOP(320, "Cooked porkchop",
|
||||
new String[] {"pork", "cookedpork", "cookedporkchop", "cookedbacon", "bacon", "meat"}),
|
||||
RAW_PORKCHOP(319, "Raw porkchop", "rawpork", "rawporkchop", "rawbacon", "baconstrips", "rawmeat"),
|
||||
COOKED_PORKCHOP(320, "Cooked porkchop", "pork", "cookedpork", "cookedporkchop", "cookedbacon", "bacon", "meat"),
|
||||
PAINTING(321, "Painting", "painting"),
|
||||
GOLD_APPLE(322, "Golden apple", new String[] {"goldapple", "goldenapple"}),
|
||||
GOLD_APPLE(322, "Golden apple", "goldapple", "goldenapple"),
|
||||
SIGN(323, "Wooden sign", "sign"),
|
||||
WOODEN_DOOR_ITEM(324, "Wooden door", new String[] {"wooddoor", "door"}),
|
||||
BUCKET(325, "Bucket", new String[] {"bucket", "bukkit"}),
|
||||
WATER_BUCKET(326, "Water bucket", new String[] {"waterbucket", "waterbukkit"}),
|
||||
LAVA_BUCKET(327, "Lava bucket", new String[] {"lavabucket", "lavabukkit"}),
|
||||
MINECART(328, "Minecart", new String[] {"minecart", "cart"}),
|
||||
WOODEN_DOOR_ITEM(324, "Wooden door", "wooddoor", "door"),
|
||||
BUCKET(325, "Bucket", "bucket", "bukkit"),
|
||||
WATER_BUCKET(326, "Water bucket", "waterbucket", "waterbukkit"),
|
||||
LAVA_BUCKET(327, "Lava bucket", "lavabucket", "lavabukkit"),
|
||||
MINECART(328, "Minecart", "minecart", "cart"),
|
||||
SADDLE(329, "Saddle", "saddle"),
|
||||
IRON_DOOR_ITEM(330, "Iron door", "irondoor"),
|
||||
REDSTONE_DUST(331, "Redstone dust", new String[] {"redstonedust", "reddust"}),
|
||||
REDSTONE_DUST(331, "Redstone dust", "redstonedust", "reddust", "redstone", "dust", "wire"),
|
||||
SNOWBALL(332, "Snowball", "snowball"),
|
||||
WOOD_BOAT(333, "Wooden boat", new String[] {"woodboat", "woodenboat", "boat"}),
|
||||
LEATHER(334, "Leather", new String[] {"leather", "cowhide"}),
|
||||
MILK_BUCKET(335, "Milk bucket", new String[] {"milkbucket", "milk", "milkbukkit"}),
|
||||
WOOD_BOAT(333, "Wooden boat", "woodboat", "woodenboat", "boat"),
|
||||
LEATHER(334, "Leather", "leather", "cowhide"),
|
||||
MILK_BUCKET(335, "Milk bucket", "milkbucket", "milk", "milkbukkit"),
|
||||
BRICK_BAR(336, "Brick", "brick"),
|
||||
CLAY_BALL(337, "Clay", "clay"),
|
||||
SUGAR_CANE_ITEM(338, "Sugar cane", new String[] {"sugarcane", "reed", "reeds"}),
|
||||
SUGAR_CANE_ITEM(338, "Sugar cane", "sugarcane", "reed", "reeds"),
|
||||
PAPER(339, "Paper", "paper"),
|
||||
BOOK(340, "Book", "book"),
|
||||
SLIME_BALL(341, "Slime ball", new String[] {"slimeball", "slime"}),
|
||||
STORAGE_MINECART(342, "Storage minecart", new String[] {"storageminecart", "storagecart"}),
|
||||
POWERED_MINECART(343, "Powered minecart", new String[] {"poweredminecart", "poweredcart"}),
|
||||
SLIME_BALL(341, "Slime ball", "slimeball", "slime"),
|
||||
STORAGE_MINECART(342, "Storage minecart", "storageminecart", "storagecart"),
|
||||
POWERED_MINECART(343, "Powered minecart", "poweredminecart", "poweredcart"),
|
||||
EGG(344, "Egg", "egg"),
|
||||
COMPASS(345, "Compass", "compass"),
|
||||
FISHING_ROD(346, "Fishing rod", new String[] {"fishingrod", "fishingpole"}),
|
||||
WATCH(347, "Watch", new String[] {"watch", "clock", "timer" }),
|
||||
LIGHTSTONE_DUST(348, "Glowstone dust", new String[] {
|
||||
"lightstonedust", "glowstonedone", "brightstonedust",
|
||||
"brittlegolddust", "brimstonedust"}),
|
||||
RAW_FISH(349, "Raw fish", new String[] {"rawfish", "fish"}),
|
||||
FISHING_ROD(346, "Fishing rod", "fishingrod", "fishingpole"),
|
||||
WATCH(347, "Watch", "watch", "clock", "timer"),
|
||||
LIGHTSTONE_DUST(348, "Glowstone dust", "lightstonedust", "glowstonedone", "brightstonedust", "brittlegolddust", "brimstonedust"),
|
||||
RAW_FISH(349, "Raw fish", "rawfish", "fish"),
|
||||
COOKED_FISH(350, "Cooked fish", "cookedfish"),
|
||||
INK_SACK(351, "Ink sac", new String[] {"inksac", "ink", "dye", "inksack"}),
|
||||
INK_SACK(351, "Ink sac", "inksac", "ink", "dye", "inksack"),
|
||||
BONE(352, "Bone", "bone"),
|
||||
SUGAR(353, "Sugar", "sugar"),
|
||||
CAKE_ITEM(354, "Cake", "cake"),
|
||||
BED_ITEM(355, "Bed", "bed"),
|
||||
REDSTONE_REPEATER(356, "Redstone repeater", new String[] {"redstonerepeater", "diode", "delayer"}),
|
||||
REDSTONE_REPEATER(356, "Redstone repeater", "redstonerepeater", "diode", "delayer", "repeater"),
|
||||
COOKIE(357, "Cookie", "cookie"),
|
||||
MAP(358, "Map", "map"),
|
||||
GOLD_RECORD(2256, "Gold Record", new String[] {"goldrecord", "golddisc"}),
|
||||
GREEN_RECORD(2257, "Green Record", new String[] {"greenrecord", "greenddisc"});
|
||||
GOLD_RECORD(2256, "Gold Record", "goldrecord", "golddisc"),
|
||||
GREEN_RECORD(2257, "Green Record", "greenrecord", "greenddisc");
|
||||
|
||||
/**
|
||||
* Stores a map of the IDs for fast access.
|
||||
@ -261,7 +241,7 @@ public enum ItemType {
|
||||
/**
|
||||
* Stores a map of the names for fast access.
|
||||
*/
|
||||
private static final Map<String,ItemType> lookup = new HashMap<String,ItemType>();
|
||||
private static final Map<String,ItemType> lookup = new LinkedHashMap<String,ItemType>();
|
||||
|
||||
private final int id;
|
||||
private final String name;
|
||||
@ -295,7 +275,7 @@ public enum ItemType {
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
ItemType(int id, String name, String[] lookupKeys) {
|
||||
ItemType(int id, String name, String ... lookupKeys) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.lookupKeys = lookupKeys;
|
||||
@ -351,7 +331,45 @@ public enum ItemType {
|
||||
* @return
|
||||
*/
|
||||
public static ItemType lookup(String name) {
|
||||
return lookup.get(name.toLowerCase());
|
||||
return lookup(name, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type from name. May return null.
|
||||
*
|
||||
* @param name
|
||||
* @param fuzzy
|
||||
* @return
|
||||
*/
|
||||
public static ItemType lookup(String name, boolean fuzzy) {
|
||||
String testName = name.replace(" ", "").toLowerCase();
|
||||
|
||||
ItemType type = lookup.get(testName);
|
||||
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
|
||||
if (!fuzzy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int minDist = -1;
|
||||
|
||||
for (Entry<String, ItemType> entry : lookup.entrySet()) {
|
||||
if (entry.getKey().charAt(0) != testName.charAt(0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int dist = StringUtil.getLevenshteinDistance(entry.getKey(), testName);
|
||||
|
||||
if ((dist < minDist || minDist == -1) && dist < 2) {
|
||||
minDist = dist;
|
||||
type = entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren