Made it so the plugin doesn't crash if the config is messed up

This commit is contained in:
Teriuihi 2022-06-04 05:28:09 +02:00
parent 22f0d184c3
commit 6403f024cd

View File

@ -42,16 +42,23 @@ public class ParticleConfig extends AbstractConfig {
ConfigurationSection cs = particles.getConfigurationSection(key); ConfigurationSection cs = particles.getConfigurationSection(key);
if (cs == null) if (cs == null)
continue; continue;
APartType aPartType = APartType.valueOf(cs.getString("part-type")); APartType aPartType;
ParticleSet particleSet = new ParticleSet( ParticleSet particleSet;
getAParticle(cs), try {
cs.getInt("frame-delay"), aPartType = APartType.valueOf(cs.getString("part-type"));
cs.getInt("repeat"), particleSet = new ParticleSet(
cs.getInt("repeat-delay"), getAParticle(cs),
aPartType, cs.getInt("frame-delay"),
cs.getString("unique-name"), cs.getInt("repeat"),
cs.getString("permission"), cs.getInt("repeat-delay"),
new ItemStack(Material.valueOf(cs.getString("material")))); 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); ParticleStorage.addParticleSet(aPartType, particleSet);
} }
} }