From 6403f024cd92b9a0720cc490a34bcbb5628d359b Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sat, 4 Jun 2022 05:28:09 +0200 Subject: [PATCH] Made it so the plugin doesn't crash if the config is messed up --- .../java/com/alttd/config/ParticleConfig.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/alttd/config/ParticleConfig.java b/src/main/java/com/alttd/config/ParticleConfig.java index 93c11dc..edc8015 100644 --- a/src/main/java/com/alttd/config/ParticleConfig.java +++ b/src/main/java/com/alttd/config/ParticleConfig.java @@ -42,16 +42,23 @@ public class ParticleConfig extends AbstractConfig { ConfigurationSection cs = particles.getConfigurationSection(key); if (cs == null) continue; - APartType aPartType = APartType.valueOf(cs.getString("part-type")); - ParticleSet particleSet = new ParticleSet( - getAParticle(cs), - cs.getInt("frame-delay"), - cs.getInt("repeat"), - cs.getInt("repeat-delay"), - aPartType, - cs.getString("unique-name"), - cs.getString("permission"), - new ItemStack(Material.valueOf(cs.getString("material")))); + APartType aPartType; + ParticleSet particleSet; + try { + aPartType = APartType.valueOf(cs.getString("part-type")); + particleSet = new ParticleSet( + getAParticle(cs), + cs.getInt("frame-delay"), + cs.getInt("repeat"), + cs.getInt("repeat-delay"), + aPartType, + cs.getString("unique-name"), + cs.getString("permission"), + new ItemStack(Material.valueOf(cs.getString("material")))); + } catch (Exception e) {//Im lazy rn sorry + e.printStackTrace(); + continue; + } ParticleStorage.addParticleSet(aPartType, particleSet); } }