Skip to content

Commit

Permalink
Handle exception when block displays are given bad blockdata format
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Mar 26, 2024
1 parent a67b83d commit 65f154d
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2805,10 +2805,14 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
case entity_spec.KEY_DISPLAY_BLOCK:
MCBlockData bd;
Mixed m = specArray.get(index, t);
if(m.isInstanceOf(CArray.TYPE)) {
bd = ObjectGenerator.GetGenerator().blockData((CArray) m, t);
} else {
bd = Static.getServer().createBlockData(m.val());
try {
if(m.isInstanceOf(CArray.TYPE)) {
bd = ObjectGenerator.GetGenerator().blockData((CArray) m, t);
} else {
bd = Static.getServer().createBlockData(m.val().toLowerCase());
}
} catch(IllegalArgumentException ex) {
throw new CREFormatException("Cannot create block data from: " + m.val(), t);
}
bDisplay.setBlockData(bd);
break;
Expand Down

0 comments on commit 65f154d

Please sign in to comment.