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,111 +160,72 @@ 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
case 1:
xp += LoadProperties.mstone; xp += LoadProperties.mstone;
if(smelt = false) break;
blockProcCheck(block, player); //SANDSTONE
else case 24:
blockProcCheck(block, player); xp += LoadProperties.msandstone;
} break;
//OBSIDIAN //OBSIDIAN
else if(id == 49) case 49:
{
xp += LoadProperties.mobsidian; xp += LoadProperties.mobsidian;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//NETHERRACK //NETHERRACK
else if(id == 87) case 87:
{
xp += LoadProperties.mnetherrack; xp += LoadProperties.mnetherrack;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//GLOWSTONE //GLOWSTONE
else if(id == 89) case 89:
{
xp += LoadProperties.mglowstone; xp += LoadProperties.mglowstone;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//COAL //COAL
else if(id == 16) case 16:
{
xp += LoadProperties.mcoal; xp += LoadProperties.mcoal;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//GOLD //GOLD
else if(id == 14) case 14:
{
xp += LoadProperties.mgold; xp += LoadProperties.mgold;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//DIAMOND //DIAMOND
else if(id == 56) case 56:
{
xp += LoadProperties.mdiamond; xp += LoadProperties.mdiamond;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//IRON //IRON
else if(id == 15) case 15:
{
xp += LoadProperties.miron; xp += LoadProperties.miron;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
}
//REDSTONE //REDSTONE
else if(id == 73 || id == 74) case 73:
{
xp += LoadProperties.mredstone; xp += LoadProperties.mredstone;
if(smelt = false) break;
blockProcCheck(block, player); case 74:
else xp += LoadProperties.mredstone;
blockProcCheck(block, player); break;
} //LAPIS
//LAPUS case 21:
else if(id == 21)
{
xp += LoadProperties.mlapis; xp += LoadProperties.mlapis;
if(smelt = false) break;
blockProcCheck(block, player);
else
blockProcCheck(block, player);
} }
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)