mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Added block metadata for storing 'unnatural' blocks.
This commit is contained in:
parent
d857bf483e
commit
7f919b9207
@ -21,6 +21,7 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
|
|||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
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 */
|
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||||
mcMMO.getPlaceStore().setTrue(blockState);
|
mcMMO.getPlaceStore().setTrue(blockState);
|
||||||
|
blockState.setMetadata("unnatural", new FixedMetadataValue(plugin, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) {
|
if (blockState.getType() == Repair.anvilMaterial && SkillType.REPAIR.getPermissions(player)) {
|
||||||
|
@ -27,6 +27,9 @@ public class ExcavationManager extends SkillManager {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public void excavationBlockCheck(BlockState blockState) {
|
public void excavationBlockCheck(BlockState blockState) {
|
||||||
|
if (blockState.getMetadata("unnatural").size() != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int xp = Excavation.getBlockXP(blockState);
|
int xp = Excavation.getBlockXP(blockState);
|
||||||
|
|
||||||
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.EXCAVATION_TREASURE_HUNTER)) {
|
if (Permissions.secondaryAbilityEnabled(getPlayer(), SecondaryAbility.EXCAVATION_TREASURE_HUNTER)) {
|
||||||
|
@ -56,6 +56,9 @@ public class MiningManager extends SkillManager {
|
|||||||
* @param blockState The {@link BlockState} to check ability activation for
|
* @param blockState The {@link BlockState} to check ability activation for
|
||||||
*/
|
*/
|
||||||
public void miningBlockCheck(BlockState blockState) {
|
public void miningBlockCheck(BlockState blockState) {
|
||||||
|
if (blockState.getMetadata("unnatural").size() != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);
|
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE);
|
||||||
|
@ -51,6 +51,9 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
* @param blockState Block being broken
|
* @param blockState Block being broken
|
||||||
*/
|
*/
|
||||||
public void woodcuttingBlockCheck(BlockState blockState) {
|
public void woodcuttingBlockCheck(BlockState blockState) {
|
||||||
|
if (blockState.getMetadata("unnatural").size() != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
int xp = Woodcutting.getExperienceFromLog(blockState, ExperienceGainMethod.DEFAULT);
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user