Merge pull request #71 from gmcferrin/pull-me

Updated to remove unused "smelt" property. Minor optimizations in
This commit is contained in:
NuclearW 2012-01-31 22:54:31 -08:00
commit 7693662cea
2 changed files with 60 additions and 97 deletions

View File

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