mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 11:45:31 +01:00
Added comments to DeleteIslandChunks
I've also added a sonar suppresswarning to avoid the "issues" when calling regenerateChunk
This commit is contained in:
parent
044c67ea28
commit
7fd6237280
@ -12,7 +12,6 @@ import world.bentobox.bentobox.database.objects.IslandDeletion;
|
||||
* Deletes islands fast using chunk regeneration
|
||||
*
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class DeleteIslandChunks {
|
||||
|
||||
@ -24,18 +23,19 @@ public class DeleteIslandChunks {
|
||||
private int z;
|
||||
private BukkitTask task;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "squid:CallToDeprecatedMethod"})
|
||||
public DeleteIslandChunks(BentoBox plugin, IslandDeletion di) {
|
||||
// Fire event
|
||||
IslandEvent.builder().deletedIslandInfo(di).reason(Reason.DELETE_CHUNKS).build();
|
||||
x = di.getMinXChunk();
|
||||
z = di.getMinZChunk();
|
||||
// Run through all chunks of the islands and regenerate them.
|
||||
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
|
||||
for (int i = 0; i < SPEED; i++) {
|
||||
// World#regenerateChunk(int, int) from Bukkit is deprecated because it may not regenerate decoration correctly
|
||||
di.getWorld().regenerateChunk(x, z);
|
||||
if (plugin.getIWM().isNetherGenerate(di.getWorld()) && plugin.getIWM().isNetherIslands(di.getWorld())) {
|
||||
plugin.getIWM().getNetherWorld(di.getWorld()).regenerateChunk(x, z);
|
||||
|
||||
}
|
||||
if (plugin.getIWM().isEndGenerate(di.getWorld()) && plugin.getIWM().isEndIslands(di.getWorld())) {
|
||||
plugin.getIWM().getEndWorld(di.getWorld()).regenerateChunk(x, z);
|
||||
@ -45,6 +45,7 @@ public class DeleteIslandChunks {
|
||||
z = di.getMinZChunk();
|
||||
x++;
|
||||
if (x > di.getMaxXChunk()) {
|
||||
// We're done
|
||||
task.cancel();
|
||||
// Fire event
|
||||
IslandEvent.builder().deletedIslandInfo(di).reason(Reason.DELETED).build();
|
||||
@ -52,7 +53,5 @@ public class DeleteIslandChunks {
|
||||
}
|
||||
}
|
||||
}, 0L, 1L);
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user