Skip to content

Commit

Permalink
Small refactor to reduce complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Jul 23, 2023
1 parent 8ae3635 commit 7310537
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,7 @@ private void process(@NonNull Cancellable e, @NonNull Island i, @Nullable Player
String originalPhase = is.getPhaseName();
// Check for a goto
if (Objects.requireNonNull(phase).getGotoBlock() != null) {
int gotoBlock = phase.getGotoBlock();
phase = oneBlocksManager.getPhase(gotoBlock);
// Store lifetime
is.setLifetime(is.getLifetime() + gotoBlock);
// Set current block
is.setBlockNumber(gotoBlock);

handleGoto(is, phase);
}
// Check for new phase and run commands if required
boolean newPhase = check.checkPhase(player, i, is, Objects.requireNonNull(phase));
Expand Down Expand Up @@ -355,6 +349,15 @@ private void process(@NonNull Cancellable e, @NonNull Island i, @Nullable Player
is.incrementBlockNumber();
}

private void handleGoto(OneBlockIslands is, OneBlockPhase phase) {
int gotoBlock = phase.getGotoBlock();
phase = oneBlocksManager.getPhase(gotoBlock);
// Store lifetime
is.setLifetime(is.getLifetime() + gotoBlock);
// Set current block
is.setBlockNumber(gotoBlock);
}

private void setBiome(@NonNull Block block, @Nullable Biome biome) {
if (biome == null) {
return;
Expand Down

0 comments on commit 7310537

Please sign in to comment.