Added block metadata for storing 'unnatural' blocks.

This commit is contained in:
Will Coates 2014-08-07 18:35:08 +01:00
parent d857bf483e
commit 7f919b9207
4 changed files with 12 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
@ -126,8 +127,10 @@ public class BlockListener implements Listener {
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
if (BlockUtils.shouldBeWatched(blockState)) {
mcMMO.getPlaceStore().setTrue(blockState);
blockState.setMetadata("unnatural", new FixedMetadataValue(plugin, true));
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) {

View File

@ -27,6 +27,9 @@ public class ExcavationManager extends SkillManager {
* @param blockState The {@link BlockState} to check ability activation for
*/
public void excavationBlockCheck(BlockState blockState) {
if (blockState.getMetadata("unnatural").size() != 0)
return;
int xp = Excavation.getBlockXP(blockState);
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.EXCAVATION_TREASURE_HUNTER)) {

View File

@ -56,6 +56,9 @@ public class MiningManager extends SkillManager {
* @param blockState The {@link BlockState} to check ability activation for
*/
public void miningBlockCheck(BlockState blockState) {
if (blockState.getMetadata("unnatural").size() != 0)
return;
Player player = getPlayer();
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);

View File

@ -51,6 +51,9 @@ public class WoodcuttingManager extends SkillManager {
* @param blockState Block being broken
*/
public void woodcuttingBlockCheck(BlockState blockState) {
if (blockState.getMetadata("unnatural").size() != 0)
return;
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
switch (blockState.getType()) {