mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 12:35:27 +02:00
update UserBlockTracker API
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
package com.gmail.nossr50.runnables;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.CancellableRunnable;
|
||||
import com.gmail.nossr50.util.MetadataConstants;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PistonTrackerTask extends CancellableRunnable {
|
||||
private final List<Block> blocks;
|
||||
private final BlockFace direction;
|
||||
private final Block futureEmptyBlock;
|
||||
|
||||
public PistonTrackerTask(List<Block> blocks, BlockFace direction, Block futureEmptyBlock) {
|
||||
this.blocks = blocks;
|
||||
this.direction = direction;
|
||||
this.futureEmptyBlock = futureEmptyBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Check to see if futureEmptyBlock is empty - if it isn't; the blocks didn't move
|
||||
if (!BlockUtils.isPistonPiece(futureEmptyBlock.getState())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mcMMO.getPlaceStore().isTrue(futureEmptyBlock)) {
|
||||
mcMMO.getPlaceStore().setFalse(futureEmptyBlock);
|
||||
}
|
||||
|
||||
for (Block b : blocks) {
|
||||
Block nextBlock = b.getRelative(direction);
|
||||
|
||||
if (nextBlock.hasMetadata(MetadataConstants.METADATA_KEY_PISTON_TRACKING)) {
|
||||
BlockUtils.setUnnaturalBlock(nextBlock);
|
||||
nextBlock.removeMetadata(MetadataConstants.METADATA_KEY_PISTON_TRACKING, mcMMO.p);
|
||||
}
|
||||
else if (mcMMO.getPlaceStore().isTrue(nextBlock)) {
|
||||
// Block doesn't have metadatakey but isTrue - set it to false
|
||||
mcMMO.getPlaceStore().setFalse(nextBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -19,7 +19,7 @@ public class StickyPistonTrackerTask extends CancellableRunnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!mcMMO.getPlaceStore().isTrue(movedBlock.getRelative(direction))) {
|
||||
if (!mcMMO.getPlaceStore().isIneligible(movedBlock.getRelative(direction))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class StickyPistonTrackerTask extends CancellableRunnable {
|
||||
}
|
||||
|
||||
// The sticky piston actually pulled the block so move the PlaceStore data
|
||||
mcMMO.getPlaceStore().setFalse(movedBlock.getRelative(direction));
|
||||
mcMMO.getPlaceStore().setEligible(movedBlock.getRelative(direction));
|
||||
BlockUtils.setUnnaturalBlock(movedBlock);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||
import com.gmail.nossr50.util.CancellableRunnable;
|
||||
import com.gmail.nossr50.util.ContainerMetadataUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
@@ -17,7 +16,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer.isValidBrew;
|
||||
import static com.gmail.nossr50.util.EventUtils.getMcMMOPlayer;
|
||||
|
||||
public class AlchemyBrewCheckTask extends CancellableRunnable {
|
||||
private final BrewingStand brewingStand;
|
||||
|
Reference in New Issue
Block a user