Even more Mining optimizations.

This commit is contained in:
Grant 2012-02-01 03:28:47 -05:00
parent 64e6ea86fd
commit 5b3c176192

View File

@ -89,55 +89,69 @@ public class Mining
return; return;
} }
switch (id){
//GLOWSTONE //GLOWSTONE
if(id == 89) case 89:
{
mat = Material.getMaterial(348); mat = Material.getMaterial(348);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} break;
//REDSTONE //REDSTONE
else if(id == 73 || id == 74) case 73:
{
mat = Material.getMaterial(331); mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
if(Math.random() * 10 > 5){
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} if(Math.random() * 10 > 5)
} m.mcDropItem(loc, item);
break;
case 74:
mat = Material.getMaterial(331);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
//LAPIS //LAPIS
else if(id == 21) case 21:
{
mat = Material.getMaterial(351); mat = Material.getMaterial(351);
item = new ItemStack(mat, 1, (byte)0,(byte)0x4); item = new ItemStack(mat, 1, (byte)0,(byte)0x4);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
break;
//DIAMOND //DIAMOND
else if(id == 56) case 56:
{
mat = Material.getMaterial(264); mat = Material.getMaterial(264);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} break;
//STONE //STONE
else if(id == 1) case 1:
{
mat = Material.getMaterial(4); mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} break;
//COAL //COAL
else if(id == 16) case 16:
{
mat = Material.getMaterial(263); mat = Material.getMaterial(263);
item = new ItemStack(mat, 1, (byte)0, damage); item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break;
} }
} }
@ -229,10 +243,7 @@ public class Mining
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
if(LoadProperties.toolsLoseDurabilityFromAbilities) if(LoadProperties.toolsLoseDurabilityFromAbilities)
{ {
if(player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY)) if(!player.getItemInHand().getEnchantments().containsKey(Enchantment.DURABILITY))
{
}
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss); m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
} }
@ -244,28 +255,30 @@ public class Mining
byte damage = 0; byte damage = 0;
ItemStack item = new ItemStack(mat, 1, (byte)0, damage); ItemStack item = new ItemStack(mat, 1, (byte)0, damage);
if(id == 1 || id == 24) //STONE
{
if(id == 1) if(id == 1)
{ {
mat = Material.COBBLESTONE;
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5) if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
{ {
xp += LoadProperties.mstone; xp += LoadProperties.mstone;
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
} else mat = Material.getMaterial(4);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR);
}
//SANDSTONE
else if(id == 24)
{ {
mat = Material.SANDSTONE;
if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5) if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5)
{ {
xp += LoadProperties.msandstone; xp += LoadProperties.msandstone;
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
}
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -278,8 +291,6 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
mat = Material.getMaterial(87);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -320,7 +331,6 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -328,15 +338,11 @@ public class Mining
//OBSIDIAN //OBSIDIAN
else if(id == 49 && m.getTier(player) >= 4) else if(id == 49 && m.getTier(player) >= 4)
{ {
if(LoadProperties.toolsLoseDurabilityFromAbilities)
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
xp += LoadProperties.mobsidian; xp += LoadProperties.mobsidian;
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
mat = Material.getMaterial(49);
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -363,7 +369,6 @@ public class Mining
blockProcCheck(block, player); blockProcCheck(block, player);
blockProcCheck(block, player); blockProcCheck(block, player);
} }
item = new ItemStack(mat, 1, (byte)0, damage);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
@ -382,14 +387,13 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
{
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
} if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
} }
//LAPUS //LAPIS
else if(id == 21 && m.getTier(player) >= 3){ else if(id == 21 && m.getTier(player) >= 3){
if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){
xp += LoadProperties.mlapis; xp += LoadProperties.mlapis;
@ -402,14 +406,22 @@ public class Mining
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
if(Math.random() * 10 > 5)
m.mcDropItem(loc, item);
player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); player.incrementStatistic(Statistic.MINE_BLOCK, block.getType());
block.setType(Material.AIR); block.setType(Material.AIR);
} }
if(block.getData() != (byte) 5) if(block.getData() != (byte) 5)
PP.addXP(SkillType.MINING, xp, player); PP.addXP(SkillType.MINING, xp, player);
if(LoadProperties.spoutEnabled) if(LoadProperties.spoutEnabled)
SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation()); SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());
Skills.XpCheckSkill(SkillType.MINING, player); Skills.XpCheckSkill(SkillType.MINING, player);
} }
} }