Replace Bukkit Metadata for user placed blocks

This commit is contained in:
NuclearW
2012-05-07 22:38:22 -04:00
parent 37d146e8fa
commit b0157c9bd2
13 changed files with 488 additions and 31 deletions

View File

@ -52,7 +52,7 @@ public class BlastMining {
blocksDropped.add(temp);
Mining.miningDrops(temp);
if (!temp.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(temp)) {
for (int i = 1 ; i < extraDrops ; i++) {
blocksDropped.add(temp);
Mining.miningDrops(temp);
@ -159,7 +159,7 @@ public class BlastMining {
}
for (Block block : xp) {
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
Mining.miningXP(player, block);
}
}

View File

@ -112,7 +112,7 @@ public class Excavation {
public static void gigaDrillBreaker(Player player, Block block) {
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player);
mcMMO.p.getServer().getPluginManager().callEvent(armswing);

View File

@ -89,7 +89,7 @@ public class Herbalism {
switch (type) {
case BROWN_MUSHROOM:
case RED_MUSHROOM:
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
mat = Material.getMaterial(id);
xp = Config.getInstance().getHerbalismXPMushrooms();
}
@ -100,7 +100,7 @@ public class Herbalism {
Block b = block.getRelative(0, y, 0);
if (b.getType().equals(Material.CACTUS)) {
mat = Material.CACTUS;
if (!b.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(b)) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
catciDrops++;
}
@ -122,7 +122,7 @@ public class Herbalism {
break;
case MELON_BLOCK:
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
mat = Material.MELON;
xp = Config.getInstance().getHerbalismXPMelon();
}
@ -137,7 +137,7 @@ public class Herbalism {
case PUMPKIN:
case JACK_O_LANTERN:
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
mat = Material.getMaterial(id);
xp = Config.getInstance().getHerbalismXPPumpkin();
}
@ -145,7 +145,7 @@ public class Herbalism {
case RED_ROSE:
case YELLOW_FLOWER:
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
mat = Material.getMaterial(id);
xp = Config.getInstance().getHerbalismXPFlowers();
}
@ -156,7 +156,7 @@ public class Herbalism {
Block b = block.getRelative(0, y, 0);
if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) {
mat = Material.SUGAR_CANE;
if (!b.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(b)) {
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
caneDrops++;
}
@ -167,14 +167,14 @@ public class Herbalism {
break;
case VINE:
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
mat = type;
xp = Config.getInstance().getHerbalismXPVines();
}
break;
case WATER_LILY:
if (!block.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(block)) {
mat = type;
xp = Config.getInstance().getHerbalismXPLilyPads();
}

View File

@ -212,7 +212,7 @@ public class Mining {
* @param block The block being broken
*/
public static void miningBlockCheck(Player player, Block block) {
if (block.hasMetadata("mcmmoPlacedBlock") || player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
if (mcMMO.placeStore.isTrue(block) || player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
return;
}
@ -272,7 +272,7 @@ public class Mining {
case NETHERRACK:
case SANDSTONE:
case STONE:
if (block.hasMetadata("mcmmoPlacedBlock")) {
if (mcMMO.placeStore.isTrue(block)) {
return;
}

View File

@ -114,7 +114,7 @@ public class WoodCutting {
break;
}
if (!x.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(x)) {
WoodCutting.woodCuttingProcCheck(player, x);
switch (species) {
@ -188,7 +188,7 @@ public class WoodCutting {
Block zNegative = currentBlock.getRelative(0, 0, -1);
Block yPositive = currentBlock.getRelative(0, 1, 0);
if (!currentBlock.hasMetadata("mcmmoPlacedBlock")) {
if (!mcMMO.placeStore.isTrue(currentBlock)) {
if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive.getType()) && !toBeFelled.contains(xPositive)) {
processTreeFelling(xPositive, toBeFelled);
}
@ -207,7 +207,7 @@ public class WoodCutting {
}
if (BlockChecks.treeFellerCompatible(yPositive.getType())) {
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") && !toBeFelled.contains(yPositive)) {
if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
processTreeFelling(yPositive, toBeFelled);
}
}
@ -296,7 +296,7 @@ public class WoodCutting {
int xp = 0;
TreeSpecies species = TreeSpecies.getByData(block.getData());
if (block.hasMetadata("mcmmoPlacedBlock")) {
if (mcMMO.placeStore.isTrue(block)) {
return;
}