Class ServerLifecycleHooks

java.lang.Object
net.ixdarklord.coolcatcore.api.hooks.ServerLifecycleHooks

public class ServerLifecycleHooks extends Object
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 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.