Files
PaidSigns/src/main/java/net/knarcraft/paidsigns/property/PaidSignConditionProperty.java
EpicKnarvik97 9c6921b4cd Performs some necessary work required for the edit command
Adds an implementation for the edit tab completer
Adds an enum representing a paid sign property
Adds an enum representing a paid sign condition property
Adds aliases to all commands
2022-03-14 16:20:42 +01:00

64 lines
1.8 KiB
Java

package net.knarcraft.paidsigns.property;
/**
* A representation of a paid sign condition's editable properties
*/
public enum PaidSignConditionProperty {
/**
* The string used to trigger the paid sign condition
*/
STRING_TO_MATCH("stringToMatch"),
/**
* Whether to execute the match string as a regular expression
*/
EXECUTE_REG_EX("executeRegEx"),
/**
* Whether to ignore case for the sign condition
*/
IGNORE_CASE("ignoreCase"),
/**
* Whether to ignore color for the sign condition
*/
IGNORE_COLOR("ignoreColor");
private final String stringRepresentation;
/**
* Instantiates a new paid sign condition property
*
* @param stringRepresentation <p>The string representation of the paid sign condition property</p>
*/
PaidSignConditionProperty(String stringRepresentation) {
this.stringRepresentation = stringRepresentation;
}
/**
* Gets the string representation of this paid sign condition property
*
* @return <p>The string representation of this paid sign condition property</p>
*/
public String getStringRepresentation() {
return this.stringRepresentation;
}
/**
* Gets the paid sign property matching the given string
*
* @param propertyString <p>The string representing a paid sign condition property</p>
* @return <p>The matching paid sign condition property, or null if no such property exists</p>
*/
public static PaidSignConditionProperty getFromString(String propertyString) {
for (PaidSignConditionProperty paidSignProperty : PaidSignConditionProperty.values()) {
if (paidSignProperty.getStringRepresentation().equalsIgnoreCase(propertyString)) {
return paidSignProperty;
}
}
return null;
}
}