setting boundaries
This commit is contained in:
parent
33ace4db2a
commit
fe47739cb8
@ -86,7 +86,16 @@ public class BaseController {
|
|||||||
LocalUser localUser = localUserManager.getByUsername(username);
|
LocalUser localUser = localUserManager.getByUsername(username);
|
||||||
if (localUser.getSettings() != null && localUser.getSettings().containsKey("gravity")) {
|
if (localUser.getSettings() != null && localUser.getSettings().containsKey("gravity")) {
|
||||||
try {
|
try {
|
||||||
return Double.parseDouble(localUser.getSettings().get("gravity"));
|
double gravity = Double.parseDouble(localUser.getSettings().get("gravity"));
|
||||||
|
if (gravity < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gravity > 2) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gravity;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +115,17 @@ public class BaseController {
|
|||||||
if (localUser.getSettings() != null
|
if (localUser.getSettings() != null
|
||||||
&& localUser.getSettings().containsKey("commentDelay")) {
|
&& localUser.getSettings().containsKey("commentDelay")) {
|
||||||
try {
|
try {
|
||||||
return Long.parseLong(localUser.getSettings().get("commentDelay"));
|
long commentDelay = Long.parseLong(localUser.getSettings().get("commentDelay"));
|
||||||
|
|
||||||
|
if (commentDelay < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commentDelay > 15) {
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
return commentDelay;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user