### Example Plugin with Vanish Event Handling
Source: https://quantioms.gitbook.io/advancedvanish/api
Demonstrates how to register events and react to player vanish and unvanish actions. The example shows logging vanish events and cancelling pre-unvanish events.
```kotlin
class ExamplePlugin : JavaPlugin(), Listener {
override fun onEnable() {
this.server.pluginManager.registerEvents(this, this)
}
@EventHandler
private fun onVanish(event: PlayerVanishEvent) {
val vanishedPlayers = AdvancedVanishAPI.vanishedPlayers
.map(Bukkit::getPlayer)
.joinToString(", ", transform = Player::getName)
this.logger.log(Level.INFO, "${event.player.name} has entered vanish.")
this.logger.log(Level.INFO, "Current vanished players: ${vanishedPlayers}.")
}
@EventHandler
private fun onUnVanish(event: PrePlayerUnVanishEvent) {
event.isCancelled = true // Don't let players unvanish
}
}
```
--------------------------------
### Gradle Dependency Setup
Source: https://quantioms.gitbook.io/advancedvanish/api
Configure your build.gradle file to include the quantiom Maven repository and the AdvancedVanish dependency.
```groovy
allprojects {
repositories {
...
maven { url 'https://repo.repsy.io/mvn/quantiom/minecraft' }
}
}
```
```groovy
dependencies {
implementation 'me.quantiom:advancedvanish:1.2.2'
}
```
--------------------------------
### Maven Dependency Setup
Source: https://quantioms.gitbook.io/advancedvanish/api
Add the quantiom Maven repository and the AdvancedVanish dependency to your project's pom.xml.
```xml
repsy
quantiom
https://repo.repsy.io/mvn/quantiom/minecraft
```
```xml
me.quantiom
advancedvanish
1.2.2
```
--------------------------------
### HTTP GET Request for Dynamic Querying
Source: https://quantioms.gitbook.io/advancedvanish/api
To get additional information not explicitly present on the page, perform an HTTP GET request with the 'ask' query parameter.
```http
GET https://quantioms.gitbook.io/advancedvanish/api.md?ask=
```
--------------------------------
### Basic Configuration for Advanced Vanish
Source: https://quantioms.gitbook.io/advancedvanish/config
This snippet shows the main configuration options for the Advanced Vanish plugin. It includes settings for update checks, vanish-on-join, preserving vanish state, and cross-server support.
```yaml
# _ ___ __ _ _ #
# /\ | | | \ \ / / (_) | | #
# / \ __| |_ ____ _ _ __ ___ ___ __| |\ \ / /_ _ _ __ _ ___| |__ #
# / /\ \ / _` |\ \ / / _` | '_ \ / __/ _ \/ _` | \ \/ / _` | '_ \| / __| '_ \ #
# / ____ \ (_| |\ V / (_| | | | | (_| __/ (_| | \ / (_| | | | | \__ \ | | | #
# /_/ \_\__,_| \_/ \__,_|_| |_|\___\___|\__,_| \/ \__,_|_| |_|_|___/_| |_| #
###################################################################################
# Made by quantiom, config made for v1.2.2
# GitBook page: https://quantioms.gitbook.io/advancedvanish/
# Messages in this config use MiniMessage formatting
# For example, the message "&4Hello &a&lWorld" would need to be "Hello World"
# Please check the documentation for more information: https://docs.adventure.kyori.net/minimessage/format.html
# Automatically check for updates
check-for-updates: true
# WARNING: The three following options will be IGNORED if cross-server-support is enabled
# Enable vanish on join
vanish-on-join: true
# Saves the vanish state when a player logs off
# Example: Player joins with `vanish-on-join` enabled, turns
# off vanish, and rejoins without vanish enabled
keep-vanish-state: false
# The option above must be set to true
# Stores vanish states to a file, so they
# persist outside of server restarts
keep-vanish-state-persistent: false
# Cross-server vanish synchronization
# Requires Redis or SQL
cross-server-support:
enabled: false
# Either "redis" or "sql"
mode: "redis"
redis:
ip: "127.0.0.1"
port: 6379
auth: ""
sql:
ip: "127.0.0.1"
port: 3306
username: "root"
password: ""
database: "minecraft"
table-prefix: "advancedvanish_"
```
--------------------------------
### Vanish Help Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Access the help information for AdvancedVanish using the /vanish help command. The permission required is 'advancedvanish.help-command'. This command's messages are not configurable.
```bash
/vanish help
```
--------------------------------
### AdvancedVanishAPI Methods
Source: https://quantioms.gitbook.io/advancedvanish/api
These methods allow you to interact with the AdvancedVanish plugin to manage player vanish states. They can be called from Java or Kotlin.
```APIDOC
## AdvancedVanishAPI Methods
### Description
Provides core functionality for managing player vanish states within the AdvancedVanish plugin.
### Methods
- `vanishPlayer(player: Player): Unit` - Vanishes the specified player.
- `unVanishPlayer(player: Player): Unit` - Unvanishes the specified player.
- `isPlayerVanished(player: Player): Boolean` - Checks if the specified player is currently vanished.
- `canSee(player: Player, target: Player): Boolean` - Determines if the first player can see the target player (i.e., if the target player is not vanished from the first player's perspective).
```
--------------------------------
### Set Vanish Priority with bPermissions
Source: https://quantioms.gitbook.io/advancedvanish/features
Use this command with bPermissions to set a player's vanish priority. Higher numbers grant more priority. This allows players with higher priorities to see vanished players with lower priorities.
```bash
(/user OR /group) meta
```
--------------------------------
### Core AdvancedVanish API Methods
Source: https://quantioms.gitbook.io/advancedvanish/api
These methods allow direct control over player vanish states and visibility checks. They can be called from Java or Kotlin.
```kotlin
AdvancedVanishAPI.vanishPlayer(player: Player): Unit
```
```kotlin
AdvancedVanishAPI.unVanishPlayer(player: Player): Unit
```
```kotlin
AdvancedVanishAPI.isPlayerVanished(player: Player): Boolean
```
```kotlin
AdvancedVanishAPI.canSee(player: Player, target: Player): Boolean
```
--------------------------------
### Fake Join/Leave Messages Configuration
Source: https://quantioms.gitbook.io/advancedvanish/config
Configure fake join and leave messages to be displayed when players vanish or unvanish. These messages can be customized using placeholders like %player-name% and %priority%.
```yaml
# Fake join/leave messages
join-leave-messages:
fake-join-message-on-unvanish:
enable: false
# Placeholders:
# %priority% - The player's vanish priority
message: "%player-name% has joined the game"
fake-leave-message-on-vanish:
enable: false
# Placeholders:
# %player-name% - The player's name
message: "%player-name% has left the game."
```
--------------------------------
### Set Vanish Priority with LuckPerms
Source: https://quantioms.gitbook.io/advancedvanish/features
Use this command with LuckPerms to set a player's vanish priority. Higher numbers grant more priority. This allows players with higher priorities to see vanished players with lower priorities.
```bash
/lp user/group meta set meta.
```
--------------------------------
### Vanish Version Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Check the version of AdvancedVanish using the /vanish version command. The permission required is 'advancedvanish.version-command'. This command's messages are configurable.
```bash
/vanish version
```
--------------------------------
### Set Vanish Priority with GroupManager
Source: https://quantioms.gitbook.io/advancedvanish/features
For GroupManager, add the specified permission to grant vanish priority. AdvancedVanish will use the highest assigned number. This allows players with higher priorities to see vanished players with lower priorities.
```bash
meta-key.priority-num
```
--------------------------------
### Player Extension (Kotlin Only)
Source: https://quantioms.gitbook.io/advancedvanish/api
An extension function available only in Kotlin for checking if a player is vanished.
```APIDOC
## Player Extension (Kotlin Only)
### Description
Provides a convenient Kotlin extension function to check if a player is vanished.
### Method Signature
`Player.isVanished(): Boolean` - Returns true if the player is currently vanished, false otherwise.
```
--------------------------------
### Vanish List Command
Source: https://quantioms.gitbook.io/advancedvanish/features
View a list of vanished players with the /vanish list command. The permission required is 'advancedvanish.list-command'. This command's messages are configurable.
```bash
/vanish list
```
--------------------------------
### Vanish Priority Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Manage vanish priorities using the /vanish priority command. The permission required is 'advancedvanish.priority-command'. This command's messages are configurable.
```bash
/vanish priority
```
--------------------------------
### Permissions Configuration for Advanced Vanish
Source: https://quantioms.gitbook.io/advancedvanish/config
Defines the permission nodes required for various commands and features of the Advanced Vanish plugin. Ensure these are correctly assigned to player groups or individuals.
```yaml
# Permissions
permissions:
vanish: "advancedvanish.vanish"
version-command: "advancedvanish.version-command"
help-command: "advancedvanish.help-command"
reload-config-command: "advancedvanish.reload-config-command"
interact-command: "advancedvanish.interact-command"
priority-command: "advancedvanish.priority-command"
list-command: "advancedvanish.list-command"
status-command: "advancedvanish.status-command"
toggle-other-command: "advancedvanish.toggle-other-command"
set-other-command: "advancedvanish.set-other-command"
keep-fly-on-unvanish: "advancedvanish.keep-fly"
join-vanished: "advancedvanish.join-vanished"
```
--------------------------------
### Vanish Actions Configuration
Source: https://quantioms.gitbook.io/advancedvanish/config
Configure actions that are enabled or disabled when a player is vanished. This includes join/leave messages, block interactions, item pickups, and potion effects.
```yaml
# Actions when players are vanished
# true = enabled, false = disabled
when-vanished:
join-messages: false
leave-messages: false
send-messages: false
break-blocks: false
place-blocks: false
interact: false
attack-entities: false
receive-damage-from-entities: false
open-and-use-chests: false
pick-up-items: false
drop-items: false
# Find potion effect names here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
# Write each effect in this format: "NAME:AMPLIFIER"
# Example: "INVISIBILITY:2"
give-potion-effects:
- "INVISIBILITY:2"
- "NIGHT_VISION:1"
lose-hunger: false
mob-targeting: false
fly:
enable: true
keep-on-unvanish: false # The "keep-fly-on-unvanish" permission will override this if the player has that permission
```
--------------------------------
### Player Vanish Extension (Kotlin Only)
Source: https://quantioms.gitbook.io/advancedvanish/api
A Kotlin extension function to check if a player is currently vanished.
```kotlin
Player.isVanished(): Boolean
```
--------------------------------
### Vanish Reload Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Reload the AdvancedVanish configuration with the /vanish reload command. The permission required is 'advancedvanish.reload-config-command'. This command's messages are configurable.
```bash
/vanish reload
```
--------------------------------
### Vanish Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Use the /vanish command to toggle your own vanish status. The permission required is 'advancedvanish.vanish'. This command's messages are configurable.
```bash
/vanish
```
--------------------------------
### Vanish Set Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Force a player's vanish status on or off using the /vanish set command. The permission required is 'advancedvanish.set-other-command'. This command's messages are configurable.
```bash
/vanish set
```
--------------------------------
### Vanish Interact Command
Source: https://quantioms.gitbook.io/advancedvanish/features
The /vanish interact command is available. The permission required is 'advancedvanish.interact-command'. This command's messages are configurable.
```bash
/vanish interact
```
--------------------------------
### Vanish Status Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Check the vanish status of a specific player using the /vanish status command. The permission required is 'advancedvanish.status-command'. This command's messages are configurable.
```bash
/vanish status
```
--------------------------------
### AdvancedVanish Events
Source: https://quantioms.gitbook.io/advancedvanish/api
Events that are triggered during the vanish and unvanish processes, allowing for custom handling and cancellation.
```APIDOC
## AdvancedVanish Events
### Description
Events related to player vanishing and unvanishing actions.
### Events
- `PrePlayerVanishEvent` - Triggered before a player vanishes. Implements `Cancellable`.
- `PlayerVanishEvent` - Triggered after a player has vanished.
- `PrePlayerUnVanishEvent` - Triggered before a player unvanishes. Implements `Cancellable`.
- `PlayerUnVanishEvent` - Triggered after a player has unvanished.
```
--------------------------------
### Vanish Toggle Command
Source: https://quantioms.gitbook.io/advancedvanish/features
Toggle another player's vanish status with the /vanish toggle command. The permission required is 'advancedvanish.toggle-other-command'. This command's messages are configurable.
```bash
/vanish toggle
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.