1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

We dont need separate option for scheduler enable option

This commit is contained in:
Zrips 2018-02-11 13:30:19 +02:00
parent 7c43bc94e3
commit 3af38fdaa4
5 changed files with 24 additions and 23 deletions

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId>
<artifactId>jobs</artifactId>
<version>4.3.1</version>
<version>4.4.0</version>
<name>Jobs</name>
<url>http://maven.apache.org</url>
<properties>

View File

@ -618,8 +618,7 @@ public class Jobs extends JavaPlugin {
// Schedule
Jobs.getScheduleManager().load();
if (GconfigManager.useGlobalBoostScheduler)
Jobs.getScheduleManager().start();
Jobs.getScheduleManager().start();
permissionManager = new PermissionManager();
}
@ -782,7 +781,6 @@ public class Jobs extends JavaPlugin {
YmlMaker jobShopItems = new YmlMaker(this, "shopItems.yml");
jobShopItems.saveDefaultConfig();
setPermissionHandler(new PermissionHandler(this));
setJobsClassloader();
setPlayerManager();
@ -834,7 +832,7 @@ public class Jobs extends JavaPlugin {
getExplore().load();
FurnaceBrewingHandling.load();
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] Plugin has been enabled succesfully.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage(message);
@ -842,7 +840,6 @@ public class Jobs extends JavaPlugin {
cManager.fillCommands();
} catch (Exception e) {
System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled.");
e.printStackTrace();
@ -856,9 +853,9 @@ public class Jobs extends JavaPlugin {
shopManager.CloseInventories();
dao.saveExplore();
dao.saveBlockProtection();
FurnaceBrewingHandling.save();
Jobs.shutdown();
String message = ChatColor.translateAlternateColorCodes('&', "&e[Jobs] &2Plugin has been disabled succesfully.");
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();

View File

@ -101,7 +101,7 @@ public class GeneralConfigManager {
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat,
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
useGlobalBoostScheduler, JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
private int JobsGUIRows, JobsGUIBackButton,
JobsGUIStartPosition,
@ -913,8 +913,8 @@ public class GeneralConfigManager {
tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));
guiFiller = new ItemStack(tmat == null ? Material.STAINED_GLASS_PANE : tmat, 1, (byte) c.get("JobsGUI.Filler.Data", 15));
c.getW().addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost");
useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false);
// c.getW().addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost");
// useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false);
try {
c.getW().save(f);

View File

@ -20,6 +20,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.Schedule;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.TimeManage;
public class ScheduleManager {
@ -32,6 +33,8 @@ public class ScheduleManager {
}
public void start() {
if (Jobs.getGCManager().BoostSchedule.isEmpty())
return;
autoTimerBukkitId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, autoTimer, 20, 30 * 20L);
}
@ -55,7 +58,7 @@ public class ScheduleManager {
}
private boolean scheduler() {
if (Jobs.getGCManager().BoostSchedule.isEmpty() || !Jobs.getGCManager().useGlobalBoostScheduler)
if (Jobs.getGCManager().BoostSchedule.isEmpty())
return false;
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
@ -85,11 +88,11 @@ public class ScheduleManager {
.isStarted()) || !one.isNextDay() && (Current >= From && Current < Until)) && (days.contains(CurrentDayName) || days.contains("all")) && !one
.isStarted()) {
JobsScheduleStartEvent event = new JobsScheduleStartEvent(one);
Bukkit.getPluginManager().callEvent(event);
if(event.isCancelled()){
continue;
}
JobsScheduleStartEvent event = new JobsScheduleStartEvent(one);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
}
if (one.isBroadcastOnStart())
if (one.GetMessageOnStart().size() == 0)
Bukkit.broadcastMessage(Jobs.getLanguage().getMessage("message.boostStarted"));
@ -109,11 +112,11 @@ public class ScheduleManager {
break;
} else if (((one.isNextDay() && Current > one.GetNextUntil() && Current < one.GetFrom() && !one.isStoped()) || !one.isNextDay() && Current > Until
&& ((days.contains(CurrentDayName)) || days.contains("all"))) && !one.isStoped()) {
JobsScheduleStopEvent event = new JobsScheduleStopEvent(one);
Bukkit.getPluginManager().callEvent(event);
if(event.isCancelled()){
continue;
}
JobsScheduleStopEvent event = new JobsScheduleStopEvent(one);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
}
if (one.isBroadcastOnStop())
if (one.GetMessageOnStop().size() == 0)
Bukkit.broadcastMessage(Jobs.getLanguage().getMessage("message.boostStoped"));
@ -232,6 +235,7 @@ public class ScheduleManager {
sched.setBoost(CurrencyType.MONEY, path.getDouble("Money", 0D));
if (path.contains("Points") && path.isDouble("Points"))
sched.setBoost(CurrencyType.POINTS, path.getDouble("Points", 0D));
Jobs.getGCManager().BoostSchedule.add(sched);
}
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + Jobs.getGCManager().BoostSchedule.size() + " schedulers!");

View File

@ -1,7 +1,7 @@
name: Jobs
description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.Jobs
version: 4.3.1
version: 4.4.0
website: https://www.spigotmc.org/resources/jobs-reborn.4216/
author: phrstbrn
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldGuard, MyPet]