1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +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> <modelVersion>4.0.0</modelVersion>
<groupId>Jobs</groupId> <groupId>Jobs</groupId>
<artifactId>jobs</artifactId> <artifactId>jobs</artifactId>
<version>4.3.1</version> <version>4.4.0</version>
<name>Jobs</name> <name>Jobs</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>

View File

@ -618,8 +618,7 @@ public class Jobs extends JavaPlugin {
// Schedule // Schedule
Jobs.getScheduleManager().load(); Jobs.getScheduleManager().load();
if (GconfigManager.useGlobalBoostScheduler) Jobs.getScheduleManager().start();
Jobs.getScheduleManager().start();
permissionManager = new PermissionManager(); permissionManager = new PermissionManager();
} }
@ -782,7 +781,6 @@ public class Jobs extends JavaPlugin {
YmlMaker jobShopItems = new YmlMaker(this, "shopItems.yml"); YmlMaker jobShopItems = new YmlMaker(this, "shopItems.yml");
jobShopItems.saveDefaultConfig(); jobShopItems.saveDefaultConfig();
setPermissionHandler(new PermissionHandler(this)); setPermissionHandler(new PermissionHandler(this));
setJobsClassloader(); setJobsClassloader();
setPlayerManager(); setPlayerManager();
@ -842,7 +840,6 @@ public class Jobs extends JavaPlugin {
cManager.fillCommands(); cManager.fillCommands();
} catch (Exception e) { } catch (Exception e) {
System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled."); System.out.println("There was some issues when starting plugin. Please contact dev about this. Plugin will be disabled.");
e.printStackTrace(); e.printStackTrace();

View File

@ -101,7 +101,7 @@ public class GeneralConfigManager {
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat,
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
useGlobalBoostScheduler, JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin; JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
private int JobsGUIRows, JobsGUIBackButton, private int JobsGUIRows, JobsGUIBackButton,
JobsGUIStartPosition, JobsGUIStartPosition,
@ -913,8 +913,8 @@ public class GeneralConfigManager {
tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE")); 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)); 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"); // c.getW().addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost");
useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false); // useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false);
try { try {
c.getW().save(f); 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.Job;
import com.gamingmesh.jobs.container.Schedule; import com.gamingmesh.jobs.container.Schedule;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.stuff.TimeManage;
public class ScheduleManager { public class ScheduleManager {
@ -32,6 +33,8 @@ public class ScheduleManager {
} }
public void start() { public void start() {
if (Jobs.getGCManager().BoostSchedule.isEmpty())
return;
autoTimerBukkitId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, autoTimer, 20, 30 * 20L); autoTimerBukkitId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, autoTimer, 20, 30 * 20L);
} }
@ -55,7 +58,7 @@ public class ScheduleManager {
} }
private boolean scheduler() { private boolean scheduler() {
if (Jobs.getGCManager().BoostSchedule.isEmpty() || !Jobs.getGCManager().useGlobalBoostScheduler) if (Jobs.getGCManager().BoostSchedule.isEmpty())
return false; return false;
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); 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()) || !one.isNextDay() && (Current >= From && Current < Until)) && (days.contains(CurrentDayName) || days.contains("all")) && !one
.isStarted()) { .isStarted()) {
JobsScheduleStartEvent event = new JobsScheduleStartEvent(one); JobsScheduleStartEvent event = new JobsScheduleStartEvent(one);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if(event.isCancelled()){ if (event.isCancelled()) {
continue; continue;
} }
if (one.isBroadcastOnStart()) if (one.isBroadcastOnStart())
if (one.GetMessageOnStart().size() == 0) if (one.GetMessageOnStart().size() == 0)
Bukkit.broadcastMessage(Jobs.getLanguage().getMessage("message.boostStarted")); Bukkit.broadcastMessage(Jobs.getLanguage().getMessage("message.boostStarted"));
@ -109,11 +112,11 @@ public class ScheduleManager {
break; break;
} else if (((one.isNextDay() && Current > one.GetNextUntil() && Current < one.GetFrom() && !one.isStoped()) || !one.isNextDay() && Current > Until } else if (((one.isNextDay() && Current > one.GetNextUntil() && Current < one.GetFrom() && !one.isStoped()) || !one.isNextDay() && Current > Until
&& ((days.contains(CurrentDayName)) || days.contains("all"))) && !one.isStoped()) { && ((days.contains(CurrentDayName)) || days.contains("all"))) && !one.isStoped()) {
JobsScheduleStopEvent event = new JobsScheduleStopEvent(one); JobsScheduleStopEvent event = new JobsScheduleStopEvent(one);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if(event.isCancelled()){ if (event.isCancelled()) {
continue; continue;
} }
if (one.isBroadcastOnStop()) if (one.isBroadcastOnStop())
if (one.GetMessageOnStop().size() == 0) if (one.GetMessageOnStop().size() == 0)
Bukkit.broadcastMessage(Jobs.getLanguage().getMessage("message.boostStoped")); Bukkit.broadcastMessage(Jobs.getLanguage().getMessage("message.boostStoped"));
@ -232,6 +235,7 @@ public class ScheduleManager {
sched.setBoost(CurrencyType.MONEY, path.getDouble("Money", 0D)); sched.setBoost(CurrencyType.MONEY, path.getDouble("Money", 0D));
if (path.contains("Points") && path.isDouble("Points")) if (path.contains("Points") && path.isDouble("Points"))
sched.setBoost(CurrencyType.POINTS, path.getDouble("Points", 0D)); sched.setBoost(CurrencyType.POINTS, path.getDouble("Points", 0D));
Jobs.getGCManager().BoostSchedule.add(sched); Jobs.getGCManager().BoostSchedule.add(sched);
} }
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + Jobs.getGCManager().BoostSchedule.size() + " schedulers!"); Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + Jobs.getGCManager().BoostSchedule.size() + " schedulers!");

View File

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