Class ResidentUtil

java.lang.Object
com.palmergames.bukkit.towny.utils.ResidentUtil

public class ResidentUtil extends Object
  • Constructor Details

    • ResidentUtil

      public ResidentUtil()
  • Method Details

    • getOnlineResidentsViewable

      public static List<Resident> getOnlineResidentsViewable(org.bukkit.entity.Player viewer, ResidentList residentList)
      Return a list of Residents that can be seen (not vanished) by the viewer.
      Parameters:
      viewer - - Player who is looking.
      residentList - - List of Residents which could be viewed.
      Returns:
      - List of residents that can actually be seen.
    • getValidatedResidents

      public static List<Resident> getValidatedResidents(org.bukkit.command.CommandSender sender, List<String> names)
      Transforms a String[] of names to a list of Residents. Uses the BukkitTools.matchPlayer() rather than BukkitTools.getPlayerExact(); Used for: - Inviting
      Parameters:
      sender - - CommandSender.
      names - - Names to be converted.
      Returns:
      - List of residents to be used later.
    • getValidatedResidentsOfTown

      public static List<Resident> getValidatedResidentsOfTown(org.bukkit.command.CommandSender sender, Town town, String[] names)
      Transforms a String[] of names to a list of Residents. Uses a town's resident list to validate names. Used for: - Kicking
      Parameters:
      sender - CommandSender who would see feedback.
      town - Town which is being searched.
      names - Names to be converted.
      Returns:
      List of Residents to be used later.
    • openGUIInventory

      public static void openGUIInventory(Resident resident, List<String> list, String name)
      Opens a basic inventory GUI with pagination. GUI displays either switch or itemuse materials via an ArrayList of strings is converted to valid Materials and sent to be shown to the player.
      Parameters:
      resident - The Resident to show the inventory to
      list - ArrayList of strings that will be converted to valid Materials.
      name - Name of the inventory window.
    • openGUIInventory

      public static void openGUIInventory(Resident resident, Collection<org.bukkit.Material> set, String name)
    • openSelectionGUI

      public static void openSelectionGUI(Resident resident, SelectionGUI.SelectionType selectionType)
    • getBlankPage

      public static org.bukkit.inventory.Inventory getBlankPage(String name)
    • createAndGetNPCResident

      public static Resident createAndGetNPCResident()
    • nextNpcName

      public static String nextNpcName() throws TownyException
      Throws:
      TownyException
    • reduceResidentCountToFitTownMaxPop

      public static void reduceResidentCountToFitTownMaxPop(Town town)
      Method to remove the newest residents in order to bring a town's population low enough to meet the population cap.
      Parameters:
      town - The Town to reduce the population of.
    • outlawEnteredTown

      public static void outlawEnteredTown(Resident outlaw, Town town, org.bukkit.Location location)
      Method which will teleport an outlaw out of a town, if the player does not have the bypass node and the outlaw teleport feature is active.
      Parameters:
      outlaw - Resident which is outlawed.
      town - Town where the resident is outlawed.
      location - Location which the player is at.
    • toggleResidentBorderTitles

      public static void toggleResidentBorderTitles(Resident resident, Optional<Boolean> choice)