Package com.palmergames.bukkit.util
Class NameValidation
java.lang.Object
com.palmergames.bukkit.util.NameValidation
- Author:
- ElgarL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCheck and perform regex on District namesstatic StringcheckAndFilterGovernmentNameOrThrow(String name, Government gov) Check and perform regex on any town and nations namesstatic StringcheckAndFilterName(String name) Deprecated.0.100.1.10 use any of the other checkAndFilter methods found in this class.static StringCheck and perform regex on nation namesstatic StringCheck and perform regex on player namesstatic StringCheck and perform regex on plotgroup namesstatic StringCheck and perform regex on plot namesstatic StringCheck and perform regex on Tags given to towns and nations.static StringcheckAndFilterTitlesSurnameOrThrow(String[] words) Check and perform regex on Titles and Surnames given to residents.static StringCheck and perform regex on town namesstatic booleanisValidBoardString(String message) Used in validating the strings saved for town and nation boards and resident about sections.static voidStops Names which are: empty, in the config blacklist, all underscores, containing bad symbols, using characters not in the name regex.
-
Constructor Details
-
NameValidation
public NameValidation()
-
-
Method Details
-
checkAndFilterPlayerName
Check and perform regex on player names- Parameters:
name- of a player inStringformat.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException- if the player name is invalid.
-
checkAndFilterTownNameOrThrow
Check and perform regex on town names- Parameters:
name- of a Town object inStringformat.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException- if the Town name is invalid.
-
checkAndFilterNationNameOrThrow
Check and perform regex on nation names- Parameters:
name- of a Nation object inStringformat.- 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 inStringformat.gov- the Government to validate.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException- if the Government name is invalid.
-
checkAndFilterPlotNameOrThrow
Check and perform regex on plot names- Parameters:
name- of a TownBlock object inStringformat.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException- if the TownBlock name is invalid.
-
checkAndFilterPlotGroupNameOrThrow
Check and perform regex on plotgroup names- Parameters:
name- of a PlotGroup object inStringformat.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException- if the PlotGroup name is invalid.
-
checkAndFilterDistrictNameOrThrow
Check and perform regex on District names- Parameters:
name- of a District object inStringformat.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException- if the District name is invalid.
-
checkAndFilterTitlesSurnameOrThrow
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
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
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
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.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 nameString- Returns:
- result of getNameCheckRegex
- Throws:
InvalidNameException- if the name parsed is blacklisted
-