aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/elytrium/limboauth/LimboAuth.java13
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java1
-rw-r--r--src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java4
-rw-r--r--src/main/java/net/elytrium/limboauth/listener/AuthListener.java3
4 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java
index fb2dd1d..afce924 100644
--- a/src/main/java/net/elytrium/limboauth/LimboAuth.java
+++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java
@@ -169,7 +169,6 @@ public class LimboAuth {
UpdatesChecker.checkForUpdates(this.getLogger());
}
- @SuppressWarnings("SwitchStatementWithTooFewBranches")
public void reload() throws Exception {
Settings.IMP.reload(new File(this.dataDirectory.toFile().getAbsoluteFile(), "config.yml"));
@@ -220,11 +219,15 @@ public class LimboAuth {
}
}
- TableUtils.createTableIfNotExists(this.connectionSource, RegisteredPlayer.class);
- this.playerDao = DaoManager.createDao(this.connectionSource, RegisteredPlayer.class);
this.nicknameValidationPattern = Pattern.compile(Settings.IMP.MAIN.ALLOWED_NICKNAME_REGEX);
- this.migrateDb(this.playerDao);
+ try {
+ TableUtils.createTableIfNotExists(this.connectionSource, RegisteredPlayer.class);
+ this.playerDao = DaoManager.createDao(this.connectionSource, RegisteredPlayer.class);
+ this.migrateDb(this.playerDao);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
CommandManager manager = this.server.getCommandManager();
manager.unregister("unregister");
@@ -544,7 +547,7 @@ public class LimboAuth {
}
} catch (SQLException e) {
this.getLogger().error("Unable to authenticate with Mojang", e);
- return true;
+ return Settings.IMP.MAIN.ON_RATE_LIMIT_PREMIUM;
}
}
diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java
index 6246444..9dbbcc4 100644
--- a/src/main/java/net/elytrium/limboauth/Settings.java
+++ b/src/main/java/net/elytrium/limboauth/Settings.java
@@ -292,6 +292,7 @@ public class Settings extends Config {
public String TOTP_TOKEN = "{PRFX} &aYour 2FA token &7(Click to copy)&a: &6{0}";
public String TOTP_RECOVERY = "{PRFX} &aYour recovery codes &7(Click to copy)&a: &6{0}";
+ public String DB_ERROR = "{PRFX} &aA database error has occurred.";
public String DESTROY_SESSION_SUCCESSFUL = "{PRFX} &eYour session is now destroyed, you'll need to log in again after reconnecting.";
}
diff --git a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
index 4e330ce..9a795b5 100644
--- a/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
+++ b/src/main/java/net/elytrium/limboauth/handler/AuthSessionHandler.java
@@ -228,6 +228,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
playerDao.update(player);
} catch (SQLException e) {
e.printStackTrace();
+ return false;
}
}
}
@@ -258,6 +259,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
sizeOfValid.decrementAndGet();
} catch (SQLException ex) {
ex.printStackTrace();
+ this.proxyPlayer.disconnect(this.deserialize(Settings.IMP.MAIN.STRINGS.DB_ERROR));
}
});
}
@@ -267,6 +269,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
}
} catch (SQLException e) {
e.printStackTrace();
+ this.proxyPlayer.disconnect(this.deserialize(Settings.IMP.MAIN.STRINGS.DB_ERROR));
}
}
@@ -292,6 +295,7 @@ public class AuthSessionHandler implements LimboSessionHandler {
this.playerDao.create(registeredPlayer);
} catch (SQLException e) {
e.printStackTrace();
+ this.proxyPlayer.disconnect(this.deserialize(Settings.IMP.MAIN.STRINGS.DB_ERROR));
}
}
diff --git a/src/main/java/net/elytrium/limboauth/listener/AuthListener.java b/src/main/java/net/elytrium/limboauth/listener/AuthListener.java
index e029258..c06d5f4 100644
--- a/src/main/java/net/elytrium/limboauth/listener/AuthListener.java
+++ b/src/main/java/net/elytrium/limboauth/listener/AuthListener.java
@@ -100,6 +100,7 @@ public class AuthListener {
this.playerDao.update(registeredPlayer);
} catch (SQLException e) {
e.printStackTrace();
+ return;
}
}
@@ -109,6 +110,7 @@ public class AuthListener {
this.playerDao.update(registeredPlayer);
} catch (SQLException ex) {
ex.printStackTrace();
+ return;
}
} else {
event.setGameProfile(event.getOriginalProfile().withId(UUID.fromString(currentUuid)));
@@ -122,6 +124,7 @@ public class AuthListener {
updateBuilder.update();
} catch (SQLException e) {
e.printStackTrace();
+ return;
}
}