Java 类org.bukkit.scheduler.BukkitWorker 实例源码

项目:ExilePearl    文件:TestServer.java   
@Override
public void reload() {
       pluginManager.clearPlugins();
       commandMap.clearCommands();
       resetRecipes();

       List<BukkitWorker> overdueWorkers = getScheduler().getActiveWorkers();
       for (BukkitWorker worker : overdueWorkers) {
           Plugin plugin = worker.getOwner();
           String author = "<NoAuthorGiven>";
           if (plugin.getDescription().getAuthors().size() > 0) {
               author = plugin.getDescription().getAuthors().get(0);
           }
           getLogger().log(Level.SEVERE, String.format(
               "Nag author: '%s' of '%s' about the following: %s",
               author,
               plugin.getDescription().getName(),
               "This plugin is not properly shutting down its async tasks when it is being reloaded.  This may cause conflicts with the newly loaded version of the plugin"
           ));
       }
       loadPlugins();
       enablePlugins();

}
项目:Uranium    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:ThermosRebased    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Brynhildr    文件:NukkitScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final NukkitTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final NukkitAsyncTask task = (NukkitAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Thermos    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:KCauldron    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:CauldronGit    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Cauldron-Old    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:TimeIsMoney    文件:Main.java   
/**
 * Reloads TimeIsMoney.
 */
void reload() {
    // cancelling current tasks
       for (BukkitWorker bw: Bukkit.getScheduler().getActiveWorkers()) {
           if (bw.getOwner() == this) {
               Bukkit.getScheduler().cancelTask(bw.getTaskId());
           }
       }
    Bukkit.getPluginManager().disablePlugin(this);
    Bukkit.getPluginManager().enablePlugin(this);
}
项目:Cauldron-Reloaded    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:FFoKC    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:CraftBukkit    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Craftbukkit    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Almura-Server    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Tweakkit-Server    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Cauldron    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:SpigotSource    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:AuthMeReloaded    文件:TaskCloser.java   
private List<Integer> getPendingTasks() {
    List<Integer> pendingTasks = new ArrayList<>();
    //returns only the async tasks
    for (BukkitWorker pendingTask : scheduler.getActiveWorkers()) {
        if (pendingTask.getOwner().equals(plugin)
            //it's not a periodic task
            && !scheduler.isQueued(pendingTask.getTaskId())) {
            pendingTasks.add(pendingTask.getTaskId());
        }
    }
    return pendingTasks;
}
项目:AuthMeReloaded    文件:TaskCloserTest.java   
private void mockActiveWorkers() {
    Plugin otherOwner = mock(Plugin.class);
    List<BukkitWorker> tasks = Arrays.asList(
        mockBukkitWorker(authMe, ACTIVE_WORKERS_ID[0], false),
        mockBukkitWorker(otherOwner, 3, false),
        mockBukkitWorker(authMe, ACTIVE_WORKERS_ID[1], false),
        mockBukkitWorker(authMe, 7, true),
        mockBukkitWorker(otherOwner, 11, true));
    given(bukkitScheduler.getActiveWorkers()).willReturn(tasks);
}
项目:AuthMeReloaded    文件:TaskCloserTest.java   
private BukkitWorker mockBukkitWorker(Plugin owner, int taskId, boolean isQueued) {
    BukkitWorker worker = mock(BukkitWorker.class);
    given(worker.getOwner()).willReturn(owner);
    given(worker.getTaskId()).willReturn(taskId);
    given(bukkitScheduler.isQueued(taskId)).willReturn(isQueued);
    return worker;
}
项目:Craft-city    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:MCPBukkit    文件:CraftScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
    for (final CraftTask taskObj : runners.values()) {
        // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
        if (taskObj.isSync()) {
            continue;
        }
        final CraftAsyncTask task = (CraftAsyncTask) taskObj;
        synchronized (task.getWorkers()) {
            // This will never have an issue with stale threads; it's state-safe
            workers.addAll(task.getWorkers());
        }
    }
    return workers;
}
项目:Uranium    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:MockBukkit    文件:BukkitSchedulerMock.java   
@Override
public List<BukkitWorker> getActiveWorkers()
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:VoxelGamesLibv2    文件:LoggedScheduler.java   
@Override
public List<BukkitWorker> getActiveWorkers() {
    return delegate.getActiveWorkers();
}
项目:FlexMC    文件:FlexScheduler.java   
@Override
public List<BukkitWorker> getActiveWorkers() {
    return Collections.emptyList();
}
项目:ThermosRebased    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:Brynhildr    文件:NukkitAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:ExilePearl    文件:TestScheduler.java   
@Override
public List<BukkitWorker> getActiveWorkers() {
    // TODO Auto-generated method stub
    return null;
}
项目:Pokkit    文件:PokkitScheduler.java   
@Override
public List<BukkitWorker> getActiveWorkers() {
    throw Pokkit.unsupported();

}
项目:Thermos    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:KCauldron    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:CauldronGit    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:CanaryBukkit    文件:CanaryScheduler.java   
public List<BukkitWorker> getActiveWorkers() {
    // TODO talk to dark about maybe adding Async task handling to ServerTaskManager
    // For now return a empty array list
    return new ArrayList<BukkitWorker>();
}
项目:Cauldron-Old    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:Cauldron-Reloaded    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:FFoKC    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:CraftBukkit    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:Craftbukkit    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
项目:Almura-Server    文件:CraftAsyncTask.java   
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}