Updates code to account for KnarLib changes
This commit is contained in:
@ -13,7 +13,7 @@ import net.knarcraft.blacksmith.listener.NPCClickListener;
|
||||
import net.knarcraft.blacksmith.listener.PlayerListener;
|
||||
import net.knarcraft.blacksmith.manager.EconomyManager;
|
||||
import net.knarcraft.blacksmith.trait.BlacksmithTrait;
|
||||
import net.knarcraft.knarlib.KnarLib;
|
||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||
import net.knarcraft.knarlib.formatting.TranslatableTimeUnit;
|
||||
import net.knarcraft.knarlib.formatting.Translator;
|
||||
import net.knarcraft.knarlib.util.UpdateChecker;
|
||||
@ -32,6 +32,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
private static BlacksmithPlugin instance;
|
||||
private GlobalSettings config;
|
||||
private static Translator translator;
|
||||
private static StringFormatter stringFormatter;
|
||||
|
||||
/**
|
||||
* Gets an instance of the Blacksmith plugin
|
||||
@ -57,7 +58,7 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
public void reload() {
|
||||
config.load();
|
||||
this.reloadConfig();
|
||||
translator.loadLanguages(this.getConfig().getString("language", "en"));
|
||||
translator.loadLanguages(this.getDataFolder(), this.getConfig().getString("language", "en"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,6 +70,15 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
return BlacksmithPlugin.translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string formatter to use for formatting
|
||||
*
|
||||
* @return <p>The string formatter to use</p>
|
||||
*/
|
||||
public static StringFormatter getStringFormatter() {
|
||||
return BlacksmithPlugin.stringFormatter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
getLogger().log(Level.INFO, " v" + getDescription().getVersion() + " disabled.");
|
||||
@ -77,7 +87,6 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
KnarLib.setPlugin(this);
|
||||
|
||||
//Copy default config to disk
|
||||
FileConfiguration fileConfiguration = this.getConfig();
|
||||
@ -94,7 +103,8 @@ public class BlacksmithPlugin extends JavaPlugin {
|
||||
translator = new Translator();
|
||||
translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND);
|
||||
translator.registerMessageCategory(BlacksmithTranslatableMessage.ITEM_TYPE_ENCHANTMENT);
|
||||
translator.loadLanguages(fileConfiguration.getString("language", "en"));
|
||||
translator.loadLanguages(this.getDataFolder(), fileConfiguration.getString("language", "en"));
|
||||
BlacksmithPlugin.stringFormatter = new StringFormatter(this.getDescription().getPrefix(), translator);
|
||||
|
||||
//Set up Vault integration
|
||||
if (!setUpVault()) {
|
||||
|
Reference in New Issue
Block a user