当前位置: 首页>>代码示例>>Java>>正文


Java BukkitWorker类代码示例

本文整理汇总了Java中org.bukkit.scheduler.BukkitWorker的典型用法代码示例。如果您正苦于以下问题:Java BukkitWorker类的具体用法?Java BukkitWorker怎么用?Java BukkitWorker使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BukkitWorker类属于org.bukkit.scheduler包,在下文中一共展示了BukkitWorker类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reload

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
@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();

}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:25,代码来源:TestServer.java

示例2: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
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;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:16,代码来源:CraftScheduler.java

示例3: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
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;
}
 
开发者ID:MagicDroidX,项目名称:Brynhildr,代码行数:16,代码来源:NukkitScheduler.java

示例4: reload

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mastercake10,项目名称:TimeIsMoney,代码行数:14,代码来源:Main.java

示例5: getPendingTasks

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
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;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:13,代码来源:TaskCloser.java

示例6: mockActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
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);
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:11,代码来源:TaskCloserTest.java

示例7: mockBukkitWorker

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
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;
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:8,代码来源:TaskCloserTest.java

示例8: getWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
LinkedList<BukkitWorker> getWorkers() {
    return workers;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:4,代码来源:CraftAsyncTask.java

示例9: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
@Override
public List<BukkitWorker> getActiveWorkers()
{
	// TODO Auto-generated method stub
	throw new UnimplementedOperationException();
}
 
开发者ID:seeseemelk,项目名称:MockBukkit,代码行数:7,代码来源:BukkitSchedulerMock.java

示例10: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
@Override
public List<BukkitWorker> getActiveWorkers() {
    return delegate.getActiveWorkers();
}
 
开发者ID:VoxelGamesLib,项目名称:VoxelGamesLibv2,代码行数:5,代码来源:LoggedScheduler.java

示例11: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
@Override
public List<BukkitWorker> getActiveWorkers() {
    return Collections.emptyList();
}
 
开发者ID:lukas81298,项目名称:FlexMC,代码行数:5,代码来源:FlexScheduler.java

示例12: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
@Override
public List<BukkitWorker> getActiveWorkers() {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:6,代码来源:TestScheduler.java

示例13: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
@Override
public List<BukkitWorker> getActiveWorkers() {
	throw Pokkit.unsupported();

}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:6,代码来源:PokkitScheduler.java

示例14: getActiveWorkers

import org.bukkit.scheduler.BukkitWorker; //导入依赖的package包/类
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>();
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:6,代码来源:CanaryScheduler.java


注:本文中的org.bukkit.scheduler.BukkitWorker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。