Skip to content

Commit

Permalink
Fix Doubles not being editable in the game-rule menu (#3397)
Browse files Browse the repository at this point in the history
* Fix double gamerules rules not being editable in menu

* Updated `validate`'s javadoc
  • Loading branch information
Estecka authored Nov 2, 2023
1 parent 3f30150 commit a44e16a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ public boolean validate(String value) {
try {
final double d = Double.parseDouble(value);

return this.inBounds(d);
if (!this.inBounds(d)) {
return false;
}

this.value = d;
return true;
} catch (NumberFormatException ignored) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
public interface ValidateableRule {
/**
* Validates if a rule can accept the input.
* If valid, the input will be set as the rule's value.
*
* @param value the value to validate
* @return true if the value can be accepted.
* @return true if the value was accepted.
*/
boolean validate(String value);
}

0 comments on commit a44e16a

Please sign in to comment.