All changes up to 0.8.13! Sorry for being an airhead and not uploading the source right away :)

This commit is contained in:
nossr50 2011-03-08 19:24:28 -08:00
parent ffd71c42a7
commit 31ef094549
4 changed files with 78 additions and 166 deletions

View File

@ -1,5 +1,8 @@
Changelog: Changelog:
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code# #Versions without changelogs probably had very small misc fixes, like tweaks to the source code#
Version 0.8.13
Enemies no longer look like they have frozen when they die
Item duping fix
Version 0.8.11 Version 0.8.11
Performance improvements Performance improvements
Memory leak fixed Memory leak fixed

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.Squid;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -58,21 +59,21 @@ public class mcCombat {
if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){ if(defender != null && mcPermissions.getInstance().unarmed(attacker) && attacker.getItemInHand().getTypeId() == 0){
//DMG MODIFIER //DMG MODIFIER
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
defender.setHealth(calculateDamage(defender, 6)); event.setDamage(calculateDamage(event, 6));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
defender.setHealth(calculateDamage(defender, 7)); event.setDamage(calculateDamage(event, 7));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
defender.setHealth(calculateDamage(defender, 8)); event.setDamage(calculateDamage(event, 8));
} }
if(mcUsers.getProfile(defender).isDead()) if(mcUsers.getProfile(defender).isDead())
return; return;
@ -91,21 +92,6 @@ public class mcCombat {
} }
} }
} }
/*
* Make the defender drop items on death
*/
if(defender.getHealth()<= 0 && !mcUsers.getProfile(defender).isDead()){
mcUsers.getProfile(defender).setDead(true);
event.setCancelled(true); //SEE IF THIS HELPS
//If it only would've died from mcMMO damage modifiers
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
mcm.getInstance().simulateNaturalDrops(defender);
}
for(ItemStack herp : defender.getInventory().getContents()){
if(herp != null && herp.getTypeId() != 0)
defender.getLocation().getWorld().dropItemNaturally(defender.getLocation(), herp);
}
}
} }
} }
public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){ public void playerVersusSquidChecks(EntityDamageByEntityEvent event, Player attacker, Entity x, int type){
@ -144,10 +130,7 @@ public class mcCombat {
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); event.setDamage(calculateDamage(event, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
}
if(defender.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(defender);
} }
} }
/* /*
@ -157,21 +140,21 @@ public class mcCombat {
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
defender.setHealth(calculateDamage(defender, 6)); event.setDamage(calculateDamage(event, 6));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
defender.setHealth(calculateDamage(defender, 7)); event.setDamage(calculateDamage(event, 7));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
defender.setHealth(calculateDamage(defender, 8)); event.setDamage(calculateDamage(event, 8));
} }
//XP //XP
if(defender.getHealth() != 0){ if(defender.getHealth() != 0){
@ -186,9 +169,6 @@ public class mcCombat {
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
} }
} }
if(defender.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(defender);
}
} }
} }
} }
@ -202,34 +182,28 @@ public class mcCombat {
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); event.setDamage(calculateDamage(event, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
}
if(defender.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(defender);
} }
} }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
defender.setHealth(calculateDamage(defender, 6)); event.setDamage(calculateDamage(event, 6));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
defender.setHealth(calculateDamage(defender, 7)); event.setDamage(calculateDamage(event, 7));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
defender.setHealth(calculateDamage(defender, 8)); event.setDamage(calculateDamage(event, 8));
}
if(defender.getHealth() <= 0){
mcm.getInstance().simulateNaturalDrops(defender);
} }
} }
} }
@ -302,31 +276,28 @@ public class mcCombat {
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getAxesInt() >= 500){ if(mcUsers.getProfile(attacker).getAxesInt() >= 500){
defender.setHealth(calculateDamage(defender, (4 - axeNerf(attacker.getItemInHand().getTypeId())))); event.setDamage(calculateDamage(event, (4 - axeNerf(attacker.getItemInHand().getTypeId()))));
} }
if(defender.getHealth() <= 0 || defender.getHealth() - event.getDamage() <= 0){
mcm.getInstance().simulateNaturalDrops(defender);
}
} }
if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){ if(type == 0 && mcPermissions.getInstance().unarmed(attacker)){
if(defender.getHealth() <= 0) if(defender.getHealth() <= 0)
return; return;
if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){ if(mcUsers.getProfile(attacker).getUnarmedInt() >= 50 && mcUsers.getProfile(attacker).getUnarmedInt() < 100){
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 100 && mcUsers.getProfile(attacker).getUnarmedInt() < 200){
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 200 && mcUsers.getProfile(attacker).getUnarmedInt() < 325){
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 325 && mcUsers.getProfile(attacker).getUnarmedInt() < 475){
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 475 && mcUsers.getProfile(attacker).getUnarmedInt() < 600){
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 600 && mcUsers.getProfile(attacker).getUnarmedInt() < 775){
defender.setHealth(calculateDamage(defender, 6)); event.setDamage(calculateDamage(event, 6));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 775 && mcUsers.getProfile(attacker).getUnarmedInt() < 950){
defender.setHealth(calculateDamage(defender, 7)); event.setDamage(calculateDamage(event, 7));
} else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){ } else if(mcUsers.getProfile(attacker).getUnarmedInt() >= 950){
defender.setHealth(calculateDamage(defender, 8)); event.setDamage(calculateDamage(event, 8));
} }
//XP //XP
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){
@ -350,9 +321,6 @@ public class mcCombat {
} }
attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")"); attacker.sendMessage(ChatColor.YELLOW+"Unarmed skill increased by "+skillups+"."+" Total ("+mcUsers.getProfile(attacker).getUnarmed()+")");
} }
if(defender.getHealth() <= 0 || defender.getHealth() - event.getDamage() <= 0){
mcm.getInstance().simulateNaturalDrops(defender);
}
} }
} }
} }
@ -419,19 +387,15 @@ public class mcCombat {
*/ */
int healthbefore = defender.getHealth(); int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
//If it only would've died from mcMMO damage modifiers
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
mcm.getInstance().simulateNaturalDrops(defender);
}
//XP //XP
if(!mcConfig.getInstance().isMobSpawnTracked(x)){ if(!mcConfig.getInstance().isMobSpawnTracked(x)){
if(x instanceof Creeper) if(x instanceof Creeper)
@ -462,19 +426,15 @@ public class mcCombat {
Animals defender = (Animals)x; Animals defender = (Animals)x;
int healthbefore = defender.getHealth(); int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
//If it only would've died from mcMMO damage modifiers
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
mcm.getInstance().simulateNaturalDrops(defender);
}
} }
/* /*
* Defender is Squid * Defender is Squid
@ -483,19 +443,15 @@ public class mcCombat {
Squid defender = (Squid)x; Squid defender = (Squid)x;
int healthbefore = defender.getHealth(); int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
//If it only would've died from mcMMO damage modifiers
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
mcm.getInstance().simulateNaturalDrops(defender);
}
} }
/* /*
* Attacker is Player * Attacker is Player
@ -540,19 +496,15 @@ public class mcCombat {
} }
int healthbefore = defender.getHealth(); int healthbefore = defender.getHealth();
if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250) if(mcUsers.getProfile(attacker).getArcheryInt() >= 50 && mcUsers.getProfile(attacker).getArcheryInt() < 250)
defender.setHealth(calculateDamage(defender, 1)); event.setDamage(calculateDamage(event, 1));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575) if(mcUsers.getProfile(attacker).getArcheryInt() >= 250 && mcUsers.getProfile(attacker).getArcheryInt() < 575)
defender.setHealth(calculateDamage(defender, 2)); event.setDamage(calculateDamage(event, 2));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725) if(mcUsers.getProfile(attacker).getArcheryInt() >= 575 && mcUsers.getProfile(attacker).getArcheryInt() < 725)
defender.setHealth(calculateDamage(defender, 3)); event.setDamage(calculateDamage(event, 3));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 725 && mcUsers.getProfile(attacker).getArcheryInt() < 1000)
defender.setHealth(calculateDamage(defender, 4)); event.setDamage(calculateDamage(event, 4));
if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000) if(mcUsers.getProfile(attacker).getArcheryInt() >= 1000)
defender.setHealth(calculateDamage(defender, 5)); event.setDamage(calculateDamage(event, 5));
//If it only would've died from mcMMO damage modifiers
if(defender.getHealth() <= 0 && healthbefore - event.getDamage() >= 1){
mcm.getInstance().simulateNaturalDrops(defender);
}
} }
} }
} }
@ -622,41 +574,8 @@ public class mcCombat {
return 0; return 0;
} }
} }
public int calculateDamage(Player player, int dmg){ public int calculateDamage(EntityDamageEvent event, int dmg){
int health = player.getHealth(); return event.getDamage() + dmg;
if(health - dmg <0){
return 0;
} else {
health-= dmg;
return health;
}
}
public int calculateDamage(Squid squid, int dmg){
int health = squid.getHealth();
if(health - dmg <0){
return 0;
} else {
health-= dmg;
return health;
}
}
public int calculateDamage(Monster monster, int dmg){
int health = monster.getHealth();
if(health - dmg <0){
return 0;
} else {
health-= dmg;
return health;
}
}
public int calculateDamage(Animals animal, int dmg){
int health = animal.getHealth();
if(health - dmg <0){
return 0;
} else {
health-= dmg;
return health;
}
} }
public void axeCriticalCheckAnimals(Player attacker, EntityDamageByEntityEvent event, Entity x){ public void axeCriticalCheckAnimals(Player attacker, EntityDamageByEntityEvent event, Entity x){
if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){ if(mcm.getInstance().isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)){
@ -664,8 +583,7 @@ public class mcCombat {
if(Math.random() * 100 > 95){ if(Math.random() * 100 > 95){
if(x instanceof Animals){ if(x instanceof Animals){
Animals animal = (Animals)x; Animals animal = (Animals)x;
animal.setHealth(0); event.setDamage(event.getDamage() + animal.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -674,8 +592,7 @@ public class mcCombat {
if(Math.random() * 10 > 9){ if(Math.random() * 10 > 9){
if(x instanceof Animals){ if(x instanceof Animals){
Animals animal = (Animals)x; Animals animal = (Animals)x;
animal.setHealth(0); event.setDamage(event.getDamage() + animal.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -684,8 +601,7 @@ public class mcCombat {
if(Math.random() * 10 > 8){ if(Math.random() * 10 > 8){
if(x instanceof Animals){ if(x instanceof Animals){
Animals animal = (Animals)x; Animals animal = (Animals)x;
animal.setHealth(0); event.setDamage(event.getDamage() + animal.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -694,8 +610,7 @@ public class mcCombat {
if(Math.random() * 10 > 7){ if(Math.random() * 10 > 7){
if(x instanceof Animals){ if(x instanceof Animals){
Animals animal = (Animals)x; Animals animal = (Animals)x;
animal.setHealth(0); event.setDamage(event.getDamage() + animal.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -704,8 +619,7 @@ public class mcCombat {
if(Math.random() * 10 > 6){ if(Math.random() * 10 > 6){
if(x instanceof Animals){ if(x instanceof Animals){
Animals animal = (Animals)x; Animals animal = (Animals)x;
animal.setHealth(0); event.setDamage(event.getDamage() + animal.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -718,8 +632,7 @@ public class mcCombat {
if(Math.random() * 100 > 95){ if(Math.random() * 100 > 95){
if(x instanceof Monster){ if(x instanceof Monster){
Monster monster = (Monster)x; Monster monster = (Monster)x;
monster.setHealth(0); event.setDamage(event.getDamage() + monster.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -728,8 +641,7 @@ public class mcCombat {
if(Math.random() * 10 > 9){ if(Math.random() * 10 > 9){
if(x instanceof Monster){ if(x instanceof Monster){
Monster monster = (Monster)x; Monster monster = (Monster)x;
monster.setHealth(0); event.setDamage(event.getDamage() + monster.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -738,8 +650,7 @@ public class mcCombat {
if(Math.random() * 10 > 8){ if(Math.random() * 10 > 8){
if(x instanceof Monster){ if(x instanceof Monster){
Monster monster = (Monster)x; Monster monster = (Monster)x;
monster.setHealth(0); event.setDamage(event.getDamage() + monster.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -748,8 +659,7 @@ public class mcCombat {
if(Math.random() * 10 > 7){ if(Math.random() * 10 > 7){
if(x instanceof Monster){ if(x instanceof Monster){
Monster monster = (Monster)x; Monster monster = (Monster)x;
monster.setHealth(0); event.setDamage(event.getDamage() + monster.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -758,8 +668,7 @@ public class mcCombat {
if(Math.random() * 10 > 6){ if(Math.random() * 10 > 6){
if(x instanceof Monster){ if(x instanceof Monster){
Monster monster = (Monster)x; Monster monster = (Monster)x;
monster.setHealth(0); event.setDamage(event.getDamage() + monster.getHealth() * 2);
mcm.getInstance().simulateNaturalDrops(x);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
} }
} }
@ -772,7 +681,7 @@ public class mcCombat {
if(Math.random() * 100 > 95){ if(Math.random() * 100 > 95){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
} }
@ -782,7 +691,7 @@ public class mcCombat {
if(Math.random() * 10 > 9){ if(Math.random() * 10 > 9){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
} }
@ -792,7 +701,7 @@ public class mcCombat {
if(Math.random() * 10 > 8){ if(Math.random() * 10 > 8){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
} }
@ -802,7 +711,7 @@ public class mcCombat {
if(Math.random() * 10 > 7){ if(Math.random() * 10 > 7){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
} }
@ -812,7 +721,7 @@ public class mcCombat {
if(Math.random() * 10 > 6){ if(Math.random() * 10 > 6){
if(x instanceof Player){ if(x instanceof Player){
Player player = (Player)x; Player player = (Player)x;
player.setHealth(calculateDamage(player, (player.getHealth() - event.getDamage()))); event.setDamage(event.getDamage() * 2);
attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!"); attacker.sendMessage(ChatColor.RED+"CRITICAL HIT!");
player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!"); player.sendMessage(ChatColor.DARK_RED + "You were CRITICALLY hit!");
} }

View File

@ -32,7 +32,7 @@ public class mcMMO extends JavaPlugin {
//herp //herp
public void onEnable() { public void onEnable() {
mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000)); //mcMMO_Timer.schedule(new mcTimer(this), 0, (long)(2000));
//Make the directory if it does not exist //Make the directory if it does not exist
new File(maindirectory).mkdir(); new File(maindirectory).mkdir();
//Make the file if it does not exist //Make the file if it does not exist

View File

@ -1,3 +1,3 @@
name: mcMMO name: mcMMO
main: com.gmail.nossr50.mcMMO main: com.gmail.nossr50.mcMMO
version: 0.8.11 version: 0.8.13