Optimize even more things.

This commit is contained in:
GJ 2012-02-23 23:04:41 -05:00
parent 19ab8b89f5
commit bdb74d4719
5 changed files with 31 additions and 57 deletions

View File

@ -162,7 +162,7 @@ public class mcBlockListener implements Listener
//Green Terra //Green Terra
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07) if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07)
{ {
Herbalism.greenTerraCheck(player, block); Herbalism.greenTerraCheck(player);
} }
//Wheat && Triple drops //Wheat && Triple drops
@ -224,7 +224,7 @@ public class mcBlockListener implements Listener
*/ */
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(block)) if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(block))
{ {
Herbalism.greenTerraCheck(player, block); Herbalism.greenTerraCheck(player);
} }
if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5) if(mcPermissions.getInstance().herbalism(player) && block.getData() != (byte) 5)
@ -252,19 +252,22 @@ public class mcBlockListener implements Listener
/* /*
* ABILITY PREPARATION CHECKS * ABILITY PREPARATION CHECKS
*/ */
if(m.abilityBlockCheck(block))
{
if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block)) if(PP.getHoePreparationMode() && Herbalism.canBeGreenTerra(block))
Herbalism.greenTerraCheck(player, block); Herbalism.greenTerraCheck(player);
if(PP.getAxePreparationMode() && block.getTypeId() == 17) if(PP.getAxePreparationMode() && block.getTypeId() == 17)
WoodCutting.treeFellerCheck(player, block); WoodCutting.treeFellerCheck(player);
if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block)) if(PP.getPickaxePreparationMode() && Mining.canBeSuperBroken(block))
Mining.superBreakerCheck(player, block); Mining.superBreakerCheck(player);
if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block)) if(PP.getShovelPreparationMode() && Excavation.canBeGigaDrillBroken(block))
Excavation.gigaDrillBreakerActivationCheck(player, block); Excavation.gigaDrillBreakerActivationCheck(player);
}
if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78)) if(PP.getFistsPreparationMode() && (Excavation.canBeGigaDrillBroken(block) || block.getTypeId() == 78))
Unarmed.berserkActivationCheck(player); Unarmed.berserkActivationCheck(player);
/* /*
* TREE FELLAN STUFF * TREE FELLER STUFF
*/ */
if(LoadProperties.spoutEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode()) if(LoadProperties.spoutEnabled && block.getTypeId() == 17 && Users.getProfile(player).getTreeFellerMode())
SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation()); SpoutStuff.playSoundForPlayer(SoundEffect.FIZZ, player, block.getLocation());
@ -273,9 +276,7 @@ public class mcBlockListener implements Listener
* GREEN TERRA STUFF * GREEN TERRA STUFF
*/ */
if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode()) if(PP.getGreenTerraMode() && mcPermissions.getInstance().herbalismAbility(player) && PP.getGreenTerraMode())
{
Herbalism.greenTerra(player, block); Herbalism.greenTerra(player, block);
}
/* /*
* GIGA DRILL BREAKER CHECKS * GIGA DRILL BREAKER CHECKS
@ -296,11 +297,11 @@ public class mcBlockListener implements Listener
if(LoadProperties.toolsLoseDurabilityFromAbilities) if(LoadProperties.toolsLoseDurabilityFromAbilities)
{ {
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) if(!inhand.containsEnchantment(Enchantment.DURABILITY))
{ {
short durability = player.getItemInHand().getDurability(); short durability = inhand.getDurability();
durability += (LoadProperties.abilityDurabilityLoss); durability += (LoadProperties.abilityDurabilityLoss);
player.getItemInHand().setDurability(durability); inhand.setDurability(durability);
} }
} }
@ -339,11 +340,11 @@ public class mcBlockListener implements Listener
if(LoadProperties.toolsLoseDurabilityFromAbilities) if(LoadProperties.toolsLoseDurabilityFromAbilities)
{ {
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) if(!inhand.containsEnchantment(Enchantment.DURABILITY))
{ {
short durability = player.getItemInHand().getDurability(); short durability = inhand.getDurability();
durability += (LoadProperties.abilityDurabilityLoss); durability += (LoadProperties.abilityDurabilityLoss);
player.getItemInHand().setDurability(durability); inhand.setDurability(durability);
} }
} }

View File

@ -41,20 +41,14 @@ import org.getspout.spoutapi.sound.SoundEffect;
public class Excavation public class Excavation
{ {
public static void gigaDrillBreakerActivationCheck(Player player, Block block) public static void gigaDrillBreakerActivationCheck(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(m.isShovel(player.getItemInHand())) if(m.isShovel(player.getItemInHand()))
{ {
if(block != null)
{
if(!m.abilityBlockCheck(block))
return;
}
if(PP.getShovelPreparationMode()) if(PP.getShovelPreparationMode())
{
PP.setShovelPreparationMode(false); PP.setShovelPreparationMode(false);
}
int ticks = 2; int ticks = 2;
int x = PP.getSkillLevel(SkillType.EXCAVATION); int x = PP.getSkillLevel(SkillType.EXCAVATION);
while(x >= 50) while(x >= 50)

View File

@ -37,20 +37,13 @@ import com.gmail.nossr50.locale.mcLocale;
public class Herbalism public class Herbalism
{ {
public static void greenTerraCheck(Player player, Block block) public static void greenTerraCheck(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(m.isHoe(player.getItemInHand())) if(m.isHoe(player.getItemInHand()))
{ {
if(block != null)
{
if(!m.abilityBlockCheck(block))
return;
}
if(PP.getHoePreparationMode()) if(PP.getHoePreparationMode())
{
PP.setHoePreparationMode(false); PP.setHoePreparationMode(false);
}
int ticks = 2; int ticks = 2;
int x = PP.getSkillLevel(SkillType.HERBALISM); int x = PP.getSkillLevel(SkillType.HERBALISM);
while(x >= 50) while(x >= 50)

View File

@ -39,20 +39,13 @@ import com.gmail.nossr50.locale.mcLocale;
public class Mining public class Mining
{ {
public static void superBreakerCheck(Player player, Block block) public static void superBreakerCheck(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(m.isMiningPick(player.getItemInHand())) if(m.isMiningPick(player.getItemInHand()))
{ {
if(block != null)
{
if(!m.abilityBlockCheck(block))
return;
}
if(PP.getPickaxePreparationMode()) if(PP.getPickaxePreparationMode())
{
PP.setPickaxePreparationMode(false); PP.setPickaxePreparationMode(false);
}
int ticks = 2; int ticks = 2;
int x = PP.getSkillLevel(SkillType.MINING); int x = PP.getSkillLevel(SkillType.MINING);

View File

@ -194,23 +194,16 @@ public class WoodCutting
} }
} }
public static void treeFellerCheck(Player player, Block block) public static void treeFellerCheck(Player player)
{ {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(m.isAxes(player.getItemInHand())) if(m.isAxes(player.getItemInHand()))
{ {
if(block != null)
{
if(!m.abilityBlockCheck(block))
return;
}
/* /*
* CHECK FOR AXE PREP MODE * CHECK FOR AXE PREP MODE
*/ */
if(PP.getAxePreparationMode()) if(PP.getAxePreparationMode())
{
PP.setAxePreparationMode(false); PP.setAxePreparationMode(false);
}
int ticks = 2; int ticks = 2;
int x = PP.getSkillLevel(SkillType.WOODCUTTING); int x = PP.getSkillLevel(SkillType.WOODCUTTING);