This commit is contained in:
_Bastler 2021-10-06 11:21:49 +02:00
parent 3c68bbff1a
commit 45a62b9d54

View File

@ -55,26 +55,16 @@ public class BaseController {
: null;
}
/**
* Gets the local user.
*
* @return the local user
*/
protected LocalUser getLocalUser() {
return localUserManager.getByAuth(SecurityContextHolder.getContext().getAuthentication());
}
/**
* Gets the gravity.
*
* @return the gravity
*/
protected double getGravity() {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null && auth.isAuthenticated()) {
LocalUser localUser = localUserManager.getByAuth(auth);
if (localUser != null && localUser.getSettings() != null
&& localUser.getSettings().containsKey("gravity")) {
String username = getCurrentUsername();
if (username != null) {
LocalUser localUser = localUserManager.getByUsername(username);
if (localUser.getSettings() != null && localUser.getSettings().containsKey("gravity")) {
try {
return Double.parseDouble(localUser.getSettings().get("gravity"));
} catch (Exception e) {