I) Adding ZelVanish as a dependency

Maven

<repository>
	<id>repsy.io/</id>
	<url><https://repo.repsy.io/mvn/zeltuv/zelvanish></url>
</repository>
<dependency>
	<groupId>com.zeltuv</groupId>
	<artifactId>zelvanish-api</artifactId>
	<version>1.0.0</version>
	<scope>provided</scope>
</dependency>

Gradle

repositories {
	mavenCentral()
	maven { url '<https://repo.repsy.io/mvn/zeltuv/zelvanish>' }
}

dependencies {
	compileOnly 'com.zeltuv:zelvanish-api:1.0.0'
}

Add ZelVanish to your plugin's softdepend in plugin.yml so it loads first.


II) Accessing the API

ZelVanish exposes a single interface, ZelVanishApi, obtained from ZelVanishProvider. Both live in the com.zeltuv.zelvanish.api package, which is excluded from obfuscation — symbol names are stable across releases.

import com.zeltuv.zelvanish.api.ZelVanishApi;
import com.zeltuv.zelvanish.api.ZelVanishProvider;

ZelVanishApi vanish = ZelVanishProvider.get();

ZelVanishProvider.get() throws IllegalStateException if ZelVanish isn't loaded yet, gate your initial calls on onEnable after the plugin loader has run.


🩵 The ZelVanishApi interface

State changes

// Vanish a player. Returns true if the state changed.
boolean changed = vanish.vanishPlayer(player);

// onJoin = true suppresses the vanish broadcast and delays potion effects
// so they survive the join sequence.
vanish.vanishPlayer(player, true);

// Unvanish. onLeave = true suppresses the unvanish broadcast.
vanish.unvanishPlayer(player);
vanish.unvanishPlayer(player, true);

// Flip and return the new state.
boolean nowVanished = vanish.toggleVanish(player);

Queries

boolean hidden = vanish.isPlayerVanished(player);
boolean hidden = vanish.isPlayerVanished(playerUuid);

// Whether viewer should be able to see target.
boolean visible = vanish.canSee(viewer, target);

int total          = vanish.getVanishedPlayerCount();          // all known vanished IDs
int onlineVanished = vanish.getOnlineVanishedPlayerCount();    // online subset
int publicCount    = vanish.getVisibleOnlinePlayerCount();     // what /list / scoreboard should show

Set<UUID> ids   = vanish.getVanishedPlayerIds();        // immutable snapshot
List<Player> on = vanish.getOnlineVanishedPlayers();    // immutable snapshot

🪝 Events

All four events fire on the Bukkit event bus and respect the standard @EventHandler priorities. The two Pre… events are Cancellable ; cancel them to veto the action.