mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-09-21 03:21:02 +02:00
Add verbose check to locale extractor
This commit is contained in:
parent
ac6caf62e1
commit
23499e7682
@ -58,7 +58,7 @@ public class PluginSettings implements SettingsHolder {
|
||||
"Submit your finalized config using https://bin.bloom.host/ and send it to us in https://discord.gg/crazycrew",
|
||||
""
|
||||
})
|
||||
public static final Property<String> LOCALE_FILE = newProperty("settings.locale-file", "en-US");
|
||||
public static final Property<String> LOCALE_FILE = newProperty("settings.locale-file", "en-US.yml");
|
||||
|
||||
@Comment("Whether you want to have verbose logging enabled or not.")
|
||||
public static final Property<Boolean> VERBOSE_LOGGING = newProperty("settings.verbose-logging", true);
|
||||
|
@ -22,18 +22,17 @@ public class FileUtils {
|
||||
* @param output the output wherever you use this.
|
||||
* @param replace if we should replace or not.
|
||||
*/
|
||||
public static void extract(String input, Path output, boolean replace) {
|
||||
public static void extract(String input, Path output, boolean replace, boolean verbose) {
|
||||
URL directory = FileUtils.class.getResource(input);
|
||||
|
||||
if (directory == null) CrazyLogger.debug("<#E0115F>Could not find <#11e092>" + input + " <#E0115F>in the jar.");
|
||||
if (directory == null) if (verbose) CrazyLogger.debug("<#E0115F>Could not find <#11e092>" + input + " <#E0115F>in the jar.");
|
||||
|
||||
assert directory != null;
|
||||
if (!directory.getProtocol().equals("jar"))
|
||||
CrazyLogger.debug("<#E0115F>Failed because the protocol does not equal .jar!");
|
||||
if (!directory.getProtocol().equals("jar")) if (verbose) CrazyLogger.debug("Failed because the protocol does not equal .jar!");
|
||||
|
||||
ZipFile jar;
|
||||
try {
|
||||
CrazyLogger.debug("<#E0115F>Starting to extract files from <#11e092>" + input + " <#E0115F>directory in the jar.");
|
||||
if (verbose) CrazyLogger.debug("<#E0115F>Starting to extract files from <#11e092>" + input + " <#E0115F>directory in the jar.");
|
||||
|
||||
jar = ((JarURLConnection) directory.openConnection()).getJarFile();
|
||||
} catch (Exception e) {
|
||||
@ -56,7 +55,7 @@ public class FileUtils {
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
if (exists) {
|
||||
CrazyLogger.debug("<#E0115F>File already exists.");
|
||||
if (verbose) CrazyLogger.debug("<#E0115F>File already exists.");
|
||||
|
||||
return;
|
||||
}
|
||||
@ -64,7 +63,7 @@ public class FileUtils {
|
||||
try {
|
||||
Files.createDirectories(outFile);
|
||||
|
||||
CrazyLogger.debug("<#E0115F>Directories have been created.");
|
||||
if (verbose) CrazyLogger.debug("<#E0115F>Directories have been created.");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import us.crazycrew.crazyauctions.configurations.ConfigSettings;
|
||||
import us.crazycrew.crazyauctions.configurations.LocaleSettings;
|
||||
import us.crazycrew.crazyauctions.configurations.PluginSettings;
|
||||
import us.crazycrew.crazyauctions.configurations.migrations.PluginMigrationService;
|
||||
import us.crazycrew.crazyauctions.utils.FileUtils;
|
||||
import us.crazycrew.crazycore.CrazyLogger;
|
||||
import us.crazycrew.crazycore.paper.PaperConsole;
|
||||
import us.crazycrew.crazycore.paper.PaperCore;
|
||||
@ -50,11 +51,6 @@ public class AuctionsStarter implements PluginBootstrap {
|
||||
.withYamlFile(new File(context.getDataDirectory().toFile(), "config.yml"))
|
||||
.configurationData(ConfigSettings.class)
|
||||
.create();
|
||||
|
||||
locale = SettingsManagerBuilder
|
||||
.withYamlFile(new File(context.getDataDirectory().toFile() + "/locale/", pluginConfig.getProperty(PluginSettings.LOCALE_FILE)))
|
||||
.configurationData(LocaleSettings.class)
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -74,6 +70,13 @@ public class AuctionsStarter implements PluginBootstrap {
|
||||
// Add the logger manager.
|
||||
LogManager.getLogManager().addLogger(CrazyLogger.getLogger());
|
||||
|
||||
FileUtils.extract("/locale", context.getDataDirectory(), false, getPluginConfig().getProperty(PluginSettings.VERBOSE_LOGGING));
|
||||
|
||||
locale = SettingsManagerBuilder
|
||||
.withYamlFile(new File(context.getDataDirectory().toFile() + "/locale/", pluginConfig.getProperty(PluginSettings.LOCALE_FILE)))
|
||||
.configurationData(LocaleSettings.class)
|
||||
.create();
|
||||
|
||||
return new CrazyAuctions(this.paperCore);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user