mirror of
https://github.com/songoda/EpicBuckets.git
synced 2024-11-13 05:45:16 +01:00
PsuedoVertical done
This commit is contained in:
parent
462e4bad1a
commit
3d1090201e
@ -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());
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user