1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-31 21:37:57 +01:00

Lets keep loading in plugin when some none essential files fail to load

This commit is contained in:
Zrips 2023-08-29 15:18:05 +03:00
parent 6051c78d21
commit 14b7e837d8
3 changed files with 29 additions and 9 deletions

View File

@ -111,7 +111,7 @@ public class GeneralConfigManager {
DisabledWorldsUse, UseAsWhiteListWorldList, MythicMobsEnabled, DisabledWorldsUse, UseAsWhiteListWorldList, MythicMobsEnabled,
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false, LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting; payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
public boolean jobsshopenabled; public boolean jobsshopenabled;
public boolean DailyQuestsEnabled; public boolean DailyQuestsEnabled;
@ -273,11 +273,24 @@ public class GeneralConfigManager {
// Load locale // Load locale
Jobs.getLanguageManager().load(); Jobs.getLanguageManager().load();
// title settings // title settings
Jobs.getTitleManager().load(); try {
Jobs.getTitleManager().load();
} catch (Throwable e) {
e.printStackTrace();
}
// restricted areas // restricted areas
Jobs.getRestrictedAreaManager().load(); try {
Jobs.getRestrictedAreaManager().load();
} catch (Throwable e) {
e.printStackTrace();
}
// restricted blocks // restricted blocks
Jobs.getRestrictedBlockManager().load(); try {
Jobs.getRestrictedBlockManager().load();
} catch (Throwable e) {
e.printStackTrace();
}
// Item/Block/mobs name list // Item/Block/mobs name list
Jobs.getNameTranslatorManager().load(); Jobs.getNameTranslatorManager().load();
// signs information // signs information
@ -426,7 +439,7 @@ public class GeneralConfigManager {
c.addComment("DailyQuests.Enabled", "Enables or disables daily quests"); c.addComment("DailyQuests.Enabled", "Enables or disables daily quests");
DailyQuestsEnabled = c.get("DailyQuests.Enabled", true); DailyQuestsEnabled = c.get("DailyQuests.Enabled", true);
c.addComment("DailyQuests.ResetTime", "Defines time in 24hour format when we want to give out new daily quests", c.addComment("DailyQuests.ResetTime", "Defines time in 24hour format when we want to give out new daily quests",
"Any daily quests given before reset will be invalid and new ones will be given out"); "Any daily quests given before reset will be invalid and new ones will be given out");
ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4); ResetTimeHour = c.get("DailyQuests.ResetTime.Hour", 4);
@ -445,7 +458,7 @@ public class GeneralConfigManager {
c.addComment("max-jobs", "Maximum number of jobs a player can join.", "Use -1 to disable limitations", "Keep in mind that jobs.max.[amount] will bypass this setting"); c.addComment("max-jobs", "Maximum number of jobs a player can join.", "Use -1 to disable limitations", "Keep in mind that jobs.max.[amount] will bypass this setting");
maxJobs = c.get("max-jobs", 3); maxJobs = c.get("max-jobs", 3);
c.addComment("disable-payment-if-max-level-reached", "Disabling the payment if the user reached the maximum level of a job."); c.addComment("disable-payment-if-max-level-reached", "Disabling the payment if the user reached the maximum level of a job.");
disablePaymentIfMaxLevelReached = c.get("disable-payment-if-max-level-reached", false); disablePaymentIfMaxLevelReached = c.get("disable-payment-if-max-level-reached", false);
@ -457,7 +470,7 @@ public class GeneralConfigManager {
c.addComment("prevent-shop-item-enchanting", "Prevent players to enchant items from the shop in the anvil with enchanted books"); c.addComment("prevent-shop-item-enchanting", "Prevent players to enchant items from the shop in the anvil with enchanted books");
preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true); preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true);
c.addComment("jobs-shop-enabled", "Enables or disables jobs shop"); c.addComment("jobs-shop-enabled", "Enables or disables jobs shop");
jobsshopenabled = c.get("jobs-shop-enabled", true); jobsshopenabled = c.get("jobs-shop-enabled", true);

View File

@ -237,7 +237,7 @@ public class Job {
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty) if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty)
now = Jobs.getGCManager().DynamicPaymentMaxPenalty; now = Jobs.getGCManager().DynamicPaymentMaxPenalty;
if (Double.isNaN(now)) if (Double.isNaN(now))
now = 0; now = 0;
@ -310,7 +310,7 @@ public class Job {
}; };
String shortActionName = CMIMaterial.getGeneralMaterialName(action.getName()); String shortActionName = CMIMaterial.getGeneralMaterialName(action.getName());
for (JobInfo info : getJobInfo(action.getType())) { for (JobInfo info : getJobInfo(action.getType())) {
if (condition.test(info, action)) { if (condition.test(info, action)) {
if (!info.isInLevelRange(level)) { if (!info.isInLevelRange(level)) {

View File

@ -3,6 +3,7 @@ package com.gamingmesh.jobs.stuff;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
@ -63,6 +64,12 @@ public final class Util {
return blocks; return blocks;
} }
private final static DecimalFormat dcf = new DecimalFormat("##.##");
public static String format2Decimals(double number) {
return dcf.format(number);
}
public static String getRealType(Entity entity) { public static String getRealType(Entity entity) {
if (Version.isCurrentEqualOrHigher(Version.v1_11_R1)) { if (Version.isCurrentEqualOrHigher(Version.v1_11_R1)) {
return entity.getType().name(); return entity.getType().name();