mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-03-16 06:49:45 +01:00
36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package com.gmail.nossr50.config.mods;
|
|
|
|
import java.io.File;
|
|
import java.util.regex.Pattern;
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
import com.gmail.nossr50.util.ModManager;
|
|
|
|
public class BlockConfigManager {
|
|
public BlockConfigManager(mcMMO plugin) {
|
|
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
|
Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
|
|
File dataFolder = new File(mcMMO.getModDirectory());
|
|
File vanilla = new File(dataFolder, "blocks.default.yml");
|
|
ModManager modManager = mcMMO.getModManager();
|
|
|
|
if (!vanilla.exists()) {
|
|
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
|
}
|
|
|
|
for (String fileName : dataFolder.list()) {
|
|
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
|
|
continue;
|
|
}
|
|
|
|
File file = new File(dataFolder, fileName);
|
|
|
|
if (file.isDirectory()) {
|
|
continue;
|
|
}
|
|
|
|
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
|
|
}
|
|
}
|
|
}
|