From 2214b7dc3d98a48e622d442cf7e8ea6dcd2efbe0 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 17 Jul 2024 14:03:55 +0200 Subject: [PATCH] Fix ClipboardListener --- .../features/world/ClipboardListener.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java index c9d3887c..90cd94ec 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/world/ClipboardListener.java @@ -36,21 +36,26 @@ public class ClipboardListener implements Listener { @EventHandler public void onLogin(PlayerJoinEvent e) { - if(!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return; + if (!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return; + SchematicNode schematic; try { - SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); - if (schematic != null) { - new SchematicData(schematic).loadToPlayer(e.getPlayer()); - } + schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); + } catch (Exception ex) { + return; + } + if (schematic == null) return; + try { + new SchematicData(schematic).loadToPlayer(e.getPlayer()); } catch (Exception ex) { // ignore cause players do all kind of stuff with schematics.... like massively oversized schems + schematic.delete(); } } @EventHandler public void onLogout(PlayerQuitEvent e) { - if(!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return; + if (!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return; SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null); boolean newSchem = false;