Changes code to account for KnarLib changes
This commit is contained in:
parent
c03e06b132
commit
c33520d8f2
@ -8,7 +8,6 @@ import net.knarcraft.dynmapcitizens.handler.trait.MinstrelHandler;
|
||||
import net.knarcraft.dynmapcitizens.handler.trait.SentinelHandler;
|
||||
import net.knarcraft.dynmapcitizens.handler.trait.quests.QuestsHandler;
|
||||
import net.knarcraft.dynmapcitizens.settings.GlobalSettings;
|
||||
import net.knarcraft.knarlib.KnarLib;
|
||||
import net.knarcraft.knarlib.formatting.TranslatableTimeUnit;
|
||||
import net.knarcraft.knarlib.formatting.Translator;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -26,6 +25,7 @@ import java.util.logging.Level;
|
||||
public final class DynmapCitizens extends JavaPlugin {
|
||||
|
||||
private static DynmapCitizens instance;
|
||||
private static Translator translator;
|
||||
private DynmapAPI dynmapAPI;
|
||||
private VaultHandler vaultHandler;
|
||||
private GlobalSettings globalSettings;
|
||||
@ -34,7 +34,6 @@ public final class DynmapCitizens extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
DynmapCitizens.instance = this;
|
||||
KnarLib.setPlugin(this);
|
||||
|
||||
//Initialize quest and dynmap APIs
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
@ -56,9 +55,10 @@ public final class DynmapCitizens extends JavaPlugin {
|
||||
this.globalSettings.load(configuration);
|
||||
|
||||
//Load all messages
|
||||
Translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND);
|
||||
Translator.registerMessageCategory(DynmapCitizensTranslatableMessage.SENTINEL_DESCRIPTION);
|
||||
Translator.loadLanguages("en");
|
||||
translator = new Translator();
|
||||
translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND);
|
||||
translator.registerMessageCategory(DynmapCitizensTranslatableMessage.SENTINEL_DESCRIPTION);
|
||||
translator.loadLanguages(this.getDataFolder(), "en");
|
||||
|
||||
//Initialize all enabled traits
|
||||
initializeTraitHandlers(configuration);
|
||||
@ -80,6 +80,15 @@ public final class DynmapCitizens extends JavaPlugin {
|
||||
//TODO: Perhaps remove icons, just in case?
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the translator to use for translation
|
||||
*
|
||||
* @return <p>The translator to use</p>
|
||||
*/
|
||||
public static Translator getTranslator() {
|
||||
return translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the global settings for this plugin
|
||||
*
|
||||
|
@ -2,6 +2,7 @@ package net.knarcraft.dynmapcitizens.handler.trait.quests;
|
||||
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.Planner;
|
||||
import net.knarcraft.dynmapcitizens.DynmapCitizens;
|
||||
import net.knarcraft.knarlib.formatting.TimeFormatter;
|
||||
|
||||
import java.text.DateFormat;
|
||||
@ -37,7 +38,8 @@ public class QuestPlannerInfoGenerator {
|
||||
//Quest can be repeated after a cool-down
|
||||
if (planner.hasCooldown()) {
|
||||
plannerInfo.append("<li>Quest repeatable after: ");
|
||||
plannerInfo.append(TimeFormatter.getDurationString(planner.getCooldown() / 1000));
|
||||
plannerInfo.append(TimeFormatter.getDurationString(DynmapCitizens.getTranslator(),
|
||||
planner.getCooldown() / 1000));
|
||||
plannerInfo.append("</li>");
|
||||
} else {
|
||||
plannerInfo.append("<li>Quest cannot be repeated!</li>");
|
||||
@ -58,7 +60,8 @@ public class QuestPlannerInfoGenerator {
|
||||
//Quest availability repeats
|
||||
if (planner.hasRepeat()) {
|
||||
plannerInfo.append("<li>Quest will become available again after ");
|
||||
plannerInfo.append(TimeFormatter.getDurationString(planner.getRepeat() / 1000)).append("</li>");
|
||||
plannerInfo.append(TimeFormatter.getDurationString(DynmapCitizens.getTranslator(),
|
||||
planner.getRepeat() / 1000)).append("</li>");
|
||||
}
|
||||
|
||||
plannerInfo.append("</ul>");
|
||||
|
Loading…
Reference in New Issue
Block a user