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


Java ServerTaskManager类代码示例

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


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

示例1: onPlayerChat

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
@HookHandler(ignoreCanceled=true,priority=Priority.PASSIVE)
public void onPlayerChat(ChatHook evt) {
    final Player p = evt.getPlayer();
    final String msg = evt.getMessage();
    ServerTaskManager.addTask(new ServerTask(DynmapPlugin.this, 1) {
        public void run() {
            DynmapPlayer dp = null;
            if(p != null)
                dp = new BukkitPlayer(p);
            core.listenerManager.processChatEvent(EventType.PLAYER_CHAT, dp, msg);
        }
    });
}
 
开发者ID:webbukkit,项目名称:DynmapCanary,代码行数:14,代码来源:DynmapPlugin.java

示例2: cancelTasks

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
public void cancelTasks(Plugin plugin) {
    ServerTaskManager.removeTasks(new BukkitTaskOwner(plugin));
    for (Map.Entry<Integer, CanaryTask> integerCanaryTaskEntry : tasks.entrySet()) {
        if (integerCanaryTaskEntry.getValue().getOwner().equals(plugin)) {
            tasks.remove(integerCanaryTaskEntry.getKey());
        }
    }
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:9,代码来源:CanaryScheduler.java

示例3: makeTask

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
public BukkitTask makeTask(Plugin plugin, Runnable task, long delay, long period, boolean isAsync, boolean repeat) {
    if (delay < 0l) {
        delay = 0;
    }
    if (period == 0l) {
        period = 1l;
    } else if (period < -1l) {
        period = -1l;
    }
    // TODO Need to handle Asynchronous task maybe?
    CanaryTask btask = new CanaryTask(plugin, task, nextId(), delay, period, isAsync, repeat);
    tasks.put(btask.getTaskId(), btask);
    ServerTaskManager.addTask(btask.getServerTask());
    return btask;
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:16,代码来源:CanaryScheduler.java

示例4: cancelTask

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
public void cancelTask(int taskId) {
    ServerTaskManager.removeTask(tasks.get(taskId).getServerTask());
    tasks.remove(taskId);
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:5,代码来源:CanaryScheduler.java

示例5: isQueued

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
public boolean isQueued(int taskId) {
    CanaryTask task = tasks.get(taskId);
    return task != null && ServerTaskManager.isQueued(task.getServerTask());
}
 
开发者ID:CanaryBukkitTeam,项目名称:CanaryBukkit,代码行数:5,代码来源:CanaryScheduler.java

示例6: tick

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
/**
 * @author jamierocks - 2nd October 2016
 * @reason Run server tasks, and use auto-save interval
 */
@Overwrite
protected void tick() {
    ServerTaskManager.runTasks(); // Neptune - Run tasks

    long i = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling) {
        this.startProfiling = false;
        this.theProfiler.profilingEnabled = true;
        this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (i - this.nanoTimeSinceStatusRefresh >= 5000000000L) {
        this.nanoTimeSinceStatusRefresh = i;
        this.statusResponse.setPlayerCountData(new ServerStatusResponse.PlayerCountData(this.getMaxPlayers(), this.getCurrentPlayerCount()));
        GameProfile[] agameprofile = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
        int j = MathHelper.getRandomIntegerInRange(this.random, 0, this.getCurrentPlayerCount() - agameprofile.length);

        for (int k = 0; k < agameprofile.length; ++k) {
            agameprofile[k] = this.serverConfigManager.getPlayerList().get(j + k).getGameProfile();
        }

        Collections.shuffle(Arrays.asList(agameprofile));
        this.statusResponse.getPlayerCountData().setPlayers(agameprofile);
    }

    if (this.tickCounter % Configuration.getServerConfig().getWorldAutoSaveInterval() == 0) { // Neptune - use auto-save interval
        this.theProfiler.startSection("save");
        this.serverConfigManager.saveAllPlayerData();
        this.saveAllWorlds(true);
        this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - i;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100) {
        this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0) {
        this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:58,代码来源:MixinMinecraftServer.java

示例7: addSynchronousTask

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
@Override
public boolean addSynchronousTask(ServerTask task) {
    return ServerTaskManager.addTask(task);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinMinecraftServer.java

示例8: removeSynchronousTask

import net.canarymod.tasks.ServerTaskManager; //导入依赖的package包/类
@Override
public boolean removeSynchronousTask(ServerTask task) {
    return ServerTaskManager.removeTask(task);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:5,代码来源:MixinMinecraftServer.java


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