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

View File

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

View File

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

View File

@ -39,20 +39,13 @@ import com.gmail.nossr50.locale.mcLocale;
public class Mining
{
public static void superBreakerCheck(Player player, Block block)
public static void superBreakerCheck(Player player)
{
PlayerProfile PP = Users.getProfile(player);
if(m.isMiningPick(player.getItemInHand()))
{
if(block != null)
{
if(!m.abilityBlockCheck(block))
return;
}
if(PP.getPickaxePreparationMode())
{
PP.setPickaxePreparationMode(false);
}
int ticks = 2;
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);
if(m.isAxes(player.getItemInHand()))
{
if(block != null)
{
if(!m.abilityBlockCheck(block))
return;
}
/*
* CHECK FOR AXE PREP MODE
*/
if(PP.getAxePreparationMode())
{
PP.setAxePreparationMode(false);
}
int ticks = 2;
int x = PP.getSkillLevel(SkillType.WOODCUTTING);