mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 15:03:36 +01:00
Better scheduler loading with better feedback messages on failure
This commit is contained in:
parent
3a2b60db89
commit
5e001047ad
@ -753,7 +753,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HookManager.loadHooks();
|
HookManager.loadHooks();
|
||||||
registerListeners();
|
registerListeners();
|
||||||
|
|
||||||
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3) && kyoriSupported) {
|
if (Version.isCurrentEqualOrHigher(Version.v1_16_R3) && kyoriSupported) {
|
||||||
complement = new Complement2();
|
complement = new Complement2();
|
||||||
@ -816,7 +816,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
// unregister all registered listeners by this plugin and register again
|
// unregister all registered listeners by this plugin and register again
|
||||||
if (!startup) {
|
if (!startup) {
|
||||||
HandlerList.unregisterAll(getInstance());
|
HandlerList.unregisterAll(getInstance());
|
||||||
registerListeners();
|
registerListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveTask != null) {
|
if (saveTask != null) {
|
||||||
@ -870,8 +870,12 @@ public final class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
// Schedule
|
// Schedule
|
||||||
if (getGCManager().enableSchedule) {
|
if (getGCManager().enableSchedule) {
|
||||||
getScheduleManager().load();
|
try {
|
||||||
getScheduleManager().start();
|
getScheduleManager().load();
|
||||||
|
getScheduleManager().start();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
getScheduleManager().cancel();
|
getScheduleManager().cancel();
|
||||||
}
|
}
|
||||||
@ -1501,7 +1505,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
.addHover(LC.info_pageCountHover.getLocale("[totalEntries]", totalEntries));
|
.addHover(LC.info_pageCountHover.getLocale("[totalEntries]", totalEntries));
|
||||||
|
|
||||||
rm.addText(pageCount > currentPage ? LC.info_nextPage.getLocale() : LC.info_nextPageOff.getLocale())
|
rm.addText(pageCount > currentPage ? LC.info_nextPage.getLocale() : LC.info_nextPageOff.getLocale())
|
||||||
.addHover(pageCount > currentPage ? LC.info_nextPageHover.getLocale(): LC.info_firstPageHover.getLocale())
|
.addHover(pageCount > currentPage ? LC.info_nextPageHover.getLocale() : LC.info_firstPageHover.getLocale())
|
||||||
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
|
.addCommand(pageCount > currentPage ? cmd + " " + pagePrefix + nextPage : cmd + " " + pagePrefix + 1);
|
||||||
|
|
||||||
if (pageCount != 0)
|
if (pageCount != 0)
|
||||||
|
@ -2,6 +2,7 @@ package com.gamingmesh.jobs.config;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,6 +20,8 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
|||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.Schedule;
|
import com.gamingmesh.jobs.container.Schedule;
|
||||||
|
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
|
|
||||||
public class ScheduleManager {
|
public class ScheduleManager {
|
||||||
|
|
||||||
private Jobs plugin;
|
private Jobs plugin;
|
||||||
@ -166,15 +169,37 @@ public class ScheduleManager {
|
|||||||
for (String oneSection : sections) {
|
for (String oneSection : sections) {
|
||||||
ConfigurationSection path = section.getConfigurationSection(oneSection);
|
ConfigurationSection path = section.getConfigurationSection(oneSection);
|
||||||
|
|
||||||
if (path == null || !path.getBoolean("Enabled") || !path.getString("From", "").contains(":")
|
if (path == null)
|
||||||
|| !path.getString("Until", "").contains(":") || !path.isList("Days") || !path.isList("Jobs"))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (!path.getBoolean("Enabled"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!path.getString("From", "").contains(":") ||
|
||||||
|
!path.getString("Until", "").contains(":") ||
|
||||||
|
!path.isList("Days") && !path.isString("Days") ||
|
||||||
|
!path.isList("Jobs") && !path.isString("Jobs")) {
|
||||||
|
|
||||||
|
Jobs.consoleMsg("&cIncorect scheduler format detected for " + oneSection + " scheduler!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Schedule sched = new Schedule();
|
Schedule sched = new Schedule();
|
||||||
|
|
||||||
sched.setName(oneSection);
|
sched.setName(oneSection);
|
||||||
sched.setDays(path.getStringList("Days"));
|
|
||||||
sched.setJobs(path.getStringList("Jobs"));
|
if (path.isString("Days")) {
|
||||||
|
sched.setDays(Arrays.asList(path.getString("Days")));
|
||||||
|
} else {
|
||||||
|
sched.setDays(path.getStringList("Days"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path.isString("Jobs")) {
|
||||||
|
sched.setJobs(Arrays.asList(path.getString("Jobs")));
|
||||||
|
} else {
|
||||||
|
sched.setJobs(path.getStringList("Jobs"));
|
||||||
|
}
|
||||||
|
|
||||||
sched.setFrom(Integer.parseInt(path.getString("From").replace(":", "")));
|
sched.setFrom(Integer.parseInt(path.getString("From").replace(":", "")));
|
||||||
sched.setUntil(Integer.parseInt(path.getString("Until").replace(":", "")));
|
sched.setUntil(Integer.parseInt(path.getString("Until").replace(":", "")));
|
||||||
|
|
||||||
@ -203,6 +228,6 @@ public class ScheduleManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!BOOSTSCHEDULE.isEmpty())
|
if (!BOOSTSCHEDULE.isEmpty())
|
||||||
Jobs.consoleMsg("&e[Jobs] Loaded " + BOOSTSCHEDULE.size() + " schedulers!");
|
Jobs.consoleMsg("&eLoaded " + BOOSTSCHEDULE.size() + " schedulers!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ public class HookManager {
|
|||||||
private static boolean setWorldGuard() {
|
private static boolean setWorldGuard() {
|
||||||
if (JobsHook.WorldGuard.isEnabled()) {
|
if (JobsHook.WorldGuard.isEnabled()) {
|
||||||
worldGuardManager = new WorldGuardManager();
|
worldGuardManager = new WorldGuardManager();
|
||||||
Jobs.consoleMsg("&e[Jobs] WorldGuard detected.");
|
Jobs.consoleMsg("&eWorldGuard detected.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +102,12 @@ public class HookManager {
|
|||||||
try {
|
try {
|
||||||
Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper");
|
Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper");
|
||||||
MythicManager = new MythicMobs4(PLUGIN);
|
MythicManager = new MythicMobs4(PLUGIN);
|
||||||
Jobs.consoleMsg("&e[Jobs] MythicMobs 4.x detected.");
|
Jobs.consoleMsg("&eMythicMobs 4.x detected.");
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
try {
|
try {
|
||||||
Class.forName("io.lumine.mythic.bukkit.BukkitAPIHelper");
|
Class.forName("io.lumine.mythic.bukkit.BukkitAPIHelper");
|
||||||
MythicManager = new MythicMobs5(PLUGIN);
|
MythicManager = new MythicMobs5(PLUGIN);
|
||||||
Jobs.consoleMsg("&e[Jobs] MythicMobs 5.x detected.");
|
Jobs.consoleMsg("&eMythicMobs 5.x detected.");
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
Jobs.consoleMsg("&cYour MythicMobs version is not supported by Jobs! Supported versions: 4.9.1+");
|
Jobs.consoleMsg("&cYour MythicMobs version is not supported by Jobs! Supported versions: 4.9.1+");
|
||||||
}
|
}
|
||||||
@ -118,17 +118,17 @@ public class HookManager {
|
|||||||
try {
|
try {
|
||||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
||||||
pm.registerEvents(new McMMO2_X_listener(), PLUGIN);
|
pm.registerEvents(new McMMO2_X_listener(), PLUGIN);
|
||||||
Jobs.consoleMsg("&e[Jobs] Registered McMMO 2.x listener");
|
Jobs.consoleMsg("&eRegistered McMMO 2.x listener");
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
pm.registerEvents(new McMMO1_X_listener(), PLUGIN);
|
pm.registerEvents(new McMMO1_X_listener(), PLUGIN);
|
||||||
Jobs.consoleMsg("&e[Jobs] Registered McMMO 1.x listener");
|
Jobs.consoleMsg("&eRegistered McMMO 1.x listener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setMyPetManager() {
|
private static void setMyPetManager() {
|
||||||
if (JobsHook.MyPet.isEnabled()) {
|
if (JobsHook.MyPet.isEnabled()) {
|
||||||
myPetManager = new MyPetManager();
|
myPetManager = new MyPetManager();
|
||||||
Jobs.consoleMsg("&e[Jobs] MyPet detected.");
|
Jobs.consoleMsg("&eMyPet detected.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,13 +100,13 @@ public class McMMOManager {
|
|||||||
mcMMOPresent = false;
|
mcMMOPresent = false;
|
||||||
}
|
}
|
||||||
if (!mcMMOPresent)
|
if (!mcMMOPresent)
|
||||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
Jobs.consoleMsg("&6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
||||||
|
|
||||||
// Still enabling event listener for repair
|
// Still enabling event listener for repair
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO" + McMMO.getDescription().getVersion() + " was found - Enabling capabilities.");
|
Jobs.consoleMsg("&6mcMMO" + McMMO.getDescription().getVersion() + " was found - Enabling capabilities.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user