Package me.kzlyth.api.vanish


package me.kzlyth.api.vanish
API package for vanishing and unvanishing players in Zenith-Mod.

This package contains the VanishAPI class, which provides methods to make players invisible (vanished) or visible again. When a player is vanished, they are hidden from other players (except those with the see permission), and staff notifications are automatically sent if configured.

Database Compatibility: This API does not directly interact with the database, but vanished players are persisted to a JSON file for persistence across server restarts.

Features:

  • Vanish: Make players invisible
  • Unvanish: Make players visible again
  • Toggle Vanish: Toggle vanish state
  • Check Vanish Status: Check if a player is vanished
  • Get Vanished Players: Get a list of all vanished players

Important Notes:

  • Players must be online to be vanished/unvanished
  • Vanished players are hidden from other players without the see permission
  • Staff notifications are automatically sent when players vanish/unvanish
  • Vanished state is persisted across server restarts

Example usage:


 ZenithAPI api = ZenithAPI.getInstance();
 if (api != null) {
     VanishAPI vanishAPI = api.getVanishAPI();
     
     UUID playerUuid = UUID.fromString("123e4567-e89b-12d3-a456-426614174000");
     
     // Vanish player
     vanishAPI.vanish(playerUuid).thenAccept(success -> {
         if (success) {
             getLogger().info("Player vanished");
         }
     });
     
     // Check if vanished
     vanishAPI.isVanished(playerUuid).thenAccept(vanished -> {
         if (vanished) {
             getLogger().info("Player is vanished");
         }
     });
     
     // Unvanish player
     vanishAPI.unvanish(playerUuid).thenAccept(success -> {
         if (success) {
             getLogger().info("Player unvanished");
         }
     });
     
     // Get all vanished players
     vanishAPI.getVanishedPlayers().thenAccept(vanishedPlayers -> {
         getLogger().info("Currently vanished players: " + vanishedPlayers.size());
     });
 }
 
Seit:
1.2.3
Autor:
Zenith-Studios
  • Klassen
    Klasse
    Beschreibung
    API for vanishing and unvanishing players in Zenith-Mod.