Klasse APIUnavailableException

Alle implementierten Schnittstellen:
Serializable

public class APIUnavailableException extends ZenithAPIException
Exception thrown when the API is not available or the plugin is not enabled.

This exception is typically thrown when attempting to access the API before the plugin has fully loaded or after it has been disabled.

Example:


 ZenithAPI api = ZenithAPI.getInstance();
 if (api == null) {
     throw new APIUnavailableException("Zenith-Mod is not loaded");
 }
 
 if (!api.isAvailable()) {
     throw new APIUnavailableException("Zenith-Mod is disabled");
 }
 
Seit:
1.2.3
Autor:
Zenith-Studios
Siehe auch:
  • Konstruktordetails

    • APIUnavailableException

      public APIUnavailableException()
      Constructs a new APIUnavailableException with a default message.

      Example:

      
       if (!api.isAvailable()) {
           throw new APIUnavailableException();
       }
       
    • APIUnavailableException

      public APIUnavailableException(@Nullable @Nullable String message)
      Constructs a new APIUnavailableException with the specified detail message.

      Example:

      
       throw new APIUnavailableException("Zenith-Mod plugin was disabled");
       
      Parameter:
      message - The detail message
    • APIUnavailableException

      public APIUnavailableException(@Nullable @Nullable String message, @Nullable @Nullable Throwable cause)
      Constructs a new APIUnavailableException with the specified detail message and cause.

      Example:

      
       try {
           // Try to access API
       } catch (Exception e) {
           throw new APIUnavailableException("API failed to initialize", e);
       }
       
      Parameter:
      message - The detail message
      cause - The cause of this exception