mirror of
https://github.com/HibiscusMC/HibiscusCommons.git
synced 2025-12-19 15:09:26 +00:00
feat: gsit hook support
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package me.lojosho.hibiscuscommons.api.events;
|
||||
|
||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HibiscusPlayerPoseEvent extends HibiscusHookPlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean gettingUp = false;
|
||||
|
||||
public HibiscusPlayerPoseEvent(Hook hook, Player player, boolean gettingUp) {
|
||||
super(hook, player);
|
||||
this.gettingUp = gettingUp;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the player is getting up from a laying down pose.
|
||||
* @return If false, the player is going into a laying down position. If true, the player is getting up from a laying down position.
|
||||
*/
|
||||
public boolean isGettingUp() {
|
||||
return gettingUp;
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class Hooks {
|
||||
private static final HookEco ECO_ITEMS_HOOK = new HookEco();
|
||||
private static final HookPlaceholderAPI PAPI_HOOK = new HookPlaceholderAPI();
|
||||
private static final HookCustomFishing CF_HOOK = new HookCustomFishing();
|
||||
|
||||
private static final HookGSit GSIT_HOOK = new HookGSit();
|
||||
|
||||
public static Hook getHook(@NotNull String id) {
|
||||
return hooks.get(id.toLowerCase());
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package me.lojosho.hibiscuscommons.hooks.misc;
|
||||
|
||||
import dev.geco.gsit.api.event.PlayerGetUpPoseEvent;
|
||||
import dev.geco.gsit.api.event.PlayerPoseEvent;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerPoseEvent;
|
||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class HookGSit extends Hook {
|
||||
|
||||
public HookGSit() {
|
||||
super("GSit");
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
|
||||
public void onPlayerLay(PlayerPoseEvent event) {
|
||||
HibiscusPlayerPoseEvent newEvent = new HibiscusPlayerPoseEvent(this, event.getPlayer(), false);
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
|
||||
public void onPlayerGetUp(PlayerGetUpPoseEvent event) {
|
||||
HibiscusPlayerPoseEvent newEvent = new HibiscusPlayerPoseEvent(this, event.getPlayer(), true);
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
}
|
||||
}
|
||||
BIN
lib/GSit-1.10.0.jar
Normal file
BIN
lib/GSit-1.10.0.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user