From a5bc547c40d21cf9f8658b00f010daab211e0b38 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sat, 11 Oct 2014 12:18:31 +0200 Subject: [PATCH] Add settings for Bleed damage Adds #2154 --- .../java/com/gmail/nossr50/config/AdvancedConfig.java | 3 +++ .../gmail/nossr50/runnables/skills/BleedTimerTask.java | 9 +++++---- src/main/resources/advanced.yml | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index f3225fc7e..ebcd43fd3 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -802,6 +802,9 @@ public class AdvancedConfig extends AutoUpdateConfigLoader { public int getSmeltingVanillaXPBoostMultiplier(Smelting.Tier tier) { return config.getInt("Skills.Smelting.VanillaXPMultiplier.Rank_" + tier.toNumerical()); } /* SWORDS */ + public double getBleedDamagePlayer() { return config.getDouble("Skills.Swords.Bleed.Damage_Player", 1.0); } + public double getBleedDamageMobs() { return config.getDouble("Skills.Swords.Bleed.Damage_Mobs", 2.0); } + public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed.MaxTicks", 3); } public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed.BaseTicks", 2); } diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java index 21524ef43..b87d89ae7 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java @@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; +import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils; @@ -28,10 +29,10 @@ public class BleedTimerTask extends BukkitRunnable { continue; } - int damage; + double damage; if (entity instanceof Player) { - damage = 1; + damage = AdvancedConfig.getInstance().getBleedDamagePlayer(); Player player = (Player) entity; if (!player.isOnline()) { @@ -44,14 +45,14 @@ public class BleedTimerTask extends BukkitRunnable { ParticleEffectUtils.playBleedEffect(entity); } - entry.setValue(entry.getValue() - damage); + entry.setValue(entry.getValue() - 1); if (entry.getValue() <= 0) { player.sendMessage(LocaleLoader.getString("Swords.Combat.Bleeding.Stopped")); } } else { - damage = 2; + damage = AdvancedConfig.getInstance().getBleedDamageMobs(); // Anticipate the entity's death to prevent CME because of our EntityDeathEvent listener if (entity.getHealth() - damage > 0) { diff --git a/src/main/resources/advanced.yml b/src/main/resources/advanced.yml index 909fcb582..ede0450a2 100644 --- a/src/main/resources/advanced.yml +++ b/src/main/resources/advanced.yml @@ -447,6 +447,11 @@ Skills: ChanceMax: 75.0 MaxBonusLevel: 750 + # Damage_Player: Bleeding damage dealt to players + # Damage_Mobs: Bleeding damage dealt to mobs + Damage_Player: 1.0 + Damage_Mobs: 2.0 + # These settings determine how long the Bleeding effect lasts MaxTicks: 3 BaseTicks: 2