Skip to content
Nyxon edited this page Mar 24, 2026 · 1 revision

Events API

PotatoEssentials provides several custom events for developers to extend functionality.

Available Events

PlayerMessagePlayerEvent

Triggered when a player sends a private message using /msg or /reply.

  • Methods:
    • getSender(): Returns the Player sending the message.
    • getReceiver(): Returns the Player receiving the message.
    • getMessageContent(): Returns the raw string message.
    • getSenderMessage(): Returns the formatted Component seen by the sender.
    • isReply(): Boolean indicating if /r was used.

VanishToggleEvent

Triggered when a player's vanish state changes.

  • Methods:
    • isVanished(): Returns true if the player is now hidden.

ChatCooldownEvent

Triggered when a player is blocked from chatting by the cooldown system.

  • Methods:
    • getRemainingSeconds(): Double value of the remaining wait time.
    • getChannel(): The string key of the chat channel (e.g., "global").

Example Implementation

@EventHandler
public void onPrivateMessage(PlayerMessagePlayerEvent event) {
    if (event.getMessageContent().contains("badword")) {
        event.setCancelled(true);
    }
}

Clone this wiki locally