mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-05 02:19:37 +01:00
Fix some issues with the purge command
This commit is contained in:
parent
d7eb9e8083
commit
5624c5f216
@ -790,12 +790,20 @@ public int purgeCommand(CommandContext<S> context) {
|
||||
plugin.getRenderManager().scheduleRenderTaskNext(purgeTask);
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "Created new Task to purge map '" + map.getId() + "'"));
|
||||
|
||||
// reset the map and start updating it after the purge
|
||||
RenderTask updateTask = new MapUpdateTask(map);
|
||||
plugin.getRenderManager().scheduleRenderTask(updateTask);
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "Created new Update-Task for map '" + map.getId() + "'"));
|
||||
source.sendMessage(Text.of(TextColor.GRAY, "If you don't want this map to render again after the purge, use ",
|
||||
TextColor.DARK_GRAY, "/bluemap freeze " + map.getId(), TextColor.GRAY, " first!"));
|
||||
// cancel task if currently rendering the same map
|
||||
RenderTask currentRenderTask = plugin.getRenderManager().getCurrentRenderTask();
|
||||
if (currentRenderTask instanceof MapUpdateTask && ((MapUpdateTask) currentRenderTask).getMap().getId().equals(map.getId())) {
|
||||
currentRenderTask.cancel();
|
||||
}
|
||||
|
||||
// start updating the map after the purge
|
||||
if (plugin.getPluginState().getMapState(map).isUpdateEnabled()) {
|
||||
RenderTask updateTask = new MapUpdateTask(map);
|
||||
plugin.getRenderManager().scheduleRenderTask(updateTask);
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "Created new Update-Task for map '" + map.getId() + "'"));
|
||||
source.sendMessage(Text.of(TextColor.GRAY, "If you don't want this map to render again after the purge, use ",
|
||||
TextColor.DARK_GRAY, "/bluemap freeze " + map.getId(), TextColor.GRAY, " first!"));
|
||||
}
|
||||
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "Use ", TextColor.GRAY, "/bluemap", TextColor.GREEN, " to see the progress."));
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
|
@ -91,6 +91,9 @@ public void doWork() throws Exception {
|
||||
}
|
||||
|
||||
try {
|
||||
// save lowres-tile-manager to clear/flush any buffered data
|
||||
this.map.getLowresTileManager().save();
|
||||
|
||||
// delete subFiles first to be able to track the progress and cancel
|
||||
while (!subFiles.isEmpty()) {
|
||||
Path subFile = subFiles.getLast();
|
||||
|
Loading…
Reference in New Issue
Block a user