From 3d242bbdb6acdb700c93292ea4a3ba6a859fa60a Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sun, 29 Jun 2014 15:13:06 +0200 Subject: [PATCH] Always call back events --- .../java/com/gmail/nossr50/config/Config.java | 1 - .../gmail/nossr50/util/skills/CombatUtils.java | 16 +++++----------- src/main/resources/config.yml | 2 -- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 5d580d8d4..34cfb33bc 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -237,7 +237,6 @@ public class Config extends AutoUpdateConfigLoader { public boolean getStatsTrackingEnabled() { return config.getBoolean("General.Stats_Tracking", true); } public boolean getUpdateCheckEnabled() { return config.getBoolean("General.Update_Check", true); } public boolean getPreferBeta() { return config.getBoolean("General.Prefer_Beta", false); } - public boolean getEventCallbackEnabled() { return config.getBoolean("General.Event_Callback", true); } public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); } public String getPartyChatPrefix() { return config.getString("Commands.partychat.Chat_Prefix_Format", "[[GREEN]]([[WHITE]]{0}[[GREEN]])"); } diff --git a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java index 4de417f79..70db53fad 100644 --- a/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java +++ b/src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java @@ -613,20 +613,14 @@ public final class CombatUtils { } public static double callFakeDamageEvent(Entity attacker, Entity target, DamageCause cause, Map modifiers) { - double finalDamage = 0; + EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers); + mcMMO.p.getServer().getPluginManager().callEvent(damageEvent); - if (Config.getInstance().getEventCallbackEnabled()) { - EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers); - mcMMO.p.getServer().getPluginManager().callEvent(damageEvent); - - if (damageEvent.isCancelled()) { - return 0; - } - - finalDamage = damageEvent.getFinalDamage(); + if (damageEvent.isCancelled()) { + return 0; } - return finalDamage; + return damageEvent.getFinalDamage(); } public static Map getModifiers(EntityDamageEvent event) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c920f5d60..d7c1c95f1 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -17,8 +17,6 @@ General: # Allow mcMMO to check if a new version is available Update_Check: true Prefer_Beta: false - # Allow mcMMO to inform other plugins of damage being dealt - Event_Callback: true Power_Level_Cap: 0 # Should mcMMO print out debug messages? Verbose_Logging: false