geforkt von Mirrors/FastAsyncWorldEdit
Improve requireTag exception messages
e15d7993ada7b26784471bdb0e9550228724d900 Co-Authored-By: Octavia Togami <2093023+octylFractal@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
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 {
|
||||
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);
|
||||
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);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren