當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。