diff --git a/src/com/hypixel/hytale/builtin/asseteditor/AssetEditorGamePacketHandler.java b/src/com/hypixel/hytale/builtin/asseteditor/AssetEditorGamePacketHandler.java index a09509d..5a5a61e 100644 --- a/src/com/hypixel/hytale/builtin/asseteditor/AssetEditorGamePacketHandler.java +++ b/src/com/hypixel/hytale/builtin/asseteditor/AssetEditorGamePacketHandler.java @@ -65,22 +65,28 @@ public class AssetEditorGamePacketHandler implements SubPacketHandler { if (ref != null && ref.isValid()) { Store store = ref.getStore(); World world = store.getExternalData().getWorld(); - CompletableFuture.runAsync(() -> { + world.execute( + () -> { Player playerComponent = store.getComponent(ref, Player.getComponentType()); if (!this.lacksPermission(playerComponent, true)) { - ; + CompletableFuture.runAsync( + () -> { + LOGGER.at(Level.INFO).log("%s updating json asset at %s", this.packetHandler.getPlayerRef().getUsername(), packet.path); + EditorClient mockClient = new EditorClient(playerRef); + AssetEditorPlugin.get() + .handleJsonAssetUpdate( + mockClient, + packet.path != null ? new AssetPath(packet.path) : null, + packet.assetType, + packet.assetIndex, + packet.commands, + packet.token + ); + } + ); } - }, world) - .thenRunAsync( - () -> { - LOGGER.at(Level.INFO).log("%s updating json asset at %s", this.packetHandler.getPlayerRef().getUsername(), packet.path); - EditorClient mockClient = new EditorClient(playerRef); - AssetEditorPlugin.get() - .handleJsonAssetUpdate( - mockClient, packet.path != null ? new AssetPath(packet.path) : null, packet.assetType, packet.assetIndex, packet.commands, packet.token - ); - } - ); + } + ); } else { throw new RuntimeException("Unable to process AssetEditorUpdateJsonAsset packet. Player ref is invalid!"); }