Class ServerLifecycleHooks
java.lang.Object
net.ixdarklord.coolcatcore.api.hooks.ServerLifecycleHooks
A utility class that helps track the current Minecraft server instance
during the server lifecycle. This allows easy access to the server instance
across your mod.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable net.minecraft.server.MinecraftServerRetrieves the current Minecraft server instance.static booleanChecks if the current server instance is valid (not null).static voidupdateServerState(@Nullable net.minecraft.server.MinecraftServer server) Updates the current server instance.
-
Constructor Details
-
ServerLifecycleHooks
public ServerLifecycleHooks()
-
-
Method Details
-
updateServerState
public static void updateServerState(@Nullable @Nullable net.minecraft.server.MinecraftServer server) Updates the current server instance.- Parameters:
server- The new server instance, or null if the server is stopping.
-
getCurrentServer
@Nullable public static @Nullable net.minecraft.server.MinecraftServer getCurrentServer()Retrieves the current Minecraft server instance.- Returns:
- The current server instance, or null if the server is not started.
-
isServerAvailable
public static boolean isServerAvailable()Checks if the current server instance is valid (not null).- Returns:
- true if the server is available, false if not.
-