1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-29 04:18:07 +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,
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
public boolean jobsshopenabled;
public boolean DailyQuestsEnabled;
@ -273,11 +273,24 @@ public class GeneralConfigManager {
// Load locale
Jobs.getLanguageManager().load();
// title settings
Jobs.getTitleManager().load();
try {
Jobs.getTitleManager().load();
} catch (Throwable e) {
e.printStackTrace();
}
// restricted areas
Jobs.getRestrictedAreaManager().load();
try {
Jobs.getRestrictedAreaManager().load();
} catch (Throwable e) {
e.printStackTrace();
}
// restricted blocks
Jobs.getRestrictedBlockManager().load();
try {
Jobs.getRestrictedBlockManager().load();
} catch (Throwable e) {
e.printStackTrace();
}
// Item/Block/mobs name list
Jobs.getNameTranslatorManager().load();
// signs information
@ -426,7 +439,7 @@ public class GeneralConfigManager {
c.addComment("DailyQuests.Enabled", "Enables or disables daily quests");
DailyQuestsEnabled = c.get("DailyQuests.Enabled", true);
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");
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");
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.");
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");
preventShopItemEnchanting = c.get("prevent-shop-item-enchanting", true);
c.addComment("jobs-shop-enabled", "Enables or disables jobs shop");
jobsshopenabled = c.get("jobs-shop-enabled", true);

View File

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

View File

@ -3,6 +3,7 @@ package com.gamingmesh.jobs.stuff;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@ -63,6 +64,12 @@ public final class Util {
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) {
if (Version.isCurrentEqualOrHigher(Version.v1_11_R1)) {
return entity.getType().name();