cn.nukkit.scheduler.ServerScheduler Java Examples

The following examples show how to use cn.nukkit.scheduler.ServerScheduler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlanNukkitMocker.java    From Plan with GNU Lesser General Public License v3.0 6 votes vote down vote up
PlanNukkitMocker withServer() {
    Server serverMock = Mockito.mock(Server.class);
    doReturn("").when(serverMock).getIp();
    doReturn("Nukkit").when(serverMock).getName();
    doReturn(25565).when(serverMock).getPort();
    doReturn("1.12.2").when(serverMock).getVersion();
    doReturn("32423").when(serverMock).getNukkitVersion();
    doReturn(TestConstants.SERVER_MAX_PLAYERS).when(serverMock).getMaxPlayers();
    ConsoleCommandSender sender = Mockito.mock(ConsoleCommandSender.class);
    doReturn(sender).when(serverMock).getConsoleSender();

    ServerScheduler scheduler = Mockito.mock(ServerScheduler.class);
    doReturn(scheduler).when(serverMock).getScheduler();

    doReturn(serverMock).when(planMock).getServer();
    return this;
}
 
Example #2
Source File: Server.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public ServerScheduler getScheduler() {
    return scheduler;
}
 
Example #3
Source File: AbsNukkitRunnable.java    From Plan with GNU Lesser General Public License v3.0 4 votes vote down vote up
AbsNukkitRunnable(String name, NukkitPlugin plugin, ServerScheduler scheduler, long time) {
    this.name = name;
    this.scheduler = scheduler;
    this.time = time;
    this.plugin = plugin;
}
 
Example #4
Source File: Server.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public ServerScheduler getScheduler() {
    return scheduler;
}
 
Example #5
Source File: Server.java    From Jupiter with GNU General Public License v3.0 2 votes vote down vote up
/**
 * スケジューラを取得します。
 * <br>
 * <br>[Itsuのメモ: スケジューラの使い方]
 * <pre>
 * ・繰り返し
 * {@code
 *  TaskHandler th;
 *  th = this.getServer().getScheduler().scheduleRepeatingTask(null, new Runnable(){
 *      //繰り返す処理
 *  };, 間隔tick(int));
 *
 *
 * ・遅延してから繰り返し
 *  TaskHandler th;
 *  th = this.getServer().getScheduler().scheduleDelayedRepeatingTask(null, new Runnable(){
 *      //繰り返す処理
 *  };, 遅延tick(int), 間隔tick(int));
 *
 *
 *  ・スケジューラを止める
 *  th.cancel();
 * </pre>
 * [豆知識]
 * <br>20tick = 1秒です!
 * @return ServerScheduler
 */
public ServerScheduler getScheduler() {
    return scheduler;
}