mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-01-23 16:51:21 +01:00
Fixed Heroes health bug (thanks, Drehverschluss, for helping out with the testing)
This commit is contained in:
parent
a31aa1ce0e
commit
9161bead55
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: MobArena
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.94.3.22
|
||||
version: 0.94.3.23
|
||||
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells]
|
||||
commands:
|
||||
ma:
|
||||
|
@ -41,6 +41,8 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
@ -59,8 +61,6 @@ import com.garbagemule.MobArena.waves.BossWave;
|
||||
import com.garbagemule.MobArena.waves.Wave;
|
||||
import com.garbagemule.MobArena.waves.Wave.WaveBranch;
|
||||
|
||||
import com.herocraftonline.dev.heroes.hero.Hero;
|
||||
|
||||
public class Arena
|
||||
{
|
||||
private MobArena plugin;
|
||||
@ -193,12 +193,7 @@ public class Arena
|
||||
for (Player p : arenaPlayers)
|
||||
{
|
||||
p.teleport(arenaLoc);
|
||||
if (plugin.getHeroManager() != null)
|
||||
{
|
||||
Hero hero = plugin.getHeroManager().getHero(p);
|
||||
hero.setHealth(hero.getMaxHealth());
|
||||
}
|
||||
p.setHealth(20);
|
||||
setHealth(p, 20);
|
||||
p.setFoodLevel(20);
|
||||
assignClassPermissions(p);
|
||||
arenaPlayerMap.put(p, new ArenaPlayer(p, this, plugin));
|
||||
@ -338,13 +333,7 @@ public class Arena
|
||||
{
|
||||
storePlayerData(p, loc);
|
||||
MAUtils.sitPets(p);
|
||||
p.setHealth(20);
|
||||
if (plugin.getHeroManager() != null)
|
||||
{
|
||||
Hero hero = plugin.getHeroManager().getHero(p);
|
||||
hero.setHealth(hero.getMaxHealth());
|
||||
hero.syncHealth();
|
||||
}
|
||||
setHealth(p, 20);
|
||||
p.setFoodLevel(20);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
movePlayerToLobby(p);
|
||||
@ -647,13 +636,7 @@ public class Arena
|
||||
if (healthMap.containsKey(p))
|
||||
{
|
||||
int health = healthMap.remove(p);
|
||||
p.setHealth(health);
|
||||
if (plugin.getHeroManager() != null)
|
||||
{
|
||||
Hero hero = plugin.getHeroManager().getHero(p);
|
||||
hero.setHealth(health * hero.getMaxHealth() / 20);
|
||||
hero.syncHealth();
|
||||
}
|
||||
setHealth(p, health);
|
||||
}
|
||||
|
||||
if (hungerMap.containsKey(p))
|
||||
@ -710,6 +693,20 @@ public class Arena
|
||||
ap.setDead(true);
|
||||
}
|
||||
|
||||
private void setHealth(Player p, int health)
|
||||
{
|
||||
// Grab the current health
|
||||
int current = p.getHealth();
|
||||
|
||||
// If the health is 20, just leave it at that no matter what.
|
||||
int regain = health == 20 ? 20 : health - current;
|
||||
|
||||
// Set the health, and fire off the event.
|
||||
p.setHealth(health);
|
||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(p, regain, RegainReason.CUSTOM);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
public void repairBlocks()
|
||||
{
|
||||
while (!repairQueue.isEmpty())
|
||||
|
@ -308,6 +308,8 @@ public class MAListener implements ArenaListener
|
||||
damager = ((Projectile) damager).getShooter();
|
||||
}
|
||||
|
||||
event.setCancelled(false);
|
||||
|
||||
// Pet wolf
|
||||
if (damagee instanceof Wolf && arena.pets.contains(damagee))
|
||||
onPetDamage(event, (Wolf) damagee, damager);
|
||||
|
@ -22,9 +22,6 @@ import com.garbagemule.MobArena.util.FileUtils;
|
||||
import com.garbagemule.register.payment.Method;
|
||||
import com.garbagemule.register.payment.Methods;
|
||||
|
||||
import com.herocraftonline.dev.heroes.Heroes;
|
||||
import com.herocraftonline.dev.heroes.hero.HeroManager;
|
||||
|
||||
/**
|
||||
* MobArena
|
||||
* @author garbagemule
|
||||
@ -41,7 +38,7 @@ public class MobArena extends JavaPlugin
|
||||
public static boolean hasSpout;
|
||||
|
||||
// Heroes stuff
|
||||
private HeroManager heroManager = null;
|
||||
//private HeroManager heroManager = null;
|
||||
|
||||
// Global variables
|
||||
public static PluginDescriptionFile desc;
|
||||
@ -70,7 +67,7 @@ public class MobArena extends JavaPlugin
|
||||
// Set up soft dependencies
|
||||
setupRegister();
|
||||
setupSpout();
|
||||
setupHeroes();
|
||||
//setupHeroes();
|
||||
setupMagicSpells();
|
||||
|
||||
// Set up the ArenaMaster and the announcements
|
||||
@ -184,13 +181,13 @@ public class MobArena extends JavaPlugin
|
||||
Spouty.registerEvents(this);
|
||||
}
|
||||
|
||||
private void setupHeroes()
|
||||
/*private void setupHeroes()
|
||||
{
|
||||
Plugin heroes = this.getServer().getPluginManager().getPlugin("Heroes");
|
||||
if (heroes == null) return;
|
||||
|
||||
heroManager = ((Heroes) heroes).getHeroManager();
|
||||
}
|
||||
}*/
|
||||
|
||||
private void setupMagicSpells()
|
||||
{
|
||||
@ -206,10 +203,10 @@ public class MobArena extends JavaPlugin
|
||||
public ArenaMaster getAM() { return am; } // More convenient.
|
||||
public ArenaMaster getArenaMaster() { return am; }
|
||||
|
||||
public HeroManager getHeroManager()
|
||||
/*public HeroManager getHeroManager()
|
||||
{
|
||||
return heroManager;
|
||||
}
|
||||
}*/
|
||||
|
||||
private String getHeader()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user