diff --git a/resources/plugin.yml b/resources/plugin.yml index 6ac3b75..eb36282 100644 --- a/resources/plugin.yml +++ b/resources/plugin.yml @@ -1,7 +1,7 @@ name: MobArena author: garbagemule main: com.garbagemule.MobArena.MobArena -version: 0.95.5.37 +version: 0.95.5.38 softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault] commands: ma: diff --git a/src/com/garbagemule/MobArena/ArenaImpl.java b/src/com/garbagemule/MobArena/ArenaImpl.java index 8f8d716..25a482a 100644 --- a/src/com/garbagemule/MobArena/ArenaImpl.java +++ b/src/com/garbagemule/MobArena/ArenaImpl.java @@ -15,7 +15,6 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.*; -import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.*; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.potion.PotionEffect; @@ -1029,7 +1028,7 @@ public class ArenaImpl implements Arena } private void setHealth(Player p, double health) { - plugin.getHealthStrategy().setHealth(p, health); + p.setHealth(health); } @Override diff --git a/src/com/garbagemule/MobArena/MobArena.java b/src/com/garbagemule/MobArena/MobArena.java index a27a16e..db7aa42 100644 --- a/src/com/garbagemule/MobArena/MobArena.java +++ b/src/com/garbagemule/MobArena/MobArena.java @@ -23,9 +23,6 @@ import org.bukkit.plugin.java.JavaPlugin; import com.garbagemule.MobArena.commands.CommandHandler; import com.garbagemule.MobArena.framework.Arena; import com.garbagemule.MobArena.framework.ArenaMaster; -import com.garbagemule.MobArena.health.HealthStrategy; -import com.garbagemule.MobArena.health.HealthStrategyHeroes; -import com.garbagemule.MobArena.health.HealthStrategyStandard; import com.garbagemule.MobArena.listeners.MAGlobalListener; import com.garbagemule.MobArena.listeners.MagicSpellsListener; import com.garbagemule.MobArena.metrics.Metrics; @@ -46,10 +43,6 @@ public class MobArena extends JavaPlugin // Inventories from disconnects private Set inventoriesToRestore; - // Heroes - private boolean hasHeroes; - private HealthStrategy healthStrategy; - // Vault private Economy economy; @@ -69,9 +62,7 @@ public class MobArena extends JavaPlugin // Set up soft dependencies setupVault(); - setupHeroes(); setupMagicSpells(); - setupStrategies(); // Set up the ArenaMaster arenaMaster = new ArenaMasterImpl(this); @@ -180,14 +171,6 @@ public class MobArena extends JavaPlugin } } - private void setupHeroes() { - Plugin heroesPlugin = this.getServer().getPluginManager().getPlugin("Heroes"); - if (heroesPlugin == null) return; - - Messenger.info("Heroes found; using different health strategy."); - hasHeroes = true; - } - private void setupMagicSpells() { Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells"); if (spells == null) return; @@ -196,10 +179,6 @@ public class MobArena extends JavaPlugin this.getServer().getPluginManager().registerEvents(new MagicSpellsListener(this), this); } - private void setupStrategies() { - healthStrategy = (hasHeroes ? new HealthStrategyHeroes() : new HealthStrategyStandard()); - } - private void loadAbilities() { File dir = new File(this.getDataFolder(), "abilities"); if (!dir.exists()) dir.mkdir(); @@ -217,10 +196,6 @@ public class MobArena extends JavaPlugin } } - public HealthStrategy getHealthStrategy() { - return healthStrategy; - } - public ArenaMaster getArenaMaster() { return arenaMaster; } diff --git a/src/com/garbagemule/MobArena/health/HealthStrategy.java b/src/com/garbagemule/MobArena/health/HealthStrategy.java deleted file mode 100644 index 6283448..0000000 --- a/src/com/garbagemule/MobArena/health/HealthStrategy.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.garbagemule.MobArena.health; - -import org.bukkit.entity.Player; - -public interface HealthStrategy -{ - /** - * Set the health of a player. - * @param p a player - * @param health amount of health - */ - public void setHealth(Player p, double health); -} diff --git a/src/com/garbagemule/MobArena/health/HealthStrategyHeroes.java b/src/com/garbagemule/MobArena/health/HealthStrategyHeroes.java deleted file mode 100644 index 22af62b..0000000 --- a/src/com/garbagemule/MobArena/health/HealthStrategyHeroes.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.garbagemule.MobArena.health; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; - -public class HealthStrategyHeroes implements HealthStrategy -{ - @Override - public void setHealth(Player p, double health) { - double current = p.getHealth(); - double regain = health == p.getMaxHealth() ? p.getMaxHealth() : health - current; - - try { - EntityRegainHealthEvent event = new EntityRegainHealthEvent(p, regain, RegainReason.CUSTOM); - Bukkit.getPluginManager().callEvent(event); - } - catch (Exception e) {} // Because Bukkit is retarded. - } -} diff --git a/src/com/garbagemule/MobArena/health/HealthStrategyStandard.java b/src/com/garbagemule/MobArena/health/HealthStrategyStandard.java deleted file mode 100644 index 4660892..0000000 --- a/src/com/garbagemule/MobArena/health/HealthStrategyStandard.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.garbagemule.MobArena.health; - -import org.bukkit.entity.Player; - -public class HealthStrategyStandard implements HealthStrategy -{ - @Override - public void setHealth(Player p, double health) { - p.setHealth(health); - } -}