3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-09-20 06:40:05 +02:00

Lookup by id if the string passed to Block/ItemType.lookup() is an integer

Dieser Commit ist enthalten in:
zml2008 2012-02-04 21:04:20 -08:00
Ursprung 0bea058328
Commit 2f2d3f8045
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -234,8 +234,12 @@ public enum BlockType {
* @return * @return
*/ */
public static BlockType lookup(String name, boolean fuzzy) { public static BlockType lookup(String name, boolean fuzzy) {
try {
return fromID(Integer.parseInt(name));
} catch (NumberFormatException e) {
return StringUtil.lookup(lookup, name, fuzzy); return StringUtil.lookup(lookup, name, fuzzy);
} }
}
/** /**
* Get block numeric ID. * Get block numeric ID.

Datei anzeigen

@ -412,8 +412,12 @@ public enum ItemType {
* @return * @return
*/ */
public static ItemType lookup(String name, boolean fuzzy) { public static ItemType lookup(String name, boolean fuzzy) {
try {
return fromID(Integer.parseInt(name));
} catch (NumberFormatException e) {
return StringUtil.lookup(lookup, name, fuzzy); return StringUtil.lookup(lookup, name, fuzzy);
} }
}
/** /**
* Get item numeric ID. * Get item numeric ID.