Class NameValidation

java.lang.Object
com.palmergames.bukkit.util.NameValidation

public class NameValidation extends Object
Author:
ElgarL
  • Constructor Details

    • NameValidation

      public NameValidation()
  • Method Details

    • checkAndFilterPlayerName

      public static String checkAndFilterPlayerName(String name) throws InvalidNameException
      Check and perform regex on player names
      Parameters:
      name - of a player in String format.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the player name is invalid.
    • checkAndFilterTownNameOrThrow

      public static String checkAndFilterTownNameOrThrow(String name) throws InvalidNameException
      Check and perform regex on town names
      Parameters:
      name - of a Town object in String format.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the Town name is invalid.
    • checkAndFilterNationNameOrThrow

      public static String checkAndFilterNationNameOrThrow(String name) throws InvalidNameException
      Check and perform regex on nation names
      Parameters:
      name - of a Nation object in String format.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the Nation name is invalid.
    • checkAndFilterGovernmentNameOrThrow

      public static String checkAndFilterGovernmentNameOrThrow(String name, Government gov) throws InvalidNameException
      Check and perform regex on any town and nations names
      Parameters:
      name - of a Government object in String format.
      gov - the Government to validate.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the Government name is invalid.
    • checkAndFilterPlotNameOrThrow

      public static String checkAndFilterPlotNameOrThrow(String name) throws InvalidNameException
      Check and perform regex on plot names
      Parameters:
      name - of a TownBlock object in String format.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the TownBlock name is invalid.
    • checkAndFilterPlotGroupNameOrThrow

      public static String checkAndFilterPlotGroupNameOrThrow(String name) throws InvalidNameException
      Check and perform regex on plotgroup names
      Parameters:
      name - of a PlotGroup object in String format.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the PlotGroup name is invalid.
    • checkAndFilterTitlesSurnameOrThrow

      public static String checkAndFilterTitlesSurnameOrThrow(String[] words) throws InvalidNameException
      Check and perform regex on Titles and Surnames given to residents.
      Parameters:
      words - an Array of strings that make up the title or surname.
      Returns:
      String of the valid name result.
      Throws:
      InvalidNameException - if the title or surname is invalid.
    • checkAndFilterTagOrThrow

      public static String checkAndFilterTagOrThrow(String tag) throws TownyException
      Check and perform regex on Tags given to towns and nations.
      Parameters:
      tag - the Tag which was submitted by the user.
      Returns:
      String of the valid tag result.
      Throws:
      TownyException - if the title or surname is invalid.
    • isValidBoardString

      public static boolean isValidBoardString(String message)
      Used in validating the strings saved for town and nation boards and resident about sections.
      Parameters:
      message - String needing validation.
      Returns:
      true if the message is allowed.
    • testForImproperNameAndThrow

      public static void testForImproperNameAndThrow(String name) throws InvalidNameException
      Stops Names which are: empty, in the config blacklist, all underscores, containing bad symbols, using characters not in the name regex.
      Parameters:
      name - Name to validate.
      Throws:
      InvalidNameException - when the name is not allowed.
    • checkAndFilterName

      @Deprecated public static String checkAndFilterName(String name) throws InvalidNameException
      Deprecated.
      0.100.1.10 use any of the other checkAndFilter methods found in this class.
      Check and perform getNameCheckRegex on any town/nation names
      Parameters:
      name - - Town/Nation name String
      Returns:
      result of getNameCheckRegex
      Throws:
      InvalidNameException - if the name parsed is blacklisted