mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Improve requireTag exception messages
e15d7993ada7b26784471bdb0e9550228724d900 Co-Authored-By: Octavia Togami <2093023+octylFractal@users.noreply.github.com>
This commit is contained in:
parent
d44cceb1e9
commit
197389bd32
@ -32,12 +32,14 @@ public abstract class NBTSchematicReader implements ClipboardReader {
|
|||||||
|
|
||||||
protected static <T extends Tag> T requireTag(Map<String, Tag> items, String key, Class<T> expected) throws IOException {
|
protected static <T extends Tag> T requireTag(Map<String, Tag> items, String key, Class<T> expected) throws IOException {
|
||||||
if (!items.containsKey(key)) {
|
if (!items.containsKey(key)) {
|
||||||
throw new IOException("Schematic file is missing a \"" + key + "\" tag");
|
throw new IOException("Schematic file is missing a \"" + key + "\" tag of type "
|
||||||
|
+ expected.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag tag = items.get(key);
|
Tag tag = items.get(key);
|
||||||
if (!expected.isInstance(tag)) {
|
if (!expected.isInstance(tag)) {
|
||||||
throw new IOException(key + " tag is not of tag type " + expected.getName());
|
throw new IOException(key + " tag is not of tag type " + expected.getName() + ", got "
|
||||||
|
+ tag.getClass().getName() + " instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
return expected.cast(tag);
|
return expected.cast(tag);
|
||||||
|
Loading…
Reference in New Issue
Block a user