org.spongepowered.api.event.game.state.GameStartingServerEvent Java Examples

The following examples show how to use org.spongepowered.api.event.game.state.GameStartingServerEvent. 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: SpongePlugin.java    From BlueMap with MIT License 6 votes vote down vote up
@Listener
public void onServerStart(GameStartingServerEvent evt) {
	asyncExecutor = Sponge.getScheduler().createAsyncExecutor(this);
	
	//save all world properties to generate level_sponge.dat files
	for (WorldProperties properties : Sponge.getServer().getAllWorldProperties()) {
		Sponge.getServer().saveWorldProperties(properties);
	}
	
	//register commands
	for(SpongeCommandProxy command : commands.getRootCommands()) {
		Sponge.getCommandManager().register(this, command, command.getLabel());
	}
	
	asyncExecutor.execute(() -> {
		try {
			Logger.global.logInfo("Loading...");
			bluemap.load();
			if (bluemap.isLoaded()) Logger.global.logInfo("Loaded!");
		} catch (Throwable t) {
			Logger.global.logError("Failed to load!", t);
		}
	});
}
 
Example #2
Source File: VirtualChestPlugin.java    From VirtualChest with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Listener
public void onStartingServer(GameStartingServerEvent event)
{
    this.recordManager.init();
    this.virtualChestCommandManager.init();
    this.economyManager.init();
    this.permissionManager.init();
    this.virtualChestActions.init();
}