diff --git a/Changelog.txt b/Changelog.txt index 76a15f3c8..235401a73 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -9,6 +9,7 @@ Key: Version 1.4.05-dev + Added option to allow refreshing of chunks after block-breaking abilities. (Disabled by default) + + Added fireworks effects when a player levels-up, for every 50 levels (configurable) = Fixed bug where /addxp was setting instead of adding experience = Fixed bug where /addxp was not processessing level-ups for online players = Fixed bug which allowed players to share experience with nearby dead players diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 889179d32..767779b12 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -115,7 +115,8 @@ public class Config extends AutoUpdateConfigLoader { public boolean getDodgeEffectEnabled() { return config.getBoolean("Particles.Dodge", true); } public boolean getBleedEffectEnabled() { return config.getBoolean("Particles.Bleed", true); } public boolean getGreaterImpactEffectEnabled() { return config.getBoolean("Particles.Greater_Impact", true); } - public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp", true); } + public boolean getLevelUpEffectsEnabled() { return config.getBoolean("Particles.LevelUp_Enabled", true); } + public int getLevelUpEffectsTier() { return config.getInt("Particles.LevelUp_Tier", 100); } /* PARTY SETTINGS */ public int getAutoPartyKickInterval() { return config.getInt("Party.AutoKick_Interval", 12); } diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index c1fbb007f..3cb238725 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -1,7 +1,6 @@ package com.gmail.nossr50.listeners; -import java.util.Calendar; - +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -11,15 +10,27 @@ import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent; import com.gmail.nossr50.util.skills.ParticleEffectUtils; public class SelfListener implements Listener { + protected Player player; + + protected float skillValue; + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerLevelUp(McMMOPlayerLevelUpEvent event) { if (!Config.getInstance().getLevelUpEffectsEnabled()) { return; } - Calendar today = Calendar.getInstance(); - if (today.get(Calendar.MONTH) == Calendar.APRIL && today.get(Calendar.DAY_OF_MONTH) == 1) { - ParticleEffectUtils.runescapeModeCelebration(event.getPlayer(), event.getSkill()); + int tier = Config.getInstance().getLevelUpEffectsTier(); + + if (tier <= 0) { + return; + } + + player = event.getPlayer(); + skillValue = event.getSkillLevel(); + + if ((skillValue % tier) == 0) { + ParticleEffectUtils.runescapeModeCelebration(player, event.getSkill()); } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dc9c9119c..a67692646 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -374,4 +374,7 @@ Particles: Bleed: true Greater_Impact: true - LevelUp: true + # These settings determine if fireworks should get launched when a player levels-up, + # this will happen by default for every 50 levels. + LevelUp_Enabled: true + LevelUp_Tier: 100