From 0aa6af0f5b36ce099e6c296f8de0c1b854817256 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 2 May 2026 17:34:43 -0700 Subject: [PATCH] fix: skip chest particles that require typed data instead of crashing Particle.DUST is the only particle type for which we can construct the required DustOptions data. Previously, any other particle type fell to particleData = null, and spawnParticle would throw IllegalArgumentException when the configured particle required non-void data (e.g. ITEM, BLOCK, ENTITY_EFFECT). Detect particles with non-void getDataType(), log a warning naming the configured particle, and return early instead of spawning. DUST and particles with Void data still work as before. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../bentobox/aoneblock/listeners/BlockListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java b/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java index d001f39..8cb522c 100644 --- a/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java +++ b/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java @@ -892,7 +892,14 @@ private void fillChest(@NonNull OneBlockObject nextBlock, @NonNull Block block) return; } Color color = addon.getSettings().resolveChestColor(rarity); - Object particleData = Particle.DUST.equals(particle) ? new Particle.DustOptions(color, 1) : null; + Object particleData = null; + if (Particle.DUST.equals(particle)) { + particleData = new Particle.DustOptions(color, 1); + } else if (!Void.class.equals(particle.getDataType())) { + // Particle requires typed data we can't provide — skip rather than crash + addon.logWarning("Chest particle " + particle.name() + " requires extra data and cannot be used. Use DUST or a void-data particle."); + return; + } block.getWorld().spawnParticle(particle, block.getLocation().add(new Vector(0.5, 1.0, 0.5)), 50, 0.5, 0, 0.5, 1, particleData); }