mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-14 19:25:23 -05:00
Fix Doubles not being editable in the game-rule menu (#3397)
* Fix double gamerules rules not being editable in menu * Updated `validate`'s javadoc
This commit is contained in:
parent
3f30150281
commit
a44e16a6dc
2 changed files with 8 additions and 2 deletions
|
@ -113,7 +113,12 @@ public final class DoubleRule extends GameRules.Rule<DoubleRule> implements Vali
|
||||||
try {
|
try {
|
||||||
final double d = Double.parseDouble(value);
|
final double d = Double.parseDouble(value);
|
||||||
|
|
||||||
return this.inBounds(d);
|
if (!this.inBounds(d)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.value = d;
|
||||||
|
return true;
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,10 @@ package net.fabricmc.fabric.api.gamerule.v1.rule;
|
||||||
public interface ValidateableRule {
|
public interface ValidateableRule {
|
||||||
/**
|
/**
|
||||||
* Validates if a rule can accept the input.
|
* 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
|
* @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);
|
boolean validate(String value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue