Changed placed block tracking to use metadata!

This commit is contained in:
GJ
2012-03-14 23:31:56 -04:00
parent 43ff0fa41a
commit 058cc3aac9
11 changed files with 28 additions and 113 deletions

View File

@ -48,7 +48,7 @@ public class BlastMining {
blocksDropped.add(temp);
Mining.miningDrops(temp);
if (temp.getData() != (byte) 0x5 && !plugin.misc.blockWatchList.contains(temp)) {
if (!temp.hasMetadata("placedBlock")) {
if (extraDrops == 2) {
blocksDropped.add(temp);
Mining.miningDrops(temp);
@ -160,7 +160,7 @@ public class BlastMining {
}
for (Block block : xp) {
if (block.getData() != (byte)5 && !plugin.misc.blockWatchList.contains(block)) {
if (!block.hasMetadata("placedBlock")) {
Mining.miningXP(player, block);
}
}

View File

@ -126,7 +126,7 @@ public class Excavation {
public static void gigaDrillBreaker(Player player, Block block) {
Skills.abilityDurabilityLoss(player.getItemInHand(), LoadProperties.abilityDurabilityLoss);
if (block.getData() != (byte) 0x5) {
if (!block.hasMetadata("placedBlock")) {
PlayerAnimationEvent armswing = new PlayerAnimationEvent(player);
Bukkit.getPluginManager().callEvent(armswing);

View File

@ -135,7 +135,7 @@ public class Herbalism {
Block b = block.getRelative(0, y, 0);
if (b.getType().equals(Material.CACTUS)) {
mat = Material.CACTUS;
if (!plugin.misc.blockWatchList.contains(b)) {
if (!b.hasMetadata("placedBlock")) {
if(herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
catciDrops++;
}
@ -154,7 +154,7 @@ public class Herbalism {
break;
case MELON_BLOCK:
if (data != (byte) 0x5) {
if (!block.hasMetadata("placedBlock")) {
mat = Material.MELON;
xp = LoadProperties.mmelon;
}
@ -169,7 +169,7 @@ public class Herbalism {
case PUMPKIN:
case JACK_O_LANTERN:
if (!plugin.misc.blockWatchList.contains(block)) {
if (!block.hasMetadata("placedBlock")) {
mat = Material.getMaterial(id);
xp = LoadProperties.mpumpkin;
}
@ -177,7 +177,7 @@ public class Herbalism {
case RED_ROSE:
case YELLOW_FLOWER:
if (!plugin.misc.blockWatchList.contains(block)) {
if (!block.hasMetadata("placedBlock")) {
mat = Material.getMaterial(id);
xp = LoadProperties.mflower;
}
@ -188,7 +188,7 @@ public class Herbalism {
Block b = block.getRelative(0, y, 0);
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
mat = Material.SUGAR_CANE;
if (!plugin.misc.blockWatchList.contains(b)) {
if (!b.hasMetadata("placedBlock")) {
if(herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
caneDrops++;
}
@ -199,14 +199,14 @@ public class Herbalism {
break;
case VINE:
if (!plugin.misc.blockWatchList.contains(block)) {
if (!block.hasMetadata("placedBlock")) {
mat = type;
xp = LoadProperties.mvines;
}
break;
case WATER_LILY:
if (data != (byte) 0x5) {
if (!block.hasMetadata("placedBlock")) {
mat = type;
xp = LoadProperties.mlilypad;
}

View File

@ -156,7 +156,7 @@ public class Mining
* @param plugin mcMMO plugin instance
*/
public static void miningBlockCheck(Player player, Block block, mcMMO plugin) {
if (plugin.misc.blockWatchList.contains(block) || block.getData() == (byte) 5) {
if (block.hasMetadata("placedBlock")) {
return;
}
@ -251,7 +251,7 @@ public class Mining
case NETHERRACK:
case SANDSTONE:
case STONE:
if ((block.getData() == (byte) 5) || plugin.misc.blockWatchList.contains(block)) {
if (!block.hasMetadata("placedBlock")) {
return;
}

View File

@ -97,9 +97,7 @@ public class WoodCutting
break;
}
//ItemStack item = new ItemStack(x.getType(), 1, (byte)0, type);
if(!plugin.misc.blockWatchList.contains(x))
if(!x.hasMetadata("placedBlock"))
{
WoodCutting.woodCuttingProcCheck(player, x);
@ -166,16 +164,16 @@ public class WoodCutting
Block zPositive = world.getBlockAt(x, y, z+1);
Block zNegative = world.getBlockAt(x, y, z-1);
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
if(!currentBlock.hasMetadata("placedBlock") &&
!isTooAgressive(isAirOrLeaves, xPositive) && treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive))
processTreeFelling(xPositive, world, toBeFelled, plugin);
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
if(!currentBlock.hasMetadata("placedBlock") &&
!isTooAgressive(isAirOrLeaves, xNegative) && treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative))
processTreeFelling(xNegative, world, toBeFelled, plugin);
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
if(!currentBlock.hasMetadata("placedBlock") &&
!isTooAgressive(isAirOrLeaves, zPositive) && treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive))
processTreeFelling(zPositive, world, toBeFelled, plugin);
if(!plugin.misc.blockWatchList.contains(currentBlock) &&
if(!currentBlock.hasMetadata("placedBlock") &&
!isTooAgressive(isAirOrLeaves, zNegative) && treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative))
processTreeFelling(zNegative, world, toBeFelled, plugin);
@ -184,7 +182,7 @@ public class WoodCutting
if(treeFellerCompatible(yPositive))
{
if(!plugin.misc.blockWatchList.contains(currentBlock) && !toBeFelled.contains(yPositive))
if(!currentBlock.hasMetadata("placedBlock") && !toBeFelled.contains(yPositive))
{
processTreeFelling(yPositive, world, toBeFelled, plugin);
}
@ -217,7 +215,7 @@ public class WoodCutting
int xp = 0;
byte data = block.getData();
if(plugin.misc.blockWatchList.contains(block))
if(block.hasMetadata("placedBlock"))
return;
switch(data)