Package com.palmergames.bukkit.util
Class NameValidation
java.lang.Object
com.palmergames.bukkit.util.NameValidation
- Author:
- ElgarL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
checkAndFilterGovernmentNameOrThrow
(String name, Government gov) Check and perform regex on any town and nations namesstatic String
checkAndFilterName
(String name) Deprecated.0.100.1.10 use any of the other checkAndFilter methods found in this class.static String
Check and perform regex on nation namesstatic String
Check and perform regex on player namesstatic String
Check and perform regex on plotgroup namesstatic String
Check and perform regex on plot namesstatic String
Check and perform regex on Tags given to towns and nations.static String
checkAndFilterTitlesSurnameOrThrow
(String[] words) Check and perform regex on Titles and Surnames given to residents.static String
Check and perform regex on town namesstatic boolean
isValidBoardString
(String message) Used in validating the strings saved for town and nation boards and resident about sections.static void
Stops 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 inString
format.- 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 inString
format.- 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 inString
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 inString
format.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 inString
format.- 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 inString
format.- Returns:
- String of the valid name result.
- Throws:
InvalidNameException
- if the PlotGroup 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
-