Sueta
MO

MoreSpigotEvents

1.1

Adds more spigot events to your server

·Plugin

This plugin depends on ProtocolLib. If you do not have it, download it here. You may also add it as a dependency for your plugin, as some of the objects returned by the API are part of ProtocolLib's library.

This adds 7 more spigot events for use in your server, namely:

PlayerReceiveMessageEvent
Fired when a player receives a message from the server.

Methods

Player PlayerReceiveMessageEvent#getPlayer()
EnumWrappers.ChatType PlayerReceiveMessageEvent#getType()
WrappedChatComponent getMessage()
// toPlainText returns getMessage() in text format, instead of JSON.
String toPlainText()
boolean PlayerReceiveMessageEvent#isCancelled()
void PlayerReceiveMessageEvent#setCancelled(boolean)

PlayerCameraChangeEvent
This fires when a player's camera changes, i.e when they left click a player in spectator mode.

Methods

Player PlayerCameraChangeEvent#getPlayer()
Entity PlayerCameraChangeEvent#getCamera()
boolean PlayerCameraChangeEvent#isCancelled()
void PlayerCameraChangeEvent#setCancelled(boolean)


PlayerElderGuardianEffectEvent

Fired when a player is inflicted with mining fatigue from an elder guardian.

Methods

Player PlayerElderGuardianEffectEvent#getPlayer()
boolean PlayerElderGuardianEffectEvent#isCancelled()
// Note that if this event is cancelled, the player will still be affected by
// mining fatigue but will not receive the sound effect nor the visual effect.
void PlayerElderGuardianEffectEvent#setCancelled(boolean)

PlayerListUpdateEvent
Fired when the player receives the header and/or footer in the player list. This will never fire on a vanilla server.

Methods

Player PlayerListUpdateEvent#getPlayer()
BaseComponent[] PlayerListUpdateEvent#getHeader()
BaseComponent[] PlayerListUpdateEvent#getFooter()
boolean PlayerListUpdateEvent#isCancelled()
void PlayerListUpdateEvent#setCancelled(boolean)


PlayerOpenSignEditorEvent

Fired when a player opens the sign editor, i.e when they place a sign.

Methods

Player PlayerOpenSignEditorEvent#getPlayer()
// Note that chunk position only stores X, Y and Z, not the world.
ChunkPosition PlayerOpenSignEditorEvent#getPosition()
boolean PlayerOpenSignEditorEvent#isCancelled()
// Cancelling this event will make the client place an empty sign.
void PlayerOpenSignEditorEvent#setCancelled(boolean)

PlayerReceiveStatisticsEvent
Fired when the server sends the client its statistics

Methods

Player PlayerReceiveStatisticsEvent#getPlayer()
int PlayerReceiveStatisticsEvent#getStatistic(WrappedStatistic)
int PlayerReceiveStatisticsEvent#getStatistic(String)
Map<WrappedStatistic, Integer> PlayerReceiveStatisticsEvent#getStatistics()

PlayerSettingsUpdateEvent
Fired when the client updates their settings. They may be the same as their previous settings.

Methods

Player PlayerSettingsUpdateEvent#getPlayer()
ClientSettings PlayerSettingsUpdateEvent#getSettings()

String ClientSettings#getLocale()
int ClientSettings#getViewDistance()
// The chat visibility of the client. Can be all, commands only, or hidden.
EnumWrappers.ChatVisibility ClientSettings#getMode()
// Get whether the client has colours enabled in their chat
boolean ClientSettings#isEnableColours()
// Gets the enabled skin parts for client
SkinParts ClientSettings#getSkinParts()
// Get whether the client is set as left-handed or right-handed.
EnumMainHand ClientSettings#getMainHand()

Usage

The events should be listened to as you would standard spigot events. Remember to add depend: [MoreSpigotEvents, ProtocolLib] in your plugin.yml to make sure that this plugin is loaded before yours is. ProtocolLib is there because some of the objects MoreSpgiotEvent returns are from ProtocolLib.

Be sure to send me a PM if you have any suggestions.

Similar projects

Plugin →