Adds a delete speed option to BentoBox's config.yml

Reduces the chunk regen speed to 1 chunk per tick or 3 chunks/tick if
there is a nether and end world.
This commit is contained in:
tastybento 2019-08-31 17:13:19 -07:00
parent 2f35a6c77c
commit f9a5f05987
3 changed files with 31 additions and 2 deletions

View File

@ -167,6 +167,14 @@ public class Settings implements ConfigObject {
@ConfigEntry(path = "island.paste-speed")
private int pasteSpeed = 1000;
@ConfigComment("Number of chunks per world to regenerate per tick. If there is a nether and end then")
@ConfigComment("3x this number will be regenerated")
@ConfigComment("Smaller values will help reduce noticeable lag but will make deleting take longer.")
@ConfigComment("A setting of 0 will leave island blocks (not recommended).")
@ConfigEntry(path = "island.delete-speed")
private int deleteSpeed = 5;
// Automated ownership transfer
@ConfigComment("Toggles the automated ownership transfer.")
@ConfigComment("It automatically transfers the ownership of an island to one of its members in case the current owner is inactive.")
@ -428,6 +436,22 @@ public class Settings implements ConfigObject {
return this.pasteSpeed;
}
/**
* @return the deleteSpeed
* @since 1.7.0
*/
public int getDeleteSpeed() {
return deleteSpeed;
}
/**
* @param deleteSpeed the deleteSpeed to set
* @since 1.7.0
*/
public void setDeleteSpeed(int deleteSpeed) {
this.deleteSpeed = deleteSpeed;
}
public boolean isEnableAutoOwnershipTransfer() {
return enableAutoOwnershipTransfer;
}

View File

@ -28,7 +28,6 @@ public class DeleteIslandChunks {
/**
* This is how many chunks per world will be done in one tick.
*/
private static final int SPEED = 5;
private int chunkX;
private int chunkZ;
private BukkitTask task;
@ -37,12 +36,13 @@ public class DeleteIslandChunks {
public DeleteIslandChunks(BentoBox plugin, IslandDeletion di) {
// Fire event
IslandEvent.builder().deletedIslandInfo(di).reason(Reason.DELETE_CHUNKS).build();
this.chunkX = di.getMinXChunk();
this.chunkZ = di.getMinZChunk();
this.di = di;
// Run through all chunks of the islands and regenerate them.
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
for (int i = 0; i < SPEED; i++) {
for (int i = 0; i < plugin.getSettings().getDeleteSpeed(); i++) {
plugin.getIWM().getAddon(di.getWorld()).ifPresent(gm -> {
Chunk chunk = di.getWorld().getChunkAt(chunkX, chunkZ);
regenerateChunk(gm, chunk);

View File

@ -93,6 +93,11 @@ island:
# Number of blocks to paste per tick when pasting blueprints
# Smaller values will help reduce noticeable lag but will make pasting take longer
paste-speed: 1000
# Number of chunks per world to regenerate per tick. If there is a nether and end then
# 3x this number will be regenerated
# Smaller values will help reduce noticeable lag but will make deleting take longer.
# A setting of 0 will leave island blocks (not recommended).
delete-speed: 1
web:
# BentoBox uses bStats.org to get global data about the plugin to help improving it.
# bStats has nearly no effect on your server's performance and the sent data is completely