org.bukkit.event.server.ServerLoadEvent Java Examples

The following examples show how to use org.bukkit.event.server.ServerLoadEvent. 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: ServerLoadEventListener.java    From PlaceholderAPI with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method will be called when the server is first loaded
 *
 * The goal of the method is to register all the expansions as soon as possible
 * especially before players can join
 *
 * This will ensure no issues with expanions and hooks.
 * @param e the server load event
 */
@EventHandler
public void onServerLoad(ServerLoadEvent e) {
    plugin.getLogger().info("Placeholder expansion registration initializing...");
    final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
    plugin.getExpansionManager().registerAllExpansions();

    if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
        alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook);
    }
}
 
Example #2
Source File: ServerLoad.java    From StackMob-3 with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onServerLoad(ServerLoadEvent event) {
    List<World> worlds = Bukkit.getWorlds();
    for (int i = 0; i < worlds.size(); i++) {
        int period = (int) Math.round(sm.getCustomConfig().getDouble("task-delay") / worlds.size()) * (i == 0 ? 1 : i);
        new StackTask(sm, worlds.get(i)).runTaskTimer(sm, 100, period);
    }
}
 
Example #3
Source File: Dispatcher.java    From Chimera with MIT License 4 votes vote down vote up
@EventHandler
protected void update(ServerLoadEvent event) {
    dispatcher = server.getCommandDispatcher().a();
    walker.prune(dispatcher.getRoot(), getRoot().getChildren());
}