Tweaks to SkullSplitter/SerratedStrikes

This commit is contained in:
nossr50 2012-02-14 10:33:49 -08:00
parent 441015d6a5
commit 939344816e
5 changed files with 30 additions and 42 deletions

View File

@ -358,35 +358,7 @@ public class Combat
} }
} }
/**
* Attempt to damage target for value dmg with reason CUSTOM
*
* @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do
*/
public static void dealDamage(LivingEntity target, int dmg) { public static void dealDamage(LivingEntity target, int dmg) {
dealDamage(target, dmg, EntityDamageEvent.DamageCause.CUSTOM);
}
/**
* Attempt to damage target for value dmg with reason cause
*
* @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do
* @param cause DamageCause to pass to damage event
*/
public static void dealDamage(LivingEntity target, int dmg, DamageCause cause) {
target.damage(dmg);
}
/**
* Attempt to damage target for value dmg with reason ENTITY_ATTACK with damager attacker
*
* @param target LivingEntity which to attempt to damage
* @param dmg Amount of damage to attempt to do
* @param attacker Player to pass to event as damager
*/
public static void dealDamage(LivingEntity target, int dmg, Player attacker) {
target.damage(dmg); target.damage(dmg);
} }

View File

@ -164,6 +164,7 @@ public class m
} }
} }
} }
public static Integer getTier(Player player) public static Integer getTier(Player player)
{ {
int i = player.getItemInHand().getTypeId(); int i = player.getItemInHand().getTypeId();
@ -181,6 +182,7 @@ public class m
return 1; //UNRECOGNIZED return 1; //UNRECOGNIZED
} }
} }
public static Integer getMaxDurability(Integer tier, ItemStack item) public static Integer getMaxDurability(Integer tier, ItemStack item)
{ {
int id = item.getTypeId(); int id = item.getTypeId();
@ -250,6 +252,7 @@ public class m
return health-newvalue; return health-newvalue;
} }
} }
public static boolean isInt(String string) public static boolean isInt(String string)
{ {
try try
@ -262,6 +265,7 @@ public class m
} }
return true; return true;
} }
public static void mcDropItem(Location location, int id) public static void mcDropItem(Location location, int id)
{ {
if(location == null) return; if(location == null) return;
@ -270,6 +274,7 @@ public class m
ItemStack item = new ItemStack(mat, 1, (byte) 0, (byte) 0); ItemStack item = new ItemStack(mat, 1, (byte) 0, (byte) 0);
mcDropItem(location, item); mcDropItem(location, item);
} }
public static void mcDropItem(Location location, ItemStack itemStack) { public static void mcDropItem(Location location, ItemStack itemStack) {
// We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event. // We can't get the item until we spawn it and we want to make it cancellable, so we have a custom event.
McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack); McMMOItemSpawnEvent event = new McMMOItemSpawnEvent(location, itemStack);
@ -308,11 +313,7 @@ public class m
int id = is.getTypeId(); int id = is.getTypeId();
return id == 270 || id == 274 || id == 285 || id == 257 || id == 278; return id == 270 || id == 274 || id == 285 || id == 257 || id == 278;
} }
// public boolean isGold(ItemStack is)
// {
// int id = is.getTypeId();
// return id == 283 || id == 284 || id == 285 || id == 286 || id == 294 || id == 314 || id == 315 || id == 316 || id == 317;
// }
public static void convertToMySQL() public static void convertToMySQL()
{ {
if(!LoadProperties.useMySQL) if(!LoadProperties.useMySQL)

View File

@ -69,6 +69,7 @@ public class Axes {
} }
} }
} }
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx) public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event, Plugin pluginx)
{ {
Entity x = event.getEntity(); Entity x = event.getEntity();
@ -119,6 +120,12 @@ public class Axes {
{ {
int targets = 0; int targets = 0;
int dmgAmount = (event.getDamage()/2);
//Setup minimum damage
if(dmgAmount < 1)
dmgAmount = 1;
if(event.getEntity() instanceof LivingEntity) if(event.getEntity() instanceof LivingEntity)
{ {
LivingEntity x = (LivingEntity) event.getEntity(); LivingEntity x = (LivingEntity) event.getEntity();
@ -135,6 +142,7 @@ public class Axes {
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx))) if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue; continue;
} }
//Damage nearby LivingEntities //Damage nearby LivingEntities
if(derp instanceof LivingEntity && targets >= 1) if(derp instanceof LivingEntity && targets >= 1)
{ {
@ -154,18 +162,19 @@ public class Axes {
if(target.isDead()) if(target.isDead())
continue; continue;
if(targets >= 1 && derp.getWorld().getPVP() && !target.isDead()) if(targets >= 1 && derp.getWorld().getPVP())
{ {
Combat.dealDamage(target, event.getDamage() / 2, attacker); Combat.dealDamage(target, dmgAmount);
target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!"); target.sendMessage(ChatColor.DARK_RED+"Struck by CLEAVE!");
targets--; targets--;
continue; continue;
} }
} }
else else
{ {
LivingEntity target = (LivingEntity)derp; LivingEntity target = (LivingEntity)derp;
Combat.dealDamage(target, event.getDamage() / 2, attacker); Combat.dealDamage(target, dmgAmount);
targets--; targets--;
} }
} }

View File

@ -1119,7 +1119,7 @@ public class Fishing {
if(le instanceof Player) if(le instanceof Player)
return; return;
Combat.dealDamage(le, 1, event.getPlayer()); Combat.dealDamage(le, 1);
Location loc = le.getLocation(); Location loc = le.getLocation();
/* Neutral Mobs */ /* Neutral Mobs */

View File

@ -113,6 +113,12 @@ public class Swords
{ {
int targets = 0; int targets = 0;
int dmgAmount = (event.getDamage()/4);
//Setup minimum damage
if(dmgAmount < 1)
dmgAmount = 1;
if(event.getEntity() instanceof LivingEntity) if(event.getEntity() instanceof LivingEntity)
{ {
LivingEntity x = (LivingEntity) event.getEntity(); LivingEntity x = (LivingEntity) event.getEntity();
@ -146,7 +152,7 @@ public class Swords
continue; continue;
if(targets >= 1 && derp.getWorld().getPVP()) if(targets >= 1 && derp.getWorld().getPVP())
{ {
Combat.dealDamage(target, event.getDamage() / 4, attacker); Combat.dealDamage(target, dmgAmount);
target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!"); target.sendMessage(ChatColor.DARK_RED+"Struck by Serrated Strikes!");
Users.getProfile(target).addBleedTicks(5); Users.getProfile(target).addBleedTicks(5);
targets--; targets--;
@ -159,7 +165,7 @@ public class Swords
pluginx.misc.addToBleedQue((LivingEntity)derp); pluginx.misc.addToBleedQue((LivingEntity)derp);
LivingEntity target = (LivingEntity)derp; LivingEntity target = (LivingEntity)derp;
Combat.dealDamage(target, event.getDamage() / 4, attacker); Combat.dealDamage(target, dmgAmount);
targets--; targets--;
} }
} }