Improves behavior when signs share conditions
Makes sure that the paid sign matching the most conditions is always chosen as the matching paid sign Makes sure to always choose the most expensive paid sign if two or more paid signs with the same amount of conditions are matching. Changes some classes to records to reduce some boilerplate code
This commit is contained in:
@ -130,7 +130,7 @@ public class EditCommand extends TokenizedCommand {
|
||||
PaidSign updatedSign = new PaidSign(signName, cost, permission, ignoreCase, ignoreColor, matchAnyCondition);
|
||||
for (short line : conditions.keySet()) {
|
||||
PaidSignCondition condition = conditions.get(line);
|
||||
updatedSign.addCondition(line, condition.getStringToMatch(), condition.executeRegex(),
|
||||
updatedSign.addCondition(line, condition.stringToMatch(), condition.executeRegex(),
|
||||
OptionState.getFromBoolean(condition.ignoreCase()),
|
||||
OptionState.getFromBoolean(condition.ignoreColor()));
|
||||
}
|
||||
@ -154,7 +154,7 @@ public class EditCommand extends TokenizedCommand {
|
||||
PaidSignConditionProperty property, String newValue) {
|
||||
PaidSignCondition condition = sign.getConditions().get(conditionIndex);
|
||||
String stringToMatch = property == PaidSignConditionProperty.STRING_TO_MATCH ? newValue :
|
||||
condition.getStringToMatch();
|
||||
condition.stringToMatch();
|
||||
boolean executeRegEx = property == PaidSignConditionProperty.EXECUTE_REG_EX ? Boolean.parseBoolean(newValue) :
|
||||
condition.executeRegex();
|
||||
boolean ignoreCase = property == PaidSignConditionProperty.IGNORE_CASE ? OptionState.getBooleanValue(
|
||||
|
Reference in New Issue
Block a user