Skip to content

Commit 2b42599

Browse files
authored
feat: add server (#1)
1 parent 7c6e569 commit 2b42599

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
package themeparkcraft.core.api;
22

3+
import org.bukkit.plugin.java.JavaPlugin;
4+
import themeparkcraft.core.api.server.Server;
5+
6+
import javax.annotation.Nonnull;
7+
38
@SuppressWarnings({"unused", "UnusedReturnValue"})
49
public final class Core {
510

11+
private static CoreServer server;
12+
13+
/**
14+
* Get the JavaPlugin instance of CorePlugin.
15+
* <br>
16+
* This gives you access to some Bukkit features that rely on this instance.
17+
*
18+
* @return JavaPlugin instance of CorePlugin
19+
*/
20+
@Nonnull
21+
public static JavaPlugin getInstance() {
22+
return server.getInstance();
23+
}
624

25+
/**
26+
* Get the {@link Server} object, granting access to all server-related features.
27+
*
28+
* @return Server object
29+
*/
30+
@Nonnull
31+
public static Server server() {
32+
return server.server();
33+
}
734
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
package themeparkcraft.core.api;
22

3+
import org.bukkit.plugin.java.JavaPlugin;
34
import org.jetbrains.annotations.ApiStatus;
5+
import themeparkcraft.core.api.server.Server;
6+
7+
import javax.annotation.Nonnull;
48

59
@ApiStatus.Internal
610
public interface CoreServer {
11+
12+
@Nonnull
13+
JavaPlugin getInstance();
14+
15+
@Nonnull
16+
Server server();
717
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package themeparkcraft.core.api.server;
2+
3+
import javax.annotation.Nonnull;
4+
5+
@SuppressWarnings("unused")
6+
public interface Server {
7+
8+
/**
9+
* Get the server type.
10+
*
11+
* @return the server type
12+
*/
13+
@Nonnull
14+
ServerType type();
15+
16+
/**
17+
* Gets whether the server is fully started.
18+
*
19+
* @return true, if the server is fully started
20+
*/
21+
boolean isFullyStarted();
22+
23+
/**
24+
* Restarts the server.
25+
*/
26+
void restart();
27+
}

0 commit comments

Comments
 (0)