Class NecrifyVelocityPlugin

java.lang.Object
de.jvstvshd.necrify.common.AbstractNecrifyPlugin
de.jvstvshd.necrify.velocity.NecrifyVelocityPlugin
All Implemented Interfaces:
Necrify

public class NecrifyVelocityPlugin extends AbstractNecrifyPlugin
  • Field Details

    • MUTE_DATA_CHANNEL_IDENTIFIER

      public static final com.velocitypowered.api.proxy.messages.ChannelIdentifier MUTE_DATA_CHANNEL_IDENTIFIER
    • MUTES_DISABLED

      public static final net.kyori.adventure.text.Component MUTES_DISABLED
      Since 1.19.1, cancelling chat messages on proxy is not possible anymore. Therefore, we have to listen to the chat event on the actual game server. This means that there has to be a spigot/paper extension to this plugin which is not yet available unless there's a possibility. Therefore all mute related features are disabled for now. If you use 1.19 or lower you will not be affected by this.The progress of the extension can be found here. For this reason, every mute related feature is deprecated and marked as for removal until this extension is available.
  • Constructor Details

    • NecrifyVelocityPlugin

      @Inject public NecrifyVelocityPlugin(com.velocitypowered.api.proxy.ProxyServer server, org.slf4j.Logger logger, Path dataDirectory)
  • Method Details

    • onProxyInitialization

      public void onProxyInitialization(com.velocitypowered.api.event.proxy.ProxyInitializeEvent event)
    • getPunishmentManager

      public PunishmentManager getPunishmentManager()
    • setPunishmentManager

      public void setPunishmentManager(PunishmentManager punishmentManager)
    • getPlayerResolver

      public PlayerResolver getPlayerResolver()
    • setPlayerResolver

      public void setPlayerResolver(PlayerResolver playerResolver)
    • getServer

      public com.velocitypowered.api.proxy.ProxyServer getServer()
    • getDataSource

      public com.zaxxer.hikari.HikariDataSource getDataSource()
    • getMessageProvider

      @NotNull public @NotNull MessageProvider getMessageProvider()
      Description copied from interface: Necrify
      Returns the message provider used by this system. A message provider provides localized messages for users based on a key and optional arguments.
      Returns:
      the message provider.
    • communicator

      @NotNull public @NotNull MessagingChannelCommunicator communicator()
    • setMessageProvider

      public void setMessageProvider(@NotNull @NotNull MessageProvider messageProvider)
      Description copied from interface: Necrify
      Sets the message provider used by this system. A message provider provides localized messages for users based on a key and optional arguments.

      This may does not affect anything after the system has been initialized fully.

      Parameters:
      messageProvider - the message provider to set.
    • isWhitelistActive

      public boolean isWhitelistActive()
      Specified by:
      isWhitelistActive in class AbstractNecrifyPlugin
    • getUserManager

      @NotNull public @NotNull UserManager getUserManager()
      Description copied from interface: Necrify
      Returns the user manager used by this system. The user manager is responsible for loading and saving users and keeping their data accurate and up-to-date.
      Returns:
      the user manager.
    • setUserManager

      public void setUserManager(@NotNull @NotNull UserManager userManager)
      Description copied from interface: Necrify
      Sets the user manager used by this system. The user manager is responsible for loading and saving users and keeping their data accurate and up-to-date.

      This may does not affect anything after the system has been initialized fully.

      Parameters:
      userManager - the user manager to set.
    • getPunishment

      public <T extends Punishment> CompletableFuture<Optional<T>> getPunishment(@NotNull @NotNull UUID punishmentId)
      Description copied from interface: Necrify
      Retrieves a punishment by its id. This will also completely load the user this punishment is affecting.

      As of 1.2.2, this method may return a punishment object that only contains historical data about it. Thus, this punishment cannot be manipulated any further. To check whether the punishment is historical, you may use Punishment.isOngoing(). If it returns true, the punishment is still active and can be manipulated in any way. If it returns false, the punishment probably is historical and cannot be manipulated. You can still retrieve log entries of historical punishments. Historical punishments are not added to the user's list of active punishments.

      Type Parameters:
      T - the type of the punishment.
      Parameters:
      punishmentId - the id of the punishment.
      Returns:
      a future containing the punishment or Optional.empty() if not found.
    • createUser

      public NecrifyUser createUser(com.velocitypowered.api.command.CommandSource source)
    • createUser

      public NecrifyUser createUser(UUID userId, boolean loadPunishmentsDirectly)
      Creates a user with the given UUID. If the user is already cached, the cached user is returned.

      Note: this user does not hold any valid data besides his uuid and maybe player instance (if online). After returning the value, the missing user data will be loaded, whereafter the UserLoadedEvent will be fired.

      Parameters:
      userId - the UUID of the user to create.
      loadPunishmentsDirectly - whether to load the punishments directly or not. This influences if punishments are loaded asynchronously or not. If set to true, punishments will be loaded blocking.
      Returns:
      the created user.
    • getCommandSource

      public com.velocitypowered.api.command.CommandSource getCommandSource(NecrifyUser user)
    • getEventDispatcher

      @NotNull public @NotNull EventDispatcher getEventDispatcher()
      Description copied from interface: Necrify
      Returns the system's event dispatcher. The event dispatcher is responsible for dispatching events to the corresponding listeners.
      Returns:
      the event dispatcher.
    • setEventDispatcher

      public void setEventDispatcher(@NotNull @NotNull EventDispatcher eventDispatcher)
      Description copied from interface: Necrify
      Sets the event dispatcher. The event dispatcher is responsible for dispatching events to the corresponding listeners.

      This may does not affect anything after the system has been initialized fully.

      Parameters:
      eventDispatcher - the event dispatcher to set.
    • createKick

      public NecrifyKick createKick(net.kyori.adventure.text.Component reason, NecrifyUser user, UUID punishmentUuid)
      Specified by:
      createKick in class AbstractNecrifyPlugin
    • getOnlinePlayers

      public Set<org.incendo.cloud.type.tuple.Pair<String,UUID>> getOnlinePlayers()
      Specified by:
      getOnlinePlayers in class AbstractNecrifyPlugin
    • getSystemUser

      @NotNull public @NotNull NecrifyUser getSystemUser()
      Specified by:
      getSystemUser in class AbstractNecrifyPlugin