-
Notifications
You must be signed in to change notification settings - Fork 0
Events
Jonathan Crowder (Jon) edited this page Apr 21, 2020
·
4 revisions
Events are how you interact with the minecraft server's
constant changing of information.
Events allow you to listen to, modify, and even cancel
actions that normally happen across the server
As of latest release, the only implementation of events is
Events.on (
Class type ,
function listener ( Event e )
)
Where Events
is JavaScript access to RepCraft's JSEvents.java instance
A demo listener that should work in a blank plugin:
//Alias to bukkit's chat event class
const chatEvent = org.bukkit.event.player.AsyncPlayerChatEvent;
//Listen to events of that type
Events.on ( chatEvent , (evt)=>{
//Happens every time a player chats on the server
//evt will be of type https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/AsyncPlayerChatEvent.html
//Get the message/text they sent and log it to the server console
console.log ( evt.getMessage() );
});
To find more event types, take a look at the spigot docs:
https://hub.spigotmc.org/javadocs/spigot/overview-summary.html
Search for event
to find current implementations
A compiled list of events as of time of writing: