Class WbsMessenger

java.lang.Object
wbs.utils.util.plugin.WbsMessenger
Direct Known Subclasses:
UtilsCommand, WbsCommand, WbsSubcommand

public abstract class WbsMessenger extends Object
Provides a few methods to redirect messaging to the plugin messaging system. Also provides some permission checking methods commonly used in classes that deal with player interaction.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected @NotNull WbsPlugin
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    WbsMessenger(@NotNull WbsPlugin plugin)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    broadcast(String message)
    Send a message to all players on the server, formatted automatically
    protected void
    broadcastActionBar(String message, double radius, org.bukkit.Location loc)
     
    protected boolean
    checkPermission(org.bukkit.command.CommandSender sender, String permission)
    A method to check whether or not a command sender has a given permission.
    protected void
    sendActionBar(String message, org.bukkit.entity.Player player)
    Send an action bar to a player with formatting handled
    protected <T> int
    sendList(List<T> list, int entriesPerPage, int page, org.bukkit.command.CommandSender sender)
     
    protected <T> int
    sendList(Set<T> set, int entriesPerPage, int page, org.bukkit.command.CommandSender sender)
     
    protected void
    sendMessage(String message, org.bukkit.command.CommandSender sender)
    Send a message with formatting handled.
    protected void
    sendMessageNoPrefix(String message, org.bukkit.command.CommandSender sender)
    Same as sendMessage(String, CommandSender) but without the prefix

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      @NotNull protected @NotNull WbsPlugin plugin
  • Constructor Details

    • WbsMessenger

      public WbsMessenger(@NotNull @NotNull WbsPlugin plugin)
      Parameters:
      plugin - The WbsPlugin to wrap messaging methods for
  • Method Details

    • checkPermission

      protected boolean checkPermission(org.bukkit.command.CommandSender sender, String permission)
      A method to check whether or not a command sender has a given permission. If the sender does not have the permission, they will get a default permission error message so it doesn't need to be handled in other methods.
      Parameters:
      sender - The command sender to check
      permission - The permission to check
      Returns:
      True if the sender has permission
    • sendMessage

      protected void sendMessage(String message, org.bukkit.command.CommandSender sender)
      Send a message with formatting handled.
      Parameters:
      message - The message to send
      sender - The command sender who will receive the message
      See Also:
    • sendMessageNoPrefix

      protected void sendMessageNoPrefix(String message, org.bukkit.command.CommandSender sender)
      Same as sendMessage(String, CommandSender) but without the prefix
    • broadcast

      protected void broadcast(String message)
      Send a message to all players on the server, formatted automatically
      Parameters:
      message - The message to send
      See Also:
    • sendActionBar

      protected void sendActionBar(String message, org.bukkit.entity.Player player)
      Send an action bar to a player with formatting handled
      Parameters:
      message - The action bar message to send
      player - The player to show the bar to
      See Also:
    • broadcastActionBar

      protected void broadcastActionBar(String message, double radius, org.bukkit.Location loc)
    • sendList

      protected <T> int sendList(Set<T> set, int entriesPerPage, int page, org.bukkit.command.CommandSender sender)
    • sendList

      protected <T> int sendList(List<T> list, int entriesPerPage, int page, org.bukkit.command.CommandSender sender)