diff --git a/libs/CMILib1.2.4.5.jar b/libs/CMILib1.2.4.5.jar
deleted file mode 100644
index 87ecf7c5..00000000
Binary files a/libs/CMILib1.2.4.5.jar and /dev/null differ
diff --git a/libs/CMILib1.4.0.0.jar b/libs/CMILib1.4.0.0.jar
new file mode 100644
index 00000000..c11721ba
Binary files /dev/null and b/libs/CMILib1.4.0.0.jar differ
diff --git a/pom.xml b/pom.xml
index cb78d56c..7d83800d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
4.0.0
Jobs
jobs
- 5.1.3.0
+ 5.2.1.0
Jobs
http://maven.apache.org
@@ -197,7 +197,7 @@
CMILib
latest
system
- ${basedir}/libs/CMILib1.2.4.5.jar
+ ${basedir}/libs/CMILib1.4.0.0.jar
diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java
index 6d53931c..e9971e3f 100644
--- a/src/main/java/com/gamingmesh/jobs/Jobs.java
+++ b/src/main/java/com/gamingmesh/jobs/Jobs.java
@@ -116,6 +116,7 @@ import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public final class Jobs extends JavaPlugin {
@@ -763,7 +764,7 @@ public final class Jobs extends JavaPlugin {
}
// register economy
- getServer().getScheduler().runTask(this, new HookEconomyTask(this));
+ CMIScheduler.get().runTask(new HookEconomyTask(this));
dao.loadBlockProtection();
getExploreManager().load();
diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java
index 190d378c..224963d1 100644
--- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java
+++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java
@@ -69,6 +69,7 @@ import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.NBT.CMINBT;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class PlayerManager {
@@ -731,7 +732,7 @@ public class PlayerManager {
}
if (Jobs.getGCManager().FireworkLevelupUse && player != null) {
- plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
+ CMIScheduler.get().runTaskLater(new Runnable() {
@Override
public void run() {
if (!player.isOnline())
@@ -1064,7 +1065,6 @@ public class PlayerManager {
}
}
- CMIDebug.d("get bonus item");
jitems.add(getJobsItemByNbt(item));
}
}
@@ -1201,7 +1201,7 @@ public class PlayerManager {
if (!Jobs.getGCManager().AutoJobJoinUse || player == null || player.isOp())
return;
- plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
+ CMIScheduler.get().runTaskLater(new Runnable() {
@Override
public void run() {
if (!player.isOnline())
diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java
index a42941c2..949be3d8 100644
--- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java
+++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java
@@ -23,6 +23,7 @@ import com.gamingmesh.jobs.container.TopList;
import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class SignUtil {
@@ -354,7 +355,7 @@ public class SignUtil {
if (directionFacing != null && !(loc.getBlock().getState() instanceof Skull))
loc.add(directionFacing.getOppositeFace().getModX(), 0, directionFacing.getOppositeFace().getModZ());
- Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
+ CMIScheduler.get().runTaskLater(new Runnable() {
@Override
public void run() {
if (!(loc.getBlock().getState() instanceof Skull))
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java
index 12f39dd8..a8217b30 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java
@@ -19,6 +19,7 @@ import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class bp implements Cmd {
@@ -78,19 +79,20 @@ public class bp implements Cmd {
else
Language.sendMessage(sender, "command.bp.output.found", "%amount%", changedBlocks.size());
- Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
- @Override
- public void run() {
- if (Version.isCurrentEqualOrHigher(Version.v1_15_R1))
+ if (!changedBlocks.isEmpty()) {
+ Location bloc = changedBlocks.get(0).getLocation();
+ CMIScheduler.get().runAtLocationLater(bloc, () -> {
+ if (Version.isCurrentEqualOrHigher(Version.v1_15_R1)) {
for (Block one : changedBlocks) {
player.sendBlockChange(one.getLocation(), one.getBlockData());
}
- else
+ } else {
for (Block one : changedBlocks) {
player.sendBlockChange(one.getLocation(), one.getType(), one.getData());
}
- }
- }, 120L);
+ }
+ }, 120L);
+ }
return true;
}
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java
index dbe929e1..fc6e8081 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java
@@ -1,6 +1,5 @@
package com.gamingmesh.jobs.commands.list;
-import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -10,28 +9,29 @@ import com.gamingmesh.jobs.dao.JobsManager.DataBaseType;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class convert implements Cmd {
@Override
public Boolean perform(Jobs plugin, CommandSender sender, String[] args) {
- if (sender instanceof Player) {
- CMIMessages.sendMessage(sender, LC.info_FromConsole);
- return true;
- }
+ if (sender instanceof Player) {
+ CMIMessages.sendMessage(sender, LC.info_FromConsole);
+ return true;
+ }
- if (args.length > 0) {
- return false;
- }
+ if (args.length > 0) {
+ return false;
+ }
- String from = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "SQLite" : "MySQL";
- String to = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "MySQL" : "SQLite";
+ String from = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "SQLite" : "MySQL";
+ String to = Jobs.getDBManager().getDbType() == DataBaseType.SqLite ? "MySQL" : "SQLite";
- Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
- Jobs.convertDatabase();
- CMIMessages.consoleMessage("&eDatabase was converted from &2" + from + " &eto &2" + to + "&e!");
- });
+ CMIScheduler.get().runTaskAsynchronously(() -> {
+ Jobs.convertDatabase();
+ CMIMessages.consoleMessage("&eDatabase was converted from &2" + from + " &eto &2" + to + "&e!");
+ });
- return true;
+ return true;
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/glog.java b/src/main/java/com/gamingmesh/jobs/commands/list/glog.java
index ffdf5171..7ef3ce0f 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/glog.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/glog.java
@@ -19,6 +19,7 @@ import com.gamingmesh.jobs.i18n.Language;
import com.gamingmesh.jobs.stuff.Sorting;
import net.Zrips.CMILib.Time.CMITimeManager;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class glog implements Cmd {
@@ -28,7 +29,7 @@ public class glog implements Cmd {
return false;
}
- Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
+ CMIScheduler.get().runTaskAsynchronously(new Runnable() {
@Override
public void run() {
Map unsortMap = new HashMap<>();
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java
index 76ac0762..8902092f 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/leave.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/leave.java
@@ -12,6 +12,7 @@ import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class leave implements Cmd {
@@ -44,7 +45,7 @@ public class leave implements Cmd {
if (!Util.LEAVECONFIRM.contains(uuid)) {
Util.LEAVECONFIRM.add(uuid);
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid),
+ CMIScheduler.get().runTaskLater(() -> Util.LEAVECONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime);
Language.sendMessage(sender, "command.leave.confirmationNeed", "[jobname]",
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java b/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java
index d1ecb80c..79ed8e4b 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/leaveall.java
@@ -14,6 +14,7 @@ import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class leaveall implements Cmd {
@@ -39,7 +40,7 @@ public class leaveall implements Cmd {
if (!Util.LEAVECONFIRM.contains(uuid)) {
Util.LEAVECONFIRM.add(uuid);
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.LEAVECONFIRM.remove(uuid),
+ CMIScheduler.get().runTaskLater(() -> Util.LEAVECONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime);
Language.sendMessage(pSender, "command.leaveall.confirmationNeed", "[time]",
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/limit.java b/src/main/java/com/gamingmesh/jobs/commands/list/limit.java
index d54c547d..72d30567 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/limit.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/limit.java
@@ -56,7 +56,6 @@ public class limit implements Cmd {
PaymentData limit = JPlayer.getPaymentLimit();
if (limit.getLeftTime(type) <= 0) {
- CMIDebug.d("reset", type);
limit.resetLimits(type);
}
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java
index c630df56..e2c856ff 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/skipquest.java
@@ -16,6 +16,7 @@ import com.gamingmesh.jobs.economy.BufferedEconomy;
import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Locale.LC;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class skipquest implements Cmd {
@@ -114,7 +115,7 @@ public class skipquest implements Cmd {
if (!Util.SKIPCONFIRM.contains(uuid)) {
Util.SKIPCONFIRM.add(uuid);
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> Util.SKIPCONFIRM.remove(uuid),
+ CMIScheduler.get().runTaskLater(() -> Util.SKIPCONFIRM.remove(uuid),
20 * Jobs.getGCManager().ConfirmExpiryTime);
Language.sendMessage(sender, "command.skipquest.confirmationNeed", "[questName]",
diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/version.java b/src/main/java/com/gamingmesh/jobs/commands/list/version.java
index ebe8c6a6..80466244 100644
--- a/src/main/java/com/gamingmesh/jobs/commands/list/version.java
+++ b/src/main/java/com/gamingmesh/jobs/commands/list/version.java
@@ -13,6 +13,7 @@ import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.RawMessages.RawMessage;
import net.Zrips.CMILib.Util.CMIVersionChecker;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import net.milkbowl.vault.economy.Economy;
public class version implements Cmd {
@@ -20,7 +21,7 @@ public class version implements Cmd {
@Override
public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) {
- Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
+ CMIScheduler.get().runTaskAsynchronously(new Runnable() {
@Override
public void run() {
@@ -62,7 +63,7 @@ public class version implements Cmd {
final String vault = preVault;
final String vaultProvider = vProvider;
- Bukkit.getScheduler().runTask(plugin, new Runnable() {
+ CMIScheduler.get().runTask(new Runnable() {
@Override
public void run() {
diff --git a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java
index fe56cf8a..c4e56e14 100644
--- a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java
+++ b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java
@@ -16,6 +16,7 @@ import com.gamingmesh.jobs.container.DBAction;
import net.Zrips.CMILib.Container.CMIBlock;
import net.Zrips.CMILib.Container.CMIBlock.Bisect;
import net.Zrips.CMILib.Items.CMIMaterial;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class BlockProtectionManager {
@@ -39,7 +40,7 @@ public class BlockProtectionManager {
}
public void add(Block block, Integer cd) {
-
+
if (cd == null || cd == 0)
return;
@@ -81,7 +82,7 @@ public class BlockProtectionManager {
if (time == null || time == 0)
return null;
-
+
String v = loc.getBlockX() + ":" + loc.getBlockY() + ":" + loc.getBlockZ();
HashMap>> regions = map.getOrDefault(loc.getWorld(), new HashMap<>());
@@ -97,8 +98,8 @@ public class BlockProtectionManager {
Bp = new BlockProtection(DBAction.INSERT, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
else {
Bp.setAction(DBAction.UPDATE);
- if (Bp.getSchedId() > -1)
- Bukkit.getServer().getScheduler().cancelTask(Bp.getSchedId());
+ if (Bp.getScheduler() != null)
+ Bp.getScheduler().cancel();
}
Bp.setPaid(paid);
@@ -106,7 +107,7 @@ public class BlockProtectionManager {
// If timer is under 2 hours, we can run scheduler to remove it when time comes
if (time > -1 && (time - System.currentTimeMillis()) / 1000 < 60 * 60 * 2)
- Bp.setSchedId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Jobs.getInstance(), () -> {
+ Bp.setScheduler(CMIScheduler.get().runTaskLater(() -> {
remove(loc);
}, (time - System.currentTimeMillis()) / 50));
@@ -116,7 +117,7 @@ public class BlockProtectionManager {
map.put(loc.getWorld(), regions);
// Only saving into save cache if timer is higher than 5 minutes
- if (cache && ((time - System.currentTimeMillis()) / 1000 > 60 * 5 || time < 0) )
+ if (cache && ((time - System.currentTimeMillis()) / 1000 > 60 * 5 || time < 0))
addToCache(loc, Bp);
return Bp;
}
@@ -186,7 +187,7 @@ public class BlockProtectionManager {
world.remove(locToRegion(loc));
return bp;
- }
+ }
public Long getTime(Block block) {
return getTime(block.getLocation());
diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java
index 95863c40..06db254a 100644
--- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java
+++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java
@@ -13,6 +13,7 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class BossBarManager {
@@ -36,7 +37,7 @@ public class BossBarManager {
public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) {
if (Jobs.getGCManager().isBossBarAsync()) {
- Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () -> ShowJobProgressionInTask(player, jobProg, expGain));
+ CMIScheduler.get().runTaskAsynchronously(() -> ShowJobProgressionInTask(player, jobProg, expGain));
} else {
ShowJobProgressionInTask(player, jobProg, expGain);
}
@@ -139,7 +140,7 @@ public class BossBarManager {
bar.setVisible(true);
if (oldOne != null)
- oldOne.setId(Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
+ oldOne.setScheduler(CMIScheduler.get().runTaskLater(new Runnable() {
@Override
public void run() {
for (BossBarInfo one : player.getBossBarInfo()) {
diff --git a/src/main/java/com/gamingmesh/jobs/config/ScheduleManager.java b/src/main/java/com/gamingmesh/jobs/config/ScheduleManager.java
index e2a33536..3c274749 100644
--- a/src/main/java/com/gamingmesh/jobs/config/ScheduleManager.java
+++ b/src/main/java/com/gamingmesh/jobs/config/ScheduleManager.java
@@ -10,7 +10,6 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.scheduler.BukkitTask;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.api.JobsScheduleStartEvent;
@@ -21,12 +20,14 @@ import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.Schedule;
import net.Zrips.CMILib.Messages.CMIMessages;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
+import net.Zrips.CMILib.Version.Schedulers.CMITask;
public class ScheduleManager {
private Jobs plugin;
- private BukkitTask timer;
+ private CMITask timer;
private YmlMaker jobSchedule;
public static final List BOOSTSCHEDULE = new ArrayList<>();
@@ -44,7 +45,7 @@ public class ScheduleManager {
return;
cancel();
- timer = Bukkit.getScheduler().runTaskTimer(plugin, this::scheduler, 20, 30 * 20L);
+ timer = CMIScheduler.get().scheduleSyncRepeatingTask(this::scheduler, 20, 30 * 20L);
}
public void cancel() {
diff --git a/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java b/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java
index b3f0a4b4..561e9aa3 100644
--- a/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java
+++ b/src/main/java/com/gamingmesh/jobs/container/BlockProtection.java
@@ -2,13 +2,15 @@ package com.gamingmesh.jobs.container;
import org.bukkit.util.Vector;
+import net.Zrips.CMILib.Version.Schedulers.CMITask;
+
public class BlockProtection {
private static long pre = (int) (System.currentTimeMillis() / 10000000000L) * 10000000000L;
private int id = -1;
- private int schedId = - 1;
- private int time = -1;
+ private CMITask scheduler = null;
+ private int time = -1;
private int recorded = -1;
private DBAction action;
private boolean paid = false;
@@ -17,109 +19,109 @@ public class BlockProtection {
private int z = 0;
public BlockProtection(Vector pos) {
- this(DBAction.INSERT, pos);
+ this(DBAction.INSERT, pos);
}
@Deprecated
public BlockProtection(DBAction action, Vector pos) {
- this(action, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
+ this(action, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
}
public BlockProtection(DBAction action, int x, int y, int z) {
- this.action = action;
- if (action == DBAction.NONE)
- action = null;
- this.x = x;
- this.y = y;
- this.z = z;
+ this.action = action;
+ if (action == DBAction.NONE)
+ action = null;
+ this.x = x;
+ this.y = y;
+ this.z = z;
}
public long getTime() {
- return deconvert(time);
+ return deconvert(time);
}
private static int convert(long time) {
- return time == -1L ? -1 : (int) ((time - pre) / 1000L);
+ return time == -1L ? -1 : (int) ((time - pre) / 1000L);
}
private static long deconvert(int time) {
- return time == -1 ? -1 : (time * 1000L) + pre;
+ return time == -1 ? -1 : (time * 1000L) + pre;
}
public void setTime(long time) {
- this.time = time == -1 ? -1 : convert(time);
- this.recorded = convert(System.currentTimeMillis());
+ this.time = time == -1 ? -1 : convert(time);
+ this.recorded = convert(System.currentTimeMillis());
}
public DBAction getAction() {
- return action == null ? DBAction.NONE : action;
+ return action == null ? DBAction.NONE : action;
}
public void setAction(DBAction action) {
- if (action == DBAction.NONE)
- action = null;
- this.action = action;
+ if (action == DBAction.NONE)
+ action = null;
+ this.action = action;
}
public long getRecorded() {
- return deconvert(recorded);
+ return deconvert(recorded);
}
public boolean isPaid() {
- return paid;
+ return paid;
}
public void setPaid(boolean paid) {
- this.paid = paid;
+ this.paid = paid;
}
public void setRecorded(long recorded) {
- this.recorded = convert(recorded);
+ this.recorded = convert(recorded);
}
public int getId() {
- return id;
+ return id;
}
public void setId(int id) {
- this.id = id;
+ this.id = id;
}
@Deprecated
public Vector getPos() {
- return new Vector(x, y, z);
+ return new Vector(x, y, z);
}
@Deprecated
public void setPos(Vector pos) {
- x = pos.getBlockX();
- y = pos.getBlockY();
- z = pos.getBlockZ();
+ x = pos.getBlockX();
+ y = pos.getBlockY();
+ z = pos.getBlockZ();
}
public void setPos(int x, int y, int z) {
- this.x = x;
- this.y = y;
- this.z = z;
+ this.x = x;
+ this.y = y;
+ this.z = z;
}
public int getX() {
- return x;
+ return x;
}
public int getY() {
- return y;
+ return y;
}
public int getZ() {
- return z;
+ return z;
}
- public int getSchedId() {
- return schedId;
+ public CMITask getScheduler() {
+ return scheduler;
}
- public void setSchedId(int schedId) {
- this.schedId = schedId;
+ public void setScheduler(CMITask cmiTask) {
+ this.scheduler = cmiTask;
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/container/BossBarInfo.java b/src/main/java/com/gamingmesh/jobs/container/BossBarInfo.java
index e7ba1994..bb98e0ca 100644
--- a/src/main/java/com/gamingmesh/jobs/container/BossBarInfo.java
+++ b/src/main/java/com/gamingmesh/jobs/container/BossBarInfo.java
@@ -1,13 +1,14 @@
package com.gamingmesh.jobs.container;
-import org.bukkit.Bukkit;
import org.bukkit.boss.BossBar;
+import net.Zrips.CMILib.Version.Schedulers.CMITask;
+
public class BossBarInfo {
private String jobName;
private String PlayerName;
private BossBar bar;
- private int id = -1;
+ private CMITask scheduler = null;
public BossBarInfo(String PlayerName, String jobName, BossBar bar) {
this.PlayerName = PlayerName;
@@ -15,14 +16,14 @@ public class BossBarInfo {
this.bar = bar;
}
- public void setId(int id) {
+ public void setScheduler(CMITask cmiTask) {
cancel();
- this.id = id;
+ this.scheduler = cmiTask;
}
public void cancel() {
- if (id != -1)
- Bukkit.getScheduler().cancelTask(this.id);
+ if (scheduler != null)
+ scheduler.cancel();
}
public String getPlayerName() {
diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java
index de82f577..cdf3a685 100644
--- a/src/main/java/com/gamingmesh/jobs/container/Job.java
+++ b/src/main/java/com/gamingmesh/jobs/container/Job.java
@@ -232,13 +232,14 @@ public class Job {
e.printStackTrace();
}
- CMIDebug.d("Now", now, this.getName(), getTotalPlayers(), now == Double.POSITIVE_INFINITY);
-
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty)
now = Jobs.getGCManager().DynamicPaymentMaxPenalty;
+
+ if (Double.isNaN(now))
+ now = 0;
this.bonus = now;
}
@@ -309,6 +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)) {
diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java
index 126fc30a..0a51170f 100644
--- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java
+++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java
@@ -47,6 +47,8 @@ import net.Zrips.CMILib.Equations.Parser;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Time.CMITimeManager;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
+import net.Zrips.CMILib.Version.Schedulers.CMITask;
public class JobsPlayer {
@@ -1347,14 +1349,14 @@ public class JobsPlayer {
this.doneQuests = doneQuests;
}
- private Integer questSignUpdateShed;
+ private CMITask questSignUpdateShed;
public void addDoneQuest(final Job job) {
doneQuests++;
setSaved(false);
if (questSignUpdateShed == null) {
- questSignUpdateShed = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
+ questSignUpdateShed = CMIScheduler.get().runTaskLater(() -> {
Jobs.getSignUtil().signUpdate(job, SignTopType.questtoplist);
questSignUpdateShed = null;
}, Jobs.getGCManager().getSavePeriod() * 60 * 20L);
diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java
index 0ec3d9ec..d5ab5b50 100644
--- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java
+++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java
@@ -45,6 +45,7 @@ import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Time.CMITimeManager;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public abstract class JobsDAO {
@@ -1016,7 +1017,7 @@ public abstract class JobsDAO {
public void triggerTableIdUpdate() {
// Lets convert old fields
if (!converted) {
- Bukkit.getServer().getScheduler().runTaskLater(plugin, () -> {
+ CMIScheduler.get().runTaskLater(() -> {
CMIMessages.consoleMessage("&6[Jobs] Converting to new database format");
convertID();
CMIMessages.consoleMessage("&6[Jobs] Converted to new database format");
diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java
index 2658850b..bc74333d 100644
--- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java
+++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java
@@ -38,6 +38,7 @@ import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class BufferedEconomy {
@@ -208,9 +209,9 @@ public class BufferedEconomy {
}
if (Jobs.getGCManager().isEconomyAsync())
- Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
+ CMIScheduler.get().runLaterAsync(new BufferedPaymentTask(this, economy, payment), i);
else
- Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i);
+ CMIScheduler.get().runTaskLater(new BufferedPaymentTask(this, economy, payment), i);
// Show players payment stuff
showPayment(payment);
diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java
index 0d59442e..ed1a91b7 100644
--- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java
+++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java
@@ -91,6 +91,7 @@ import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.NBT.CMINBT;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public class JobsListener implements Listener {
@@ -170,7 +171,7 @@ public class JobsListener implements Listener {
if (!Jobs.getGCManager().MultiServerCompatability())
Jobs.getPlayerManager().playerJoin(event.getPlayer());
else {
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getPlayerManager().playerJoin(event.getPlayer()), 40L);
+ CMIScheduler.get().runTaskLater(() -> Jobs.getPlayerManager().playerJoin(event.getPlayer()), 40L);
}
}
@@ -317,7 +318,7 @@ public class JobsListener implements Listener {
event.setCancelled(true);
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> signUtil.signUpdate(job, type), 1L);
+ CMIScheduler.get().runTaskLater(() -> signUtil.signUpdate(job, type), 1L);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@@ -375,14 +376,14 @@ public class JobsListener implements Listener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onCropGrown(final BlockGrowEvent event) {
if (Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) {
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getBpManager().remove(event.getBlock()), 1L);
+ CMIScheduler.get().runAtLocationLater(event.getBlock().getLocation(), () -> Jobs.getBpManager().remove(event.getBlock()), 1L);
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onTreeGrown(final StructureGrowEvent event) {
if (!event.getBlocks().isEmpty() && Jobs.getGCManager().canPerformActionInWorld(event.getBlocks().get(0).getWorld())) {
- plugin.getServer().getScheduler().runTaskLater(plugin, () -> event.getBlocks().forEach(blockState -> Jobs.getBpManager().remove(blockState.getBlock())), 1L);
+ CMIScheduler.get().runAtLocationLater(event.getBlocks().get(0).getLocation(), () -> event.getBlocks().forEach(blockState -> Jobs.getBpManager().remove(blockState.getBlock())), 1L);
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java
index 8f2f5509..ba81b0f1 100644
--- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java
+++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java
@@ -133,6 +133,7 @@ import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public final class JobsPaymentListener implements Listener {
@@ -795,7 +796,7 @@ public final class JobsPaymentListener implements Listener {
preInv[i] = preInv[i].clone();
}
- Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
+ CMIScheduler.get().runTaskLater(new Runnable() {
@Override
public void run() {
final ItemStack[] postInv = player.getInventory().getContents();
@@ -1315,7 +1316,7 @@ public final class JobsPaymentListener implements Listener {
// So lets remove meta in case some plugin removes entity in wrong way.
// Need to delay action for other function to properly check for existing meta data relating to this entity before clearing it out
// Longer delay is needed due to mob split event being fired few seconds after mob dies and not at same time
- Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
+ CMIScheduler.get().runTaskLater(() -> {
lVictim.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), plugin);
}, 200L);
} catch (Throwable ignored) {
@@ -1839,7 +1840,7 @@ public final class JobsPaymentListener implements Listener {
// or it's 1.16+ and we're trying to strip a fungi like warped stem
if ((Version.isCurrentEqualOrHigher(Version.v1_13_R1) && (block.getType().toString().endsWith("_LOG") || block.getType().toString().endsWith("_WOOD"))) ||
(Version.isCurrentEqualOrHigher(Version.v1_16_R1) && (block.getType().toString().endsWith("_STEM") || block.getType().toString().endsWith("_HYPHAE")))) {
- Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1);
+ CMIScheduler.get().runTaskLater(() -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1);
}
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java
index 7a3843db..d71b702e 100644
--- a/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java
+++ b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java
@@ -13,53 +13,54 @@ import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs;
import net.Zrips.CMILib.Messages.CMIMessages;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
public final class VersionChecker {
private Jobs plugin;
public VersionChecker(Jobs plugin) {
- this.plugin = plugin;
+ this.plugin = plugin;
}
public void VersionCheck(final Player player) {
- if (!Jobs.getGCManager().isShowNewVersion())
- return;
+ if (!Jobs.getGCManager().isShowNewVersion())
+ return;
- plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
- String newVersion = getNewVersion();
- if (newVersion == null)
- return;
+ CMIScheduler.get().runTaskAsynchronously(() -> {
+ String newVersion = getNewVersion();
+ if (newVersion == null)
+ return;
- int currentVersion = Integer.parseInt(plugin.getDescription().getVersion().replace(".", ""));
- int newVer = Integer.parseInt(newVersion.replace(".", ""));
+ int currentVersion = Integer.parseInt(plugin.getDescription().getVersion().replace(".", ""));
+ int newVer = Integer.parseInt(newVersion.replace(".", ""));
- if (newVer <= currentVersion || currentVersion >= newVer)
- return;
+ if (newVer <= currentVersion || currentVersion >= newVer)
+ return;
- List msg = Arrays.asList(
- ChatColor.GREEN + "*********************** " + plugin.getDescription().getName() + " **************************",
- ChatColor.GREEN + "* " + newVersion + " is now available! Your version: " + currentVersion,
- ChatColor.GREEN + "* " + ChatColor.DARK_GREEN + plugin.getDescription().getWebsite(),
- ChatColor.GREEN + "************************************************************");
- for (String one : msg)
- if (player != null)
- player.sendMessage(one);
- else
- CMIMessages.consoleMessage(one);
- });
+ List msg = Arrays.asList(
+ ChatColor.GREEN + "*********************** " + plugin.getDescription().getName() + " **************************",
+ ChatColor.GREEN + "* " + newVersion + " is now available! Your version: " + currentVersion,
+ ChatColor.GREEN + "* " + ChatColor.DARK_GREEN + plugin.getDescription().getWebsite(),
+ ChatColor.GREEN + "************************************************************");
+ for (String one : msg)
+ if (player != null)
+ player.sendMessage(one);
+ else
+ CMIMessages.consoleMessage(one);
+ });
}
public String getNewVersion() {
- try {
- URLConnection con = new URL("https://api.spigotmc.org/legacy/update.php?resource=4216").openConnection();
- String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
- if (version.length() <= 8)
- return version;
- } catch (Throwable t) {
- CMIMessages.consoleMessage("&cFailed to check for " + plugin.getDescription().getName() + " update on spigot web page.");
- }
- return null;
+ try {
+ URLConnection con = new URL("https://api.spigotmc.org/legacy/update.php?resource=4216").openConnection();
+ String version = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
+ if (version.length() <= 8)
+ return version;
+ } catch (Throwable t) {
+ CMIMessages.consoleMessage("&cFailed to check for " + plugin.getDescription().getName() + " update on spigot web page.");
+ }
+ return null;
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/stuff/complement/JobsChatEvent.java b/src/main/java/com/gamingmesh/jobs/stuff/complement/JobsChatEvent.java
index d50e8301..c6206c58 100644
--- a/src/main/java/com/gamingmesh/jobs/stuff/complement/JobsChatEvent.java
+++ b/src/main/java/com/gamingmesh/jobs/stuff/complement/JobsChatEvent.java
@@ -9,6 +9,8 @@ import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.stuff.Util;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
+
@SuppressWarnings("deprecation")
public class JobsChatEvent implements Listener {
@@ -25,8 +27,7 @@ public class JobsChatEvent implements Listener {
final String msg = Util.getJobsEditorMap().remove(event.getPlayer().getUniqueId());
if (msg != null) {
- plugin.getServer().getScheduler().runTask(plugin,
- () -> event.getPlayer().performCommand(msg + event.getMessage()));
+ CMIScheduler.get().runTask(() -> event.getPlayer().performCommand(msg + event.getMessage()));
event.setCancelled(true);
}
}
diff --git a/src/main/java/com/gamingmesh/jobs/stuff/complement/KyoriChatEvent.java b/src/main/java/com/gamingmesh/jobs/stuff/complement/KyoriChatEvent.java
index bb223640..f3b5242c 100644
--- a/src/main/java/com/gamingmesh/jobs/stuff/complement/KyoriChatEvent.java
+++ b/src/main/java/com/gamingmesh/jobs/stuff/complement/KyoriChatEvent.java
@@ -10,6 +10,7 @@ import com.gamingmesh.jobs.stuff.Util;
import io.papermc.paper.chat.ChatRenderer;
import io.papermc.paper.event.player.AsyncChatEvent;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import net.kyori.adventure.text.TextReplacementConfig;
public final class KyoriChatEvent extends Complement2 implements Listener {
@@ -17,45 +18,44 @@ public final class KyoriChatEvent extends Complement2 implements Listener {
private Jobs plugin;
public KyoriChatEvent(Jobs plugin) {
- this.plugin = plugin;
+ this.plugin = plugin;
}
@EventHandler(priority = EventPriority.NORMAL)
public void asyncChatEvent(final AsyncChatEvent event) {
- if (event.isCancelled() || Util.getJobsEditorMap().isEmpty())
- return;
+ if (event.isCancelled() || Util.getJobsEditorMap().isEmpty())
+ return;
- final String msg = Util.getJobsEditorMap().remove(event.getPlayer().getUniqueId());
- if (msg != null) {
- plugin.getServer().getScheduler().runTask(plugin,
- () -> event.getPlayer().performCommand(msg + serialize(event.message())));
- event.setCancelled(true);
- }
+ final String msg = Util.getJobsEditorMap().remove(event.getPlayer().getUniqueId());
+ if (msg != null) {
+ CMIScheduler.get().runTask(() -> event.getPlayer().performCommand(msg + serialize(event.message())));
+ event.setCancelled(true);
+ }
}
// Adding to chat prefix job name
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onPlayerChat(AsyncChatEvent event) {
- if (!Jobs.getGCManager().getModifyChat())
- return;
+ if (!Jobs.getGCManager().getModifyChat())
+ return;
- JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
- String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
- if (honorific.equals(" "))
- honorific = "";
+ JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
+ String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
+ if (honorific.equals(" "))
+ honorific = "";
- // TODO displayName returns the player display name not the chat component from
- // chat plugins, like Essentials
- // Now there is a parameter "player", so literally we need to add 800+ chat plugins
- // to this plugin as dependency?
- // 3rd attempt: now we tried to use text replacement config builder to match the variable
- // result: instead of replacing the variable, now the chat message never been sent
- //event.composer((player, displayName, msg) -> msg
- //.replaceText(TextReplacementConfig.builder().match("{jobs}").once().replacement(h).build()));
+ // TODO displayName returns the player display name not the chat component from
+ // chat plugins, like Essentials
+ // Now there is a parameter "player", so literally we need to add 800+ chat plugins
+ // to this plugin as dependency?
+ // 3rd attempt: now we tried to use text replacement config builder to match the variable
+ // result: instead of replacing the variable, now the chat message never been sent
+ //event.composer((player, displayName, msg) -> msg
+ //.replaceText(TextReplacementConfig.builder().match("{jobs}").once().replacement(h).build()));
- event.message(ChatRenderer.defaultRenderer().render(event.getPlayer(), event.getPlayer().displayName(), event.message(), event.getPlayer()).replaceText(TextReplacementConfig.builder().match(
- "\\{jobs\\}").replacement(honorific).build()));
- // 4th attempt: composeChat -> doing nothing
+ event.message(ChatRenderer.defaultRenderer().render(event.getPlayer(), event.getPlayer().displayName(), event.message(), event.getPlayer()).replaceText(TextReplacementConfig.builder().match(
+ "\\{jobs\\}").replacement(honorific).build()));
+ // 4th attempt: composeChat -> doing nothing
// event.message(ChatComposer.DEFAULT.composeChat(event.getPlayer(), event.getPlayer().displayName(), event.message())
// .replaceText(TextReplacementConfig.builder().match("\\{jobs\\}").replacement(honorific).build()));
}
@@ -63,22 +63,22 @@ public final class KyoriChatEvent extends Complement2 implements Listener {
// Changing chat prefix variable to job name
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerChatLow(AsyncChatEvent event) {
- onPlayerChatHigh(event);
+ onPlayerChatHigh(event);
}
// Changing chat prefix variable to job name
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerChatHigh(AsyncChatEvent event) {
- if (Jobs.getGCManager().getModifyChat())
- return;
+ if (Jobs.getGCManager().getModifyChat())
+ return;
- JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
- String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
- if (honorific.equals(" "))
- honorific = "";
+ JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
+ String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
+ if (honorific.equals(" "))
+ honorific = "";
- event.message(ChatRenderer.defaultRenderer().render(event.getPlayer(), event.getPlayer().displayName(), event.message(), event.getPlayer()).replaceText(TextReplacementConfig.builder().match(
- "\\{jobs\\}").replacement(honorific).build()));
+ event.message(ChatRenderer.defaultRenderer().render(event.getPlayer(), event.getPlayer().displayName(), event.message(), event.getPlayer()).replaceText(TextReplacementConfig.builder().match(
+ "\\{jobs\\}").replacement(honorific).build()));
// event.message(ChatComposer.DEFAULT
// .composeChat(event.getPlayer(), event.getPlayer().displayName(), event.message())
diff --git a/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentTask.java b/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentTask.java
index 11ce1ae2..c5afd8a1 100644
--- a/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentTask.java
+++ b/src/main/java/com/gamingmesh/jobs/tasks/BufferedPaymentTask.java
@@ -24,6 +24,8 @@ import com.gamingmesh.jobs.economy.BufferedEconomy;
import com.gamingmesh.jobs.economy.BufferedPayment;
import com.gamingmesh.jobs.economy.Economy;
+import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
+
public class BufferedPaymentTask implements Runnable {
private BufferedEconomy bufferedEconomy;
@@ -41,7 +43,7 @@ public class BufferedPaymentTask implements Runnable {
double money = payment.get(CurrencyType.MONEY);
if (money > 0) {
if (Jobs.getGCManager().isEconomyAsync()) {
- org.bukkit.Bukkit.getScheduler().runTaskAsynchronously(bufferedEconomy.getPlugin(), () -> economy.depositPlayer(payment.getOfflinePlayer(), money));
+ CMIScheduler.get().runTaskAsynchronously(() -> economy.depositPlayer(payment.getOfflinePlayer(), money));
} else {
economy.depositPlayer(payment.getOfflinePlayer(), money);
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 80247c41..b3c422a8 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -3,6 +3,7 @@ description: Jobs plugin for the BukkitAPI
main: com.gamingmesh.jobs.Jobs
version: ${project.version}
api-version: "1.13"
+folia-supported: true
website: https://www.spigotmc.org/resources/4216/
authors: [Zrips]
contributors: [montlikadani]