mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-10-05 05:17:29 +02:00
Fix removing negative number
This commit is contained in:
parent
58ac82f0d7
commit
dec421ff61
@ -29,12 +29,16 @@ import java.util.function.Predicate;
|
|||||||
public class IntegerFormatFilter implements Predicate<String> {
|
public class IntegerFormatFilter implements Predicate<String> {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(String s) {
|
public boolean test(String s) {
|
||||||
if (s.isEmpty()) return true;
|
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(s);
|
Integer.parseInt(s);
|
||||||
return true;
|
return true;
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return false;
|
try {
|
||||||
|
Integer.parseInt(s + '0');
|
||||||
|
return true;
|
||||||
|
} catch (NumberFormatException e2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user