2018-12-04 23:24:24 +01:00
|
|
|
package com.songoda.epicbuckets.genbucket.types;
|
|
|
|
|
|
|
|
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.block.Block;
|
|
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
import org.bukkit.entity.Player;
|
2018-12-05 02:13:17 +01:00
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
2018-12-04 23:24:24 +01:00
|
|
|
|
|
|
|
public class PsuedoVertical extends Genbucket {
|
|
|
|
|
2018-12-05 02:13:17 +01:00
|
|
|
private int blocksUp = 0;
|
|
|
|
|
2018-12-04 23:24:24 +01:00
|
|
|
public PsuedoVertical(Player owner, Block clickedBlock, BlockFace blockFace, SubShop s) {
|
|
|
|
super(GenbucketType.PSUEDO, clickedBlock, blockFace, s, owner);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void generate() {
|
2018-12-11 19:47:21 +01:00
|
|
|
BukkitRunnable runnable = new BukkitRunnable() {
|
2018-12-04 23:24:24 +01:00
|
|
|
@Override
|
|
|
|
public void run() {
|
2018-12-06 01:32:12 +01:00
|
|
|
if (isBelowVoid(blocksUp) || blocksUp >= epicBuckets.getConfigManager().getMaxVerticalHeight()) {
|
2018-12-05 02:13:17 +01:00
|
|
|
epicBuckets.getGenbucketManager().unregisterGenbucketForPlayer(getOwner(), getGenUUID());
|
|
|
|
cancel();
|
2018-12-07 01:09:19 +01:00
|
|
|
return;
|
2018-12-05 02:13:17 +01:00
|
|
|
}
|
|
|
|
fixHole(getNextBlock());
|
|
|
|
blocksUp++;
|
2018-12-04 23:24:24 +01:00
|
|
|
}
|
2018-12-11 19:47:21 +01:00
|
|
|
};
|
|
|
|
setGeneration(runnable.runTaskTimer(EpicBuckets.getInstance(), 0, epicBuckets.getConfigManager().getDelay()));
|
2018-12-04 23:24:24 +01:00
|
|
|
}
|
|
|
|
}
|