Skip to content

Commit ed27447

Browse files
committed
Send a useful error on invalid NBT
1 parent 39c6526 commit ed27447

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultItemParser.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ public BaseItem parseFromInput(String input, ParserContext context) throws Input
123123
itemNbtData = itemNbtData.createBuilder().putAll(otherTag.getValue()).build();
124124
}
125125
} catch (IOException e) {
126-
e.printStackTrace();
126+
throw new NoMatchException(TranslatableComponent.of(
127+
"worldedit.error.invalid-nbt",
128+
TextComponent.of(input),
129+
TextComponent.of(e.getMessage())
130+
));
127131
}
128132
}
129133

worldedit-core/src/main/resources/lang/strings.json

+1
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@
372372
"worldedit.error.parser.missing-random-type": "Missing the type after the % symbol for '{0}'",
373373
"worldedit.error.parser.clipboard.missing-coordinates": "Clipboard offset needs x,y,z coordinates.",
374374
"worldedit.error.parser.player-only": "Input '{0}' requires a player!",
375+
"worldedit.error.parser.invalid-nbt": "Invalid NBT Data in input: '{0}'. Error: {1}",
375376
"worldedit.error.disabled": "This functionality is disabled (see WorldEdit configuration).",
376377
"worldedit.error.unknown": "Unknown error occurred: {0}",
377378
"worldedit.error.missing-extent": "No Extent is known",

0 commit comments

Comments
 (0)