9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 12:29:16 +00:00

feat: add PlayerEmote api events

This commit is contained in:
LoJoSho
2023-03-12 12:00:33 -05:00
parent aef9e24d28
commit 2185c27be5
2 changed files with 101 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package com.hibiscusmc.hmccosmetics.api;
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerEmoteStartEvent extends Event implements Cancellable {
private final CosmeticUser user;
private String animationId; // Animation id can be invalid!
private boolean isCancelled;
public PlayerEmoteStartEvent(CosmeticUser user, String animationId) {
this.user = user;
this.animationId = animationId;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
isCancelled = cancel;
}
private static final HandlerList handlers = new HandlerList();
@Override
@NotNull
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public CosmeticUser getUser() {
return user;
}
public String getAnimationId() {
return animationId;
}
}

View File

@@ -0,0 +1,51 @@
package com.hibiscusmc.hmccosmetics.api;
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
import com.hibiscusmc.hmccosmetics.user.manager.UserEmoteManager;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class PlayerEmoteStopEvent extends Event implements Cancellable {
private final CosmeticUser user;
private final UserEmoteManager.StopEmoteReason stopEmoteReason;
private boolean isCancelled;
public PlayerEmoteStopEvent(CosmeticUser user, UserEmoteManager.StopEmoteReason reason) {
this.user = user;
this.stopEmoteReason = reason;
this.isCancelled = false;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
isCancelled = cancel;
}
private static final HandlerList handlers = new HandlerList();
@Override
@NotNull
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
public CosmeticUser getUser() {
return user;
}
public UserEmoteManager.StopEmoteReason getStopEmoteReason() {
return stopEmoteReason;
}
}