mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-25 20:25:16 +01:00
Fixes warning about already existing file saving. (#2260)
Spigot JavaPlugin#saveResources either replaces or complains that replacement is disabled. So it is necessary to check if file does not exists before saving it. Fixes #2259
This commit is contained in:
parent
caade1a71c
commit
fc658ca073
@ -1,5 +1,7 @@
|
||||
package world.bentobox.bentobox;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -464,9 +466,16 @@ public class BentoBox extends JavaPlugin implements Listener {
|
||||
return false;
|
||||
}
|
||||
|
||||
log("Saving default panels...");
|
||||
this.saveResource("panels/island_creation_panel.yml", false);
|
||||
this.saveResource("panels/language_panel.yml", false);
|
||||
if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "island_creation_panel.yml"))) {
|
||||
log("Saving default island_creation_panel...");
|
||||
this.saveResource("panels/island_creation_panel.yml", false);
|
||||
}
|
||||
|
||||
if (!Files.exists(Path.of(this.getDataFolder().getPath(), "panels", "language_panel.yml"))) {
|
||||
log("Saving default language_panel...");
|
||||
this.saveResource("panels/language_panel.yml", false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user