Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/main/java/themeparkcraft.core.api/Core.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
package themeparkcraft.core.api;

import org.bukkit.plugin.java.JavaPlugin;
import themeparkcraft.core.api.server.Server;

import javax.annotation.Nonnull;

@SuppressWarnings({"unused", "UnusedReturnValue"})
public final class Core {

private static CoreServer server;

/**
* Get the JavaPlugin instance of CorePlugin.
* <br>
* This gives you access to some Bukkit features that rely on this instance.
*
* @return JavaPlugin instance of CorePlugin
*/
@Nonnull
public static JavaPlugin getInstance() {
return server.getInstance();
}

/**
* Get the {@link Server} object, granting access to all server-related features.
*
* @return Server object
*/
@Nonnull
public static Server server() {
return server.server();
}
}
10 changes: 10 additions & 0 deletions src/main/java/themeparkcraft.core.api/CoreServer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
package themeparkcraft.core.api;

import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.ApiStatus;
import themeparkcraft.core.api.server.Server;

import javax.annotation.Nonnull;

@ApiStatus.Internal
public interface CoreServer {

@Nonnull
JavaPlugin getInstance();

@Nonnull
Server server();
}
27 changes: 27 additions & 0 deletions src/main/java/themeparkcraft.core.api/server/Server.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package themeparkcraft.core.api.server;

import javax.annotation.Nonnull;

@SuppressWarnings("unused")
public interface Server {

/**
* Get the server type.
*
* @return the server type
*/
@Nonnull
ServerType type();

/**
* Gets whether the server is fully started.
*
* @return true, if the server is fully started
*/
boolean isFullyStarted();

/**
* Restarts the server.
*/
void restart();
}
Loading