Updated to remove unused "smelt" property. Minor optimizations in

Mining.java
This commit is contained in:
Grant 2012-02-01 00:20:01 -05:00
parent fdb96a2cf8
commit 388fd364ac
2 changed files with 60 additions and 97 deletions

View File

@ -76,7 +76,7 @@ public class mcBlockListener implements Listener
if(m.shouldBeWatched(block))
{
int id = block.getTypeId();
if (id == 17 || id == 39 || id == 40 || id == 91 || id == 86 || id == 73) {
if (id == 17 || id == 39 || id == 40 || id == 91 || id == 86 || id == 73 || id == 74) {
plugin.misc.blockWatchList.add(block);
} else {
//block.setData((byte) 5); //Change the byte
@ -160,11 +160,11 @@ public class mcBlockListener implements Listener
{
if(m.isMiningPick(inhand))
{
Mining.miningBlockCheck(false, player, block, plugin);
Mining.miningBlockCheck(player, block, plugin);
}
} else
{
Mining.miningBlockCheck(false, player, block, plugin);
Mining.miningBlockCheck(player, block, plugin);
}
}
/*

View File

@ -152,7 +152,7 @@ public class Mining
}
}
public static void miningBlockCheck(Boolean smelt, Player player, Block block, mcMMO plugin)
public static void miningBlockCheck(Player player, Block block, mcMMO plugin)
{
PlayerProfile PP = Users.getProfile(player);
if(plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5)
@ -160,111 +160,72 @@ public class Mining
int xp = 0;
int id = block.getTypeId();
if(id == 1 || id == 24)
{
switch (id) {
//STONE
case 1:
xp += LoadProperties.mstone;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//SANDSTONE
case 24:
xp += LoadProperties.msandstone;
break;
//OBSIDIAN
else if(id == 49)
{
case 49:
xp += LoadProperties.mobsidian;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//NETHERRACK
else if(id == 87)
{
case 87:
xp += LoadProperties.mnetherrack;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//GLOWSTONE
else if(id == 89)
{
case 89:
xp += LoadProperties.mglowstone;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//COAL
else if(id == 16)
{
case 16:
xp += LoadProperties.mcoal;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//GOLD
else if(id == 14)
{
case 14:
xp += LoadProperties.mgold;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//DIAMOND
else if(id == 56)
{
case 56:
xp += LoadProperties.mdiamond;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//IRON
else if(id == 15)
{
case 15:
xp += LoadProperties.miron;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
break;
//REDSTONE
else if(id == 73 || id == 74)
{
case 73:
xp += LoadProperties.mredstone;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//LAPUS
else if(id == 21)
{
break;
case 74:
xp += LoadProperties.mredstone;
break;
//LAPIS
case 21:
xp += LoadProperties.mlapis;
if(smelt = false)
blockProcCheck(block, player);
else
blockProcCheck(block, player);
break;
}
blockProcCheck(block, player);
PP.addXP(SkillType.MINING, xp, player);
Skills.XpCheckSkill(SkillType.MINING, player);
}
/*
* Handling SuperBreaker stuff
*/
public static Boolean canBeSuperBroken(Block block)
{
int t = block.getTypeId();
if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15)
{
if(t == 49 || t == 87 || t == 89 || t == 73 || t == 74 || t == 56 || t == 21 || t == 1 || t == 16 || t == 14 || t == 15 || t == 112)
return true;
} else {
else
return false;
}
}
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)
{
@ -278,6 +239,7 @@ public class Mining
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
//Pre-processing
Location loc = block.getLocation();
Material mat = Material.getMaterial(block.getTypeId());
int xp = 0;
@ -285,6 +247,7 @@ public class Mining
ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
int id = block.getTypeId();
if(id == 1 || id == 24)
{
if(id == 1)