mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 18:47:44 +01:00
Prefer Material enum over ItemType lookup when parsing TargetMatchers.
This will make Bukkit's names take priority when trying to identify a block or item, since ItemType lookup will return, e.g. "birch_door_item" for "birch_door", even though there's a block with the name "birch_door". Note that using int ids is always preferable when possible since there's no confusion there. Fixes WORLDGUARD-3790.
This commit is contained in:
parent
e019890f1d
commit
1c29e85f19
@ -53,16 +53,16 @@ private int parseType(String input) throws TargetMatcherParseException {
|
||||
try {
|
||||
return Integer.parseInt(input);
|
||||
} catch (NumberFormatException e) {
|
||||
int id = getItemID(input);
|
||||
if (id > 0) {
|
||||
return id;
|
||||
}
|
||||
|
||||
Material material = Enums.findFuzzyByValue(Material.class, input);
|
||||
if (material != null) {
|
||||
return material.getId();
|
||||
}
|
||||
|
||||
int id = getItemID(input);
|
||||
if (id > 0) {
|
||||
return id;
|
||||
}
|
||||
|
||||
throw new TargetMatcherParseException("Unknown block or item name: " + input);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user