Package org.bukkit.scheduler

Examples of org.bukkit.scheduler.BukkitScheduler


            }
        }
        listenerManager.setRegisterDirectly(false);
        listenerManager.clear();

        BukkitScheduler sched = getServer().getScheduler();

        // Stop data-man task.
        if (dataManTaskId != -1){
            sched.cancelTask(dataManTaskId);
            dataManTaskId = -1;
        }

        // Stop the tickTask.
        if (verbose) {
            LogUtil.logInfo("[NoCheatPlus] Stop TickTask...");
        }
        TickTask.setLocked(true);
        TickTask.purge();
        TickTask.cancel();
        TickTask.removeAllTickListeners();
        // (Keep the tick task locked!)

        // Stop consistency checking task.
        if (consistencyCheckerTaskId != -1){
            sched.cancelTask(consistencyCheckerTaskId);
            consistencyCheckerTaskId = -1;
        }

        // Just to be sure nothing gets left out.
        if (verbose) {
            LogUtil.logInfo("[NoCheatPlus] Stop all remaining tasks...");
        }
        sched.cancelTasks(this);

        // Exemptions cleanup.
        if (verbose) {
            LogUtil.logInfo("[NoCheatPlus] Reset ExemptionManager...");
        }
View Full Code Here


            }
        }
    }

    protected void scheduleConsistencyCheckers(){
        BukkitScheduler sched = getServer().getScheduler();
        if (consistencyCheckerTaskId != -1){
            sched.cancelTask(consistencyCheckerTaskId);
        }
        ConfigFile config = ConfigManager.getConfigFile();
        if (!config.getBoolean(ConfPaths.DATA_CONSISTENCYCHECKS_CHECK, true)) return;
        // Schedule task in seconds.
        final long delay = 20L * config.getInt(ConfPaths.DATA_CONSISTENCYCHECKS_INTERVAL, 1, 3600, 10);
        consistencyCheckerTaskId = sched.scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                runConsistencyChecks();
            }
        }, delay, delay );
View Full Code Here

            player.teleport(player.getWorld().getSpawnLocation());
        }

        int delay = settings.getRegistrationTimeout() * 20;
        int interval = settings.getWarnMessageInterval();
        BukkitScheduler sched = sender.getServer().getScheduler();
        if (delay != 0) {
            int id = sched.scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), delay);
            LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
        }
        sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, m._("login_msg"), interval));

        player.sendMessage(m._("logout"));
        ConsoleLogger.info(player.getDisplayName() + " logged out");
        return true;
    }
View Full Code Here

        for (Player player : plugin.getServer().getOnlinePlayers()) {
            if (player.getName().toLowerCase().equals(name)) {
                player.sendMessage(msg);

                BukkitScheduler sched = plugin.getServer().getScheduler();
                sched.scheduleSyncDelayedTask(plugin, this, interval * 20);
            }
        }
    }
View Full Code Here

        }

        String msg = data.isAuthAvailable(name) ? m._("login_msg") : m._("reg_msg");
        int time = settings.getRegistrationTimeout() * 20;
        int msgInterval = settings.getWarnMessageInterval();
        BukkitScheduler sched = plugin.getServer().getScheduler();
        if (time != 0) {
            int id = sched.scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), time);
            LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
        }
        sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
    }
View Full Code Here

                player.getInventory().setArmorContents(new ItemStack[0]);
                player.getInventory().setContents(new ItemStack[36]);

                int delay = settings.getRegistrationTimeout() * 20;
                int interval = settings.getWarnMessageInterval();
                BukkitScheduler sched = sender.getServer().getScheduler();
                if (delay != 0) {
                    int id = sched.scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), delay);
                    LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
                }
                sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, m._("reg_msg"), interval));

                player.sendMessage("unregistered");
                ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
            } else {
                player.sendMessage(m._("wrong_pwd"));
View Full Code Here

            }

            String msg = authAvail ? m._("login_msg") : m._("reg_msg");
            int time = settings.getRegistrationTimeout() * 20;
            int msgInterval = settings.getWarnMessageInterval();
            BukkitScheduler sched = this.getServer().getScheduler();
            if (time != 0) {
                int id = sched.scheduleSyncDelayedTask(this, new TimeoutTask(this, name), time);
                LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
            }
            sched.scheduleSyncDelayedTask(this, new MessageTask(this, name, msg, msgInterval));
        }
    }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public void onEnable() {
    FileConfiguration configuration = getConfig();
    BukkitScheduler scheduler = getServer().getScheduler();

    // Copy the default configuration if it hasn't been copied already
    saveDefaultConfig();

    // Update old configurations with new key-value pairs
    configuration.options().copyDefaults(true);

    // Get configuration.
    configurationHandler = new Configuration(configuration);
    int entityUpdatePeriod = configurationHandler.getEntityUpdatePeriod();
    int listUpdatePeriod = configurationHandler.getListUpdatePeriod();

    // Get worker information from disk.
    getWorkerInfoFromDisk();

    // Update the worker information with configuration.
    for (WorkerInfo i : workerStack.values()) {
      i.setConfiguration(configurationHandler);
    }

    // Launch the BEAST !
    getServer().getPluginManager().registerEvents(this, this);

    // List updater.
    scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
      @Override
      public void run() {
        checkEntities();
      }
    }, 10, listUpdatePeriod);

    // Entity updater.
    scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
      @Override
      public void run() {
        updateEntities();
      }
    }, 15, entityUpdatePeriod);
View Full Code Here

                    });

            when(mockServer.unloadWorld(anyString(), anyBoolean())).thenReturn(true);

            // add mock scheduler
            BukkitScheduler mockScheduler = mock(BukkitScheduler.class);
            when(mockScheduler.scheduleSyncDelayedTask(any(Plugin.class), any(Runnable.class), anyLong())).
            thenAnswer(new Answer<Integer>() {
                @Override
                public Integer answer(InvocationOnMock invocation) throws Throwable {
                    Runnable arg;
                    try {
                        arg = (Runnable) invocation.getArguments()[1];
                    } catch (Exception e) {
                        return null;
                    }
                    arg.run();
                    return null;
                }});
            when(mockScheduler.scheduleSyncDelayedTask(any(Plugin.class), any(Runnable.class))).
            thenAnswer(new Answer<Integer>() {
                @Override
                public Integer answer(InvocationOnMock invocation) throws Throwable {
                    Runnable arg;
                    try {
View Full Code Here

TOP

Related Classes of org.bukkit.scheduler.BukkitScheduler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.