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

docs(PlayerMenuOpenEvent): documented class

This commit is contained in:
Craftinators
2023-03-15 04:05:17 -04:00
parent be93369a8b
commit 591198175a

View File

@@ -3,49 +3,56 @@ package com.hibiscusmc.hmccosmetics.api;
import com.hibiscusmc.hmccosmetics.gui.Menu;
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 PlayerMenuOpenEvent extends Event implements Cancellable {
private final CosmeticUser user;
public class PlayerMenuOpenEvent extends CosmeticUserEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancel = false;
private final Menu menu;
private boolean isCancelled;
public PlayerMenuOpenEvent(CosmeticUser user, Menu menu) {
this.user = user;
public PlayerMenuOpenEvent(@NotNull CosmeticUser who, @NotNull Menu menu) {
super(who);
this.menu = menu;
this.isCancelled = false;
}
/**
* Gets the {@link Menu} that the player is opening
*
* @return The {@link Menu} which is being opened by the player
*/
@NotNull
public Menu getMenu() {
return menu;
}
@Override
public boolean isCancelled() {
return isCancelled;
return cancel;
}
/**
* Sets the cancellation state of this event
*
* <p>
* Canceling this event will prevent the player from opening a {@link Menu}
* </p>
*
* @param cancel true if you wish to cancel this event
*/
@Override
public void setCancelled(boolean cancel) {
isCancelled = cancel;
this.cancel = cancel;
}
private static final HandlerList handlers = new HandlerList();
@Override
@NotNull
public HandlerList getHandlers() {
return handlers;
}
@NotNull
public static HandlerList getHandlerList() {
return handlers;
}
public CosmeticUser getUser() {
return user;
}
public Menu getMenu() {
return menu;
}
}