Fixed Heroes death bug (maybe)... Time for testing!
This commit is contained in:
Binary file not shown.
@@ -53,6 +53,8 @@ import com.garbagemule.MobArena.waves.BossWave;
|
|||||||
import com.garbagemule.MobArena.waves.Wave;
|
import com.garbagemule.MobArena.waves.Wave;
|
||||||
import com.garbagemule.MobArena.waves.Wave.WaveBranch;
|
import com.garbagemule.MobArena.waves.Wave.WaveBranch;
|
||||||
|
|
||||||
|
import com.herocraftonline.dev.heroes.persistence.Hero;
|
||||||
|
|
||||||
public class Arena
|
public class Arena
|
||||||
{
|
{
|
||||||
private MobArena plugin;
|
private MobArena plugin;
|
||||||
@@ -179,6 +181,11 @@ public class Arena
|
|||||||
for (Player p : arenaPlayers)
|
for (Player p : arenaPlayers)
|
||||||
{
|
{
|
||||||
p.teleport(arenaLoc);
|
p.teleport(arenaLoc);
|
||||||
|
if (plugin.getHeroManager() != null)
|
||||||
|
{
|
||||||
|
Hero hero = plugin.getHeroManager().getHero(p);
|
||||||
|
hero.setHealth(hero.getMaxHealth());
|
||||||
|
}
|
||||||
p.setHealth(20);
|
p.setHealth(20);
|
||||||
assignClassPermissions(p);
|
assignClassPermissions(p);
|
||||||
}
|
}
|
||||||
@@ -308,6 +315,11 @@ public class Arena
|
|||||||
{
|
{
|
||||||
storePlayerData(p, loc);
|
storePlayerData(p, loc);
|
||||||
MAUtils.sitPets(p);
|
MAUtils.sitPets(p);
|
||||||
|
if (plugin.getHeroManager() != null)
|
||||||
|
{
|
||||||
|
Hero hero = plugin.getHeroManager().getHero(p);
|
||||||
|
hero.setHealth(hero.getMaxHealth());
|
||||||
|
}
|
||||||
p.setHealth(20);
|
p.setHealth(20);
|
||||||
movePlayerToLobby(p);
|
movePlayerToLobby(p);
|
||||||
|
|
||||||
@@ -594,7 +606,15 @@ public class Arena
|
|||||||
private void clearPlayer(Player p)
|
private void clearPlayer(Player p)
|
||||||
{
|
{
|
||||||
if (healthMap.containsKey(p))
|
if (healthMap.containsKey(p))
|
||||||
p.setHealth(healthMap.remove(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Put out fire.
|
// Put out fire.
|
||||||
p.setFireTicks(0);
|
p.setFireTicks(0);
|
||||||
|
|||||||
@@ -16,12 +16,15 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
//import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
//import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.garbagemule.MobArena.util.FileUtils;
|
import com.garbagemule.MobArena.util.FileUtils;
|
||||||
import com.garbagemule.register.payment.Method;
|
import com.garbagemule.register.payment.Method;
|
||||||
import com.garbagemule.register.payment.Methods;
|
import com.garbagemule.register.payment.Methods;
|
||||||
|
|
||||||
|
import com.herocraftonline.dev.heroes.Heroes;
|
||||||
|
import com.herocraftonline.dev.heroes.persistence.HeroManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MobArena
|
* MobArena
|
||||||
* @author garbagemule
|
* @author garbagemule
|
||||||
@@ -32,7 +35,10 @@ public class MobArena extends JavaPlugin
|
|||||||
private ArenaMaster am;
|
private ArenaMaster am;
|
||||||
|
|
||||||
// Permissions stuff
|
// Permissions stuff
|
||||||
private PermissionHandler permissionHandler;
|
//private PermissionHandler permissionHandler;
|
||||||
|
|
||||||
|
// Heroes stuff
|
||||||
|
private HeroManager heroManager = null;
|
||||||
|
|
||||||
// Economy stuff
|
// Economy stuff
|
||||||
protected Methods Methods;
|
protected Methods Methods;
|
||||||
@@ -64,9 +70,10 @@ public class MobArena extends JavaPlugin
|
|||||||
FileUtils.fetchLibs(config);
|
FileUtils.fetchLibs(config);
|
||||||
|
|
||||||
// Set up permissions and economy
|
// Set up permissions and economy
|
||||||
setupPermissions();
|
//setupPermissions();
|
||||||
setupRegister();
|
setupRegister();
|
||||||
setupSpout();
|
setupSpout();
|
||||||
|
setupHeroes();
|
||||||
|
|
||||||
// Set up the ArenaMaster and the announcements
|
// Set up the ArenaMaster and the announcements
|
||||||
am = new ArenaMaster(this);
|
am = new ArenaMaster(this);
|
||||||
@@ -158,7 +165,7 @@ public class MobArena extends JavaPlugin
|
|||||||
public static void warning(String msg) { Bukkit.getServer().getLogger().warning("[MobArena] " + msg); }
|
public static void warning(String msg) { Bukkit.getServer().getLogger().warning("[MobArena] " + msg); }
|
||||||
public static void error(String msg) { Bukkit.getServer().getLogger().severe("[MobArena] " + msg); }
|
public static void error(String msg) { Bukkit.getServer().getLogger().severe("[MobArena] " + msg); }
|
||||||
|
|
||||||
private void setupPermissions()
|
/*private void setupPermissions()
|
||||||
{
|
{
|
||||||
if (permissionHandler != null)
|
if (permissionHandler != null)
|
||||||
return;
|
return;
|
||||||
@@ -167,7 +174,7 @@ public class MobArena extends JavaPlugin
|
|||||||
if (permissionsPlugin == null) return;
|
if (permissionsPlugin == null) return;
|
||||||
|
|
||||||
permissionHandler = ((Permissions) permissionsPlugin).getHandler();
|
permissionHandler = ((Permissions) permissionsPlugin).getHandler();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private void setupRegister()
|
private void setupRegister()
|
||||||
{
|
{
|
||||||
@@ -188,10 +195,23 @@ public class MobArena extends JavaPlugin
|
|||||||
hasSpout = spoutPlugin != null;
|
hasSpout = spoutPlugin != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupHeroes()
|
||||||
|
{
|
||||||
|
Plugin heroes = this.getServer().getPluginManager().getPlugin("Heroes");
|
||||||
|
if (heroes == null) return;
|
||||||
|
|
||||||
|
heroManager = ((Heroes) heroes).getHeroManager();
|
||||||
|
}
|
||||||
|
|
||||||
public Configuration getConfig() { return config; }
|
public Configuration getConfig() { return config; }
|
||||||
public ArenaMaster getAM() { return am; } // More convenient.
|
public ArenaMaster getAM() { return am; } // More convenient.
|
||||||
public ArenaMaster getArenaMaster() { return am; }
|
public ArenaMaster getArenaMaster() { return am; }
|
||||||
|
|
||||||
|
public HeroManager getHeroManager()
|
||||||
|
{
|
||||||
|
return heroManager;
|
||||||
|
}
|
||||||
|
|
||||||
private String getHeader()
|
private String getHeader()
|
||||||
{
|
{
|
||||||
String sep = System.getProperty("line.separator");
|
String sep = System.getProperty("line.separator");
|
||||||
|
|||||||
Reference in New Issue
Block a user