PsuedoVertical done

This commit is contained in:
Niels Vergucht 2018-12-05 02:13:17 +01:00
parent 462e4bad1a
commit 3d1090201e
2 changed files with 16 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package com.songoda.epicbuckets.genbucket;
import com.songoda.epicbuckets.EpicBuckets;
import com.songoda.epicbuckets.shop.SubShop;
import com.songoda.epicbuckets.util.XMaterial;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
@ -65,6 +66,10 @@ public abstract class Genbucket {
return currentBlock;
}
protected void fixHole(Block block) {
if (block.getType() == XMaterial.AIR.parseMaterial()) block.setType(getGenItem().getType());
}
protected boolean placeGen(Block block) {
if (!epicBuckets.getConfigManager().getIgnoredMaterials().contains(block.getType().name())) return false;
block.setType(getGenItem().getType());

View File

@ -4,24 +4,31 @@ import com.songoda.epicbuckets.EpicBuckets;
import com.songoda.epicbuckets.genbucket.Genbucket;
import com.songoda.epicbuckets.genbucket.GenbucketType;
import com.songoda.epicbuckets.shop.SubShop;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class PsuedoVertical extends Genbucket {
private int blocksUp = 0;
public PsuedoVertical(Player owner, Block clickedBlock, BlockFace blockFace, SubShop s) {
super(GenbucketType.PSUEDO, clickedBlock, blockFace, s, owner);
}
@Override
public void generate() {
Bukkit.getServer().getScheduler().runTaskTimer(EpicBuckets.getInstance(), new Runnable() {
new BukkitRunnable() {
@Override
public void run() {
if (blocksUp >= epicBuckets.getConfigManager().getMaxVerticalHeight()) {
epicBuckets.getGenbucketManager().unregisterGenbucketForPlayer(getOwner(), getGenUUID());
cancel();
}
fixHole(getNextBlock());
blocksUp++;
}
}, 0, epicBuckets.getConfigManager().getDelay());
}.runTaskTimer(EpicBuckets.getInstance(), 0, epicBuckets.getConfigManager().getDelay());
}
}