Fixed onDamage to report damagetypes to a public int.

This commit is contained in:
nossr50 2010-12-02 18:13:19 -08:00
parent d3aff7d2d6
commit 41c9feb13e

View File

@ -6,9 +6,7 @@ import java.util.logging.Logger;
//Author: nossr50, TrapAlice, cerevisiae //Author: nossr50, TrapAlice, cerevisiae
//===================================================================== //=====================================================================
public class vMinecraftListener extends PluginListener { public class vMinecraftListener extends PluginListener {
public int bAttacker; public int damagetype;
public int bDefender;
public int bAmount;
protected static final Logger log = Logger.getLogger("Minecraft"); protected static final Logger log = Logger.getLogger("Minecraft");
//===================================================================== //=====================================================================
@ -96,11 +94,20 @@ public class vMinecraftListener extends PluginListener {
vMinecraftUsers.addUser(player); vMinecraftUsers.addUser(player);
} }
public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) { public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) {
bAttacker = attacker.getId(); if(type == type.CREEPER_EXPLOSION){
bDefender = defender.getId(); damagetype = 1; //Creeper
bAmount = amount; } else if(type == type.FALL){
log.log(Level.INFO, "Attacker ID: " + bAttacker + ", Defender ID: " + bDefender + ", Amount: " + bAmount); damagetype = 2; //Fall
return false; } else if(type == type.FIRE){
damagetype = 3; //Fire going to make it share with firetick since its similar
} else if (type == type.FIRE_TICK){
damagetype = 4; //Firetick
} else if (type == type.LAVA){
damagetype = 5; //Lava
} else if (type == type.WATER){
damagetype = 6; //Water
}
return false;
} }
} }