9
0
mirror of https://github.com/HibiscusMC/HibiscusCommons.git synced 2025-12-19 15:09:26 +00:00

squash! feat: use vanished metadata rather than apis for each plugin

This commit is contained in:
lojosho
2025-04-29 22:43:40 -05:00
parent 6434132bf3
commit 2c4894c35c
4 changed files with 75 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ public class Hooks {
private static final HookCustomFishing CF_HOOK = new HookCustomFishing();
private static final HookGSit GSIT_HOOK = new HookGSit();
private static final HookCraftEngine CRAFT_ENGINE_HOOK = new HookCraftEngine();
private static final HookPremiumVanish PREMIUM_VANISH_HOOK = new HookPremiumVanish();
private static final HookSuperVanish SUPER_VANISH_HOOK = new HookSuperVanish();
private static boolean allHooksActive = false;

View File

@@ -0,0 +1,37 @@
package me.lojosho.hibiscuscommons.hooks.misc;
import de.myzelyam.api.vanish.PlayerHideEvent;
import de.myzelyam.api.vanish.PlayerShowEvent;
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerUnVanishEvent;
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerVanishEvent;
import me.lojosho.hibiscuscommons.hooks.Hook;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.jetbrains.annotations.NotNull;
import java.util.UUID;
/**
* A hook that integrates the plugin {@link de.myzelyam.api.vanish.VanishAPI Supervanish}
*
* @implSpec Supervanish and Premium Vanish both use the same api
*/
public class HookPremiumVanish extends Hook {
public HookPremiumVanish() {
super("PremiumVanish");
setActive(true);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerVanish(@NotNull PlayerHideEvent event) {
HibiscusPlayerVanishEvent newEvent = new HibiscusPlayerVanishEvent(this, event.getPlayer());
Bukkit.getPluginManager().callEvent(newEvent);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerShow(@NotNull PlayerShowEvent event) {
HibiscusPlayerUnVanishEvent newEvent = new HibiscusPlayerUnVanishEvent(this, event.getPlayer());
Bukkit.getPluginManager().callEvent(newEvent);
}
}

View File

@@ -0,0 +1,35 @@
package me.lojosho.hibiscuscommons.hooks.misc;
import de.myzelyam.api.vanish.PlayerHideEvent;
import de.myzelyam.api.vanish.PlayerShowEvent;
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerUnVanishEvent;
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerVanishEvent;
import me.lojosho.hibiscuscommons.hooks.Hook;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.jetbrains.annotations.NotNull;
/**
* A hook that integrates the plugin {@link de.myzelyam.api.vanish.VanishAPI Supervanish}
*
* @implSpec Supervanish and Premium Vanish both use the same api
*/
public class HookSuperVanish extends Hook {
public HookSuperVanish() {
super("SuperVanish");
setActive(true);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerVanish(@NotNull PlayerHideEvent event) {
HibiscusPlayerVanishEvent newEvent = new HibiscusPlayerVanishEvent(this, event.getPlayer());
Bukkit.getPluginManager().callEvent(newEvent);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerShow(@NotNull PlayerShowEvent event) {
HibiscusPlayerUnVanishEvent newEvent = new HibiscusPlayerUnVanishEvent(this, event.getPlayer());
Bukkit.getPluginManager().callEvent(newEvent);
}
}