Skip to content
LimeGlass edited this page Mar 11, 2021 · 3 revisions

Usage

public class ExamplePlugin extends JavaPlugin {

	private static ExamplePlugin instance;
	private ServerInstances serverInstances;

	@Override
	public void onEnable() {
		instance = this;
		try {
			serverInstances = new ServerInstances(this);
		} catch (ClassNotFoundException | SQLException | IOException e) {
			e.printStackTrace();
			return;
		}
	}

	public static ExamplePlugin getInstance() {
		return instance;
	}

	public ServerInstances getServerInstances() {
		return serverInstances;
	}

}
ExamplePlugin instance = ExamplePlugin.getInstance();
ServerInstances serverInstances = instance.getServerInstances();

String templateName = "Hub";

Optional<Template> optional = serverInstances.getTemplates().stream()
		.filter(template -> template.getName().equals(templateName))
		.findFirst();
if (!optional.isPresent())
	return;
try {
	serverInstances.createInstance(optional.get());
} catch (IOException | IllegalAccessException e) {
	e.printStackTrace();
}

We will extend the API for server management from the Bungeecord side with this bootloader over time.

Clone this wiki locally