Skip to content

Commit

Permalink
add info message when particles can't be used
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercake10 committed Oct 21, 2022
1 parent 8141ad2 commit 2f78b4b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main/java/xyz/spaceio/customoregen/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,30 @@ public void load() {
}
}
this.enableStoneGenerator = plugin.getConfig().getBoolean("enable-stone-generator");
this.enableSoundEffect = plugin.getConfig().getBoolean("enable-sound-effect");
this.enableParticleEffect = plugin.getConfig().getBoolean("enable-particle-effect");
this.enableSoundEffect = plugin.getConfig().getBoolean("enable-sound-effect", false);
this.enableParticleEffect = plugin.getConfig().getBoolean("enable-particle-effect", false);

try {
Class.forName("org.bukkit.block.data.Levelled");
useLevelledClass = true;
} catch( ClassNotFoundException e ) {
useLevelledClass = false;
}

if(enableParticleEffect) {
try {
Class.forName("org.bukkit.Particle");
} catch (ClassNotFoundException e) {
this.plugin.getLogger().info(
String.format("Particle effects are not supported for your bukkit version, disable 'enable-particle-effect' in %s/config.yml to get rid of this message.", this.plugin.getDataFolder().getPath()));
this.enableParticleEffect = false;
}
}

if(enableSoundEffect) {
// disabling sound effects when enum value not present
enableSoundEffect = Arrays.asList(Sound.values()).stream().map(Sound::name).anyMatch(s -> s.equals("BLOCK_FIRE_EXTINGUISH"));

}
}

Expand Down

0 comments on commit 2f78b4b

Please sign in to comment.