Skip to content

Commit 4642438

Browse files
author
IanTapply22
committed
Fix warning messages of config file already existing
1 parent 0665d74 commit 4642438

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/main/java/net/jeqo/bloons/balloon/BalloonCore.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.jeqo.bloons.configuration.ConfigConfiguration;
99
import org.bukkit.plugin.java.JavaPlugin;
1010

11+
import java.io.File;
1112
import java.util.ArrayList;
1213

1314
/**
@@ -65,10 +66,20 @@ public void initialize() {
6566
* Copies the example balloons folder to the plugin's data folder if it doesn't exist
6667
*/
6768
public void copyExampleBalloons() {
69+
// List of example balloon files
70+
String[] exampleBalloons = new String[] {
71+
"/color_pack_example.yml",
72+
"/dyeable_example.yml",
73+
"/multipart_example.yml"
74+
};
75+
6876
// Save all example files in the balloons folder in /resources
69-
Bloons.getInstance().saveResource(ConfigConfiguration.BALLOON_CONFIGURATION_FOLDER + "/color_pack_example.yml", false);
70-
Bloons.getInstance().saveResource(ConfigConfiguration.BALLOON_CONFIGURATION_FOLDER + "/dyeable_example.yml", false);
71-
Bloons.getInstance().saveResource(ConfigConfiguration.BALLOON_CONFIGURATION_FOLDER + "/multipart_example.yml", false);
77+
for (String example : exampleBalloons) {
78+
File file = new File(Bloons.getInstance().getDataFolder() + File.separator + ConfigConfiguration.BALLOON_CONFIGURATION_FOLDER + example);
79+
if (file.exists()) continue;
80+
81+
Bloons.getInstance().saveResource(ConfigConfiguration.BALLOON_CONFIGURATION_FOLDER + example, false);
82+
}
7283
}
7384

7485
/**

0 commit comments

Comments
 (0)