Class Utils

java.lang.Object
uk.radialbog9.spigot.manhunt.utils.Utils

public class Utils extends Object
Utilities that are used throughout the plugin
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • getMsgColor

      public static String getMsgColor(String msg)
      Shorter way to get chat message colors
      Parameters:
      msg - String Chat message
      Returns:
      String Decoded message
    • broadcastServerMessage

      public static void broadcastServerMessage(String msg)
      Broadcasts message to all players
      Parameters:
      msg - Message
    • hasNoManhuntPermissions

      public static boolean hasNoManhuntPermissions(org.bukkit.command.CommandSender s)
      Checks for all manhunt permissions
      Parameters:
      s - CommandSender
      Returns:
      boolean if sender has no manhunt permissions
    • genTextComponentRunCommand

      public static net.md_5.bungee.api.chat.TextComponent genTextComponentRunCommand(@NotNull @NotNull String text, @NotNull @NotNull String command, String hover)
      Generate a text component with hover and run command click event
      Parameters:
      text - String contents of message
      command - String command to run
      hover - String hover
      Returns:
      TextComponent the generated text component
    • genTextComponentRunCommand

      public static net.md_5.bungee.api.chat.TextComponent genTextComponentRunCommand(@NotNull @NotNull String text, @NotNull @NotNull String command)
      Generate a text component and run command click event
      Parameters:
      text - String contents of message
      command - String command to run
      Returns:
      TextComponent the generated text component
    • genTextComponentSuggestCommand

      public static net.md_5.bungee.api.chat.TextComponent genTextComponentSuggestCommand(@NotNull @NotNull String text, @NotNull @NotNull String command, String hover)
      Generate a text component with hover and run suggest command click event
      Parameters:
      text - String contents of message
      command - String command to run
      hover - String hover
      Returns:
      TextComponent the generated text component
    • genTextComponentSuggestCommand

      public static net.md_5.bungee.api.chat.TextComponent genTextComponentSuggestCommand(@NotNull @NotNull String text, @NotNull @NotNull String command)
      Generate a text component and run suggest command click event
      Parameters:
      text - contents of message
      command - command to run
      Returns:
      The generated text component
    • genTextComponentHoverOnly

      public static net.md_5.bungee.api.chat.TextComponent genTextComponentHoverOnly(@NotNull @NotNull String text, @NotNull @NotNull String hover)
      Generate a text component with hover
      Parameters:
      text - String contents of message
      hover - String hover
      Returns:
      TextComponent the generated text component
    • getRandomInt

      public static int getRandomInt(int min, int max)
      Generates random integers between 2 integers (inclusive)
      Parameters:
      min - minimum (inclusive)
      max - maximum (inclusive)
      Returns:
      Random integer between min and max
    • getClasses

      public static Set<Class<?>> getClasses(File jarFile, String packageName)
      Get classes in specific package in a jar
      Parameters:
      jarFile - The jar file to search in
      packageName - Name of the package to get from
      Returns:
      Set of classes in the package
    • vanishCanSee

      public static boolean vanishCanSee(org.bukkit.command.CommandSender viewer, org.bukkit.entity.Player viewed)
      Utility method for detecting if a player can see another player. If a supported vanish plugin is detected then the result is determined by the API call to the vanish plugin. If the viewer is not a player (i.e. console) or a supported vanish plugin is not detected, it returns true.
      Parameters:
      viewer - Player who is viewing (or console sender)
      viewed - Player who is being viewed
      Returns:
      if viewer can see viewed
    • swapLocation

      public static void swapLocation(org.bukkit.entity.Player player1, org.bukkit.entity.Player player2)
      Swaps the location of two players
      Parameters:
      player1 - Player 1
      player2 - Player 2