This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrations: add SuperVanish support
- Loading branch information
Showing
6 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/net/flectone/integrations/supervanish/FSuperVanish.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package net.flectone.integrations.supervanish; | ||
|
||
import de.myzelyam.api.vanish.PlayerHideEvent; | ||
import de.myzelyam.api.vanish.PlayerShowEvent; | ||
import net.flectone.listeners.PlayerJoinListener; | ||
import net.flectone.listeners.PlayerQuitListener; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.metadata.MetadataValue; | ||
|
||
public class FSuperVanish implements Listener { | ||
|
||
public static boolean isVanished(Player player) { | ||
return player.getMetadata("vanished").parallelStream() | ||
.anyMatch(MetadataValue::asBoolean); | ||
} | ||
|
||
@EventHandler | ||
public void onHide(PlayerHideEvent e) { | ||
if(e.isCancelled()) return; | ||
PlayerQuitListener.sendQuitMessage(e.getPlayer()); | ||
} | ||
|
||
@EventHandler | ||
public void onShow(PlayerShowEvent e) { | ||
if(e.isCancelled()) return; | ||
PlayerJoinListener.sendJoinMessage(e.getPlayer()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters