diff --git a/src/main/java/world/bentobox/aoneblock/AOneBlock.java b/src/main/java/world/bentobox/aoneblock/AOneBlock.java index f022585..574ad1b 100644 --- a/src/main/java/world/bentobox/aoneblock/AOneBlock.java +++ b/src/main/java/world/bentobox/aoneblock/AOneBlock.java @@ -69,6 +69,7 @@ private boolean loadSettings() { public void onEnable(){ try { oneBlockManager = new OneBlocksManager(this); + oneBlockManager.loadPhases(); listener = new BlockListener(this); registerListener(listener); registerListener(new NoBlockHandler(this)); diff --git a/src/main/java/world/bentobox/aoneblock/dataobjects/OneBlockIslands.java b/src/main/java/world/bentobox/aoneblock/dataobjects/OneBlockIslands.java index c783f1c..d4b9501 100644 --- a/src/main/java/world/bentobox/aoneblock/dataobjects/OneBlockIslands.java +++ b/src/main/java/world/bentobox/aoneblock/dataobjects/OneBlockIslands.java @@ -22,6 +22,8 @@ public class OneBlockIslands implements DataObject { @Expose private int blockNumber; @Expose + private long lifetime; + @Expose private String phaseName = ""; private List queue; @@ -119,5 +121,19 @@ public void clearQueue() { queue.clear(); } + /** + * @return the loops + */ + public long getLifetime() { + return lifetime; + } + + /** + * @param loops the loops to set + */ + public void setLifetime(long loops) { + this.lifetime = loops; + } + } diff --git a/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java b/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java index 90c0958..62b834c 100644 --- a/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java +++ b/src/main/java/world/bentobox/aoneblock/listeners/BlockListener.java @@ -234,8 +234,13 @@ private void process(Cancellable e, Island i, @NonNull Player player) { OneBlockPhase phase = oneBlocksManager.getPhase(is.getBlockNumber()); // Check for a goto if (phase.getGotoBlock() != null) { - phase = oneBlocksManager.getPhase(phase.getGotoBlock()); - is.setBlockNumber(phase.getGotoBlock()); + int gotoBlock = phase.getGotoBlock(); + phase = oneBlocksManager.getPhase(gotoBlock); + // Store lifetime + is.setLifetime(is.getLifetime() + is.getBlockNumber()); + // Set current block + is.setBlockNumber(gotoBlock); + } // Announce the phase boolean newPhase = false;