mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	@@ -166,7 +166,7 @@ public class PS {
 | 
			
		||||
            setupDatabase();
 | 
			
		||||
            CommentManager.registerDefaultInboxes();
 | 
			
		||||
            // Tasks
 | 
			
		||||
            if (Settings.KILL_ROAD_MOBS) {
 | 
			
		||||
            if (Settings.KILL_ROAD_MOBS || Settings.KILL_ROAD_VEHICLES) {
 | 
			
		||||
                IMP.runEntityTask();
 | 
			
		||||
            }
 | 
			
		||||
            // Events
 | 
			
		||||
@@ -1460,6 +1460,7 @@ public class PS {
 | 
			
		||||
     */
 | 
			
		||||
    public void disable() {
 | 
			
		||||
        try {
 | 
			
		||||
            TASK = null;
 | 
			
		||||
            // Validate that all data in the db is correct
 | 
			
		||||
            DBFunc.validatePlots(getPlotsRaw());
 | 
			
		||||
            
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,9 @@ public abstract class TaskManager {
 | 
			
		||||
 | 
			
		||||
    public static int runTaskRepeat(final Runnable r, final int interval) {
 | 
			
		||||
        if (r != null) {
 | 
			
		||||
            if (PS.get().TASK == null) {
 | 
			
		||||
                throw new IllegalArgumentException("disabled");
 | 
			
		||||
            }
 | 
			
		||||
            return PS.get().TASK.taskRepeat(r, interval);
 | 
			
		||||
        }
 | 
			
		||||
        return -1;
 | 
			
		||||
@@ -21,6 +24,9 @@ public abstract class TaskManager {
 | 
			
		||||
    
 | 
			
		||||
    public static int runTaskRepeatAsync(final Runnable r, final int interval) {
 | 
			
		||||
        if (r != null) {
 | 
			
		||||
            if (PS.get().TASK == null) {
 | 
			
		||||
                throw new IllegalArgumentException("disabled");
 | 
			
		||||
            }
 | 
			
		||||
            return PS.get().TASK.taskRepeat(r, interval);
 | 
			
		||||
        }
 | 
			
		||||
        return -1;
 | 
			
		||||
@@ -28,12 +34,20 @@ public abstract class TaskManager {
 | 
			
		||||
 | 
			
		||||
    public static void runTaskAsync(final Runnable r) {
 | 
			
		||||
        if (r != null) {
 | 
			
		||||
            if (PS.get().TASK == null) {
 | 
			
		||||
                r.run();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            PS.get().TASK.taskAsync(r);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void runTask(final Runnable r) {
 | 
			
		||||
        if (r != null) {
 | 
			
		||||
            if (PS.get().TASK == null) {
 | 
			
		||||
                r.run();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            PS.get().TASK.task(r);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -45,12 +59,20 @@ public abstract class TaskManager {
 | 
			
		||||
     */
 | 
			
		||||
    public static void runTaskLater(final Runnable r, final int delay) {
 | 
			
		||||
        if (r != null) {
 | 
			
		||||
            if (PS.get().TASK == null) {
 | 
			
		||||
                r.run();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            PS.get().TASK.taskLater(r, delay);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void runTaskLaterAsync(final Runnable r, final int delay) {
 | 
			
		||||
        if (r != null) {
 | 
			
		||||
            if (PS.get().TASK == null) {
 | 
			
		||||
                r.run();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            PS.get().TASK.taskLaterAsync(r, delay);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user