MoreSpigotEvents 1.1

Adds more spigot events to your server

  1. Okx
    Tested Minecraft Versions:
    • 1.12
    Source Code:
    https://github.com/okx-code/MoreSpigotEvents
    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
    Code (Text):
    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
    Code (Text):
    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
    Code (Text):
    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

    Code (Text):
    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

    Code (Text):
    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

    Code (Text):
    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

    Code (Text):
    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.

    If you need an example, I used this class to help debug the plugin, so it may help you understand its API if you're unsure.
    DiscowZombie and xSplinxy like this.

Recent Updates

  1. Add PlayerRecieveMessageEvent

Recent Reviews

  1. xSplinxy
    xSplinxy
    5/5,
    Version: 1.0
    Looks like a very clean API and very descriptive on how to use it. Good job! Maybe some examples could help some people out though - just a suggestion!
    1. Okx
      Author's Response
      It's very intuitive, and if you have any issues, feel free to contact me.
  2. Squishling
    Squishling
    5/5,
    Version: 1.0
    Very Nice API. Haven't used it in one of my plugins as of yet, but I can see this being very useful. (Especially PlayerCameraChangeEvent)
    1. Okx