Skip to content

Commit

Permalink
Add ability to disable chunkRefresh method via config option.
Browse files Browse the repository at this point in the history
Apparently, chunkRefresh creates issues with Holographic Display plugin.
  • Loading branch information
BONNe committed Feb 6, 2022
1 parent 5946217 commit c3c9aa5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/main/java/world/bentobox/biomes/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,28 @@ public void setUseBankAccount(boolean useBankAccount)
}


/**
* Is use chunk refresh boolean.
*
* @return the boolean
*/
public boolean isUseChunkRefresh()
{
return useChunkRefresh;
}


/**
* Sets use chunk refresh.
*
* @param useChunkRefresh the use chunk refresh
*/
public void setUseChunkRefresh(boolean useChunkRefresh)
{
this.useChunkRefresh = useChunkRefresh;
}


// ---------------------------------------------------------------------
// Section: Enums used for Settings.
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -495,6 +517,17 @@ public static UpdateMode getMode(String parameter)
@SuppressWarnings("javadoc")
private int concurrentBiomeUpdates = 1;


@ConfigComment("")
@ConfigComment("Allows toggling if Biomes Addon should refresh chunks, so players could get biome instantly.")
@ConfigComment("Otherwise, biome will be updated after chunk is unloaded (player leaves the area).")
@ConfigComment("Be aware, not all plugins and clients supports this feature. If you get error after biome")
@ConfigComment("updates, please disable this feature.")
@ConfigComment("Default value = true")
@ConfigEntry(path = "use-chunk-refresh")
@SuppressWarnings("javadoc")
private boolean useChunkRefresh = true;

@ConfigComment("Player main sub-command to access the addon.")
@ConfigComment("This command label will be required to write after gamemode player command label, f.e. /[label] biomes")
@ConfigComment("Each alias must be separated with an empty space.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ private void runBiomeChange(ChunkData chunkData, Chunk chunk, CompletableFuture<
}
}

chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
if (this.addon.getSettings().isUseChunkRefresh())
{
chunk.getWorld().refreshChunk(chunk.getX(), chunk.getZ());
}

completed.complete(true);
}

Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ biome-change-timeout: 5
# completely.
# Default value = 1
parallel-biome-changes: 1
#
# Allows toggling if Biomes Addon should refresh chunks, so players could get biome instantly.
# Otherwise, biome will be updated after chunk is unloaded (player leaves the area).
# Be aware, not all plugins and clients supports this feature. If you get error after biome
# updates, please disable this feature.
# Default value = true
use-chunk-refresh: true
commands:
player:
# Player main sub-command to access the addon.
Expand Down

0 comments on commit c3c9aa5

Please sign in to comment.