Fix jigsaw editor bricking when opening a piece a missing object

This commit is contained in:
Julian Krings
2025-12-18 11:13:43 +01:00
parent 298365f588
commit 98cc82cc3d

View File

@@ -61,14 +61,14 @@ public class JigsawEditor implements Listener {
private Location target; private Location target;
public JigsawEditor(Player player, IrisJigsawPiece piece, IrisObject object, File saveLocation) { public JigsawEditor(Player player, IrisJigsawPiece piece, IrisObject object, File saveLocation) {
if (editors.containsKey(player)) { if (object == null) throw new RuntimeException("Object is null! " + piece.getObject());
editors.get(player).close(); editors.compute(player, ($, current) -> {
if (current != null) {
current.exit();
} }
return this;
});
editors.put(player, this);
if (object == null) {
throw new RuntimeException("Object is null! " + piece.getObject());
}
this.object = object; this.object = object;
this.player = player; this.player = player;
origin = player.getLocation().clone().add(0, 7, 0); origin = player.getLocation().clone().add(0, 7, 0);