mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Move language stuff to its own file
This commit is contained in:
1 parent
69375bbd33
commit
7124585602
17 files changed
+93
-73
No files matched your search
@@ -40,6 +40,7 @@ public final class CarbonChat extends JavaPlugin {
|
||||
private ItemStackUtils itemStackUtils;
|
||||
|
||||
private YamlConfiguration modConfig;
|
||||
private YamlConfiguration languageConfig;
|
||||
|
||||
public static final LegacyComponentSerializer LEGACY =
|
||||
LegacyComponentSerializer.builder().extractUrls().character('§').build();
|
||||
@@ -47,8 +48,17 @@ public final class CarbonChat extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Ensure config is present to be modified by the user
|
||||
saveDefaultConfig();
|
||||
saveResource("moderation.yml", false);
|
||||
if (!(new File(getDataFolder(), "config.yml").exists())) {
|
||||
saveDefaultConfig();
|
||||
}
|
||||
|
||||
if (!(new File(getDataFolder(), "moderation.yml").exists())) {
|
||||
saveResource("moderation.yml", false);
|
||||
}
|
||||
|
||||
if (!(new File(getDataFolder(), "language.yml").exists())) {
|
||||
saveResource("language.yml", false);
|
||||
}
|
||||
|
||||
modConfig = new YamlConfiguration();
|
||||
|
||||
@@ -58,6 +68,14 @@ public final class CarbonChat extends JavaPlugin {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
languageConfig = new YamlConfiguration();
|
||||
|
||||
try {
|
||||
languageConfig.load(new File(getDataFolder(), "language.yml"));
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Setup Adventure
|
||||
adventureManager = new AdventureManager(this);
|
||||
|
||||
@@ -147,6 +165,10 @@ public final class CarbonChat extends JavaPlugin {
|
||||
return modConfig;
|
||||
}
|
||||
|
||||
public YamlConfiguration getLanguage() {
|
||||
return languageConfig;
|
||||
}
|
||||
|
||||
public Permission getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user