diff --git a/src/main/java/themeparkcraft.core.api/Core.java b/src/main/java/themeparkcraft.core.api/Core.java index 050dd5a..e2b0587 100644 --- a/src/main/java/themeparkcraft.core.api/Core.java +++ b/src/main/java/themeparkcraft.core.api/Core.java @@ -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. + *
+ * 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(); + } } \ No newline at end of file diff --git a/src/main/java/themeparkcraft.core.api/CoreServer.java b/src/main/java/themeparkcraft.core.api/CoreServer.java index 1d29b5b..b0e25c1 100644 --- a/src/main/java/themeparkcraft.core.api/CoreServer.java +++ b/src/main/java/themeparkcraft.core.api/CoreServer.java @@ -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(); } diff --git a/src/main/java/themeparkcraft.core.api/server/Server.java b/src/main/java/themeparkcraft.core.api/server/Server.java new file mode 100644 index 0000000..c28eae2 --- /dev/null +++ b/src/main/java/themeparkcraft.core.api/server/Server.java @@ -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(); +}