mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
parent
1f2cf4b9cc
commit
d779ca366d
@ -166,7 +166,7 @@ public class PS {
|
|||||||
setupDatabase();
|
setupDatabase();
|
||||||
CommentManager.registerDefaultInboxes();
|
CommentManager.registerDefaultInboxes();
|
||||||
// Tasks
|
// Tasks
|
||||||
if (Settings.KILL_ROAD_MOBS) {
|
if (Settings.KILL_ROAD_MOBS || Settings.KILL_ROAD_VEHICLES) {
|
||||||
IMP.runEntityTask();
|
IMP.runEntityTask();
|
||||||
}
|
}
|
||||||
// Events
|
// Events
|
||||||
@ -1460,6 +1460,7 @@ public class PS {
|
|||||||
*/
|
*/
|
||||||
public void disable() {
|
public void disable() {
|
||||||
try {
|
try {
|
||||||
|
TASK = null;
|
||||||
// Validate that all data in the db is correct
|
// Validate that all data in the db is correct
|
||||||
DBFunc.validatePlots(getPlotsRaw());
|
DBFunc.validatePlots(getPlotsRaw());
|
||||||
|
|
||||||
|
@ -14,6 +14,9 @@ public abstract class TaskManager {
|
|||||||
|
|
||||||
public static int runTaskRepeat(final Runnable r, final int interval) {
|
public static int runTaskRepeat(final Runnable r, final int interval) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
|
if (PS.get().TASK == null) {
|
||||||
|
throw new IllegalArgumentException("disabled");
|
||||||
|
}
|
||||||
return PS.get().TASK.taskRepeat(r, interval);
|
return PS.get().TASK.taskRepeat(r, interval);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -21,6 +24,9 @@ public abstract class TaskManager {
|
|||||||
|
|
||||||
public static int runTaskRepeatAsync(final Runnable r, final int interval) {
|
public static int runTaskRepeatAsync(final Runnable r, final int interval) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
|
if (PS.get().TASK == null) {
|
||||||
|
throw new IllegalArgumentException("disabled");
|
||||||
|
}
|
||||||
return PS.get().TASK.taskRepeat(r, interval);
|
return PS.get().TASK.taskRepeat(r, interval);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -28,12 +34,20 @@ public abstract class TaskManager {
|
|||||||
|
|
||||||
public static void runTaskAsync(final Runnable r) {
|
public static void runTaskAsync(final Runnable r) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
|
if (PS.get().TASK == null) {
|
||||||
|
r.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
PS.get().TASK.taskAsync(r);
|
PS.get().TASK.taskAsync(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTask(final Runnable r) {
|
public static void runTask(final Runnable r) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
|
if (PS.get().TASK == null) {
|
||||||
|
r.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
PS.get().TASK.task(r);
|
PS.get().TASK.task(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,12 +59,20 @@ public abstract class TaskManager {
|
|||||||
*/
|
*/
|
||||||
public static void runTaskLater(final Runnable r, final int delay) {
|
public static void runTaskLater(final Runnable r, final int delay) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
|
if (PS.get().TASK == null) {
|
||||||
|
r.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
PS.get().TASK.taskLater(r, delay);
|
PS.get().TASK.taskLater(r, delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTaskLaterAsync(final Runnable r, final int delay) {
|
public static void runTaskLaterAsync(final Runnable r, final int delay) {
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
|
if (PS.get().TASK == null) {
|
||||||
|
r.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
PS.get().TASK.taskLaterAsync(r, delay);
|
PS.get().TASK.taskLaterAsync(r, delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|||||||
final String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
|
final String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
|
||||||
version[0] = Integer.parseInt(split[0]);
|
version[0] = Integer.parseInt(split[0]);
|
||||||
version[1] = Integer.parseInt(split[1]);
|
version[1] = Integer.parseInt(split[1]);
|
||||||
if (version.length == 3) {
|
if (split.length == 3) {
|
||||||
version[2] = Integer.parseInt(split[2]);
|
version[2] = Integer.parseInt(split[2]);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user