mirror of
https://github.com/SydMontague/ImageMaps.git
synced 2024-11-22 18:35:20 +01:00
only warn once for each file that isn't found
This commit is contained in:
parent
abd3c93574
commit
95c08f5e52
@ -5,9 +5,11 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@ -222,6 +224,7 @@ public class ImageMaps extends JavaPlugin implements Listener {
|
||||
private void loadMaps() {
|
||||
File file = new File(getDataFolder(), "maps.yml");
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
Set<String> warnedFilenames=new HashSet<>();
|
||||
|
||||
for (String key : config.getKeys(false)) {
|
||||
int id = Integer.parseInt(key);
|
||||
@ -242,7 +245,10 @@ public class ImageMaps extends JavaPlugin implements Listener {
|
||||
BufferedImage bimage = loadImage(image);
|
||||
|
||||
if (bimage == null) {
|
||||
if (!warnedFilenames.contains(image)) {
|
||||
warnedFilenames.add(image);
|
||||
getLogger().warning(() -> "Image file " + image + " not found, removing this map!");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user