aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-12-09 01:11:09 +0300
committerPetr Ilin <hevav@hevav.dev>2022-12-09 01:11:09 +0300
commit008dac8850ac4cb93c1fc25bf92c1dd7049e6394 (patch)
tree6ca22c1b3f91695df886ae11ab1ad33d81aa1f47 /src
parent9da04f96816968abbecfb4089ca3acd6f31d0897 (diff)
downloadLimboAuth-008dac8850ac4cb93c1fc25bf92c1dd7049e6394.tar.gz
LimboAuth-008dac8850ac4cb93c1fc25bf92c1dd7049e6394.tar.bz2
LimboAuth-008dac8850ac4cb93c1fc25bf92c1dd7049e6394.zip
Option to switch the saving of premium accounts
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/elytrium/limboauth/LimboAuth.java19
-rw-r--r--src/main/java/net/elytrium/limboauth/Settings.java5
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java
index ed04f3a..b2d2e43 100644
--- a/src/main/java/net/elytrium/limboauth/LimboAuth.java
+++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java
@@ -495,6 +495,25 @@ public class LimboAuth {
if (onlineMode || isFloodgate) {
if (registeredPlayer == null || registeredPlayer.getHash().isEmpty()) {
registeredPlayer = AuthSessionHandler.fetchInfo(this.playerDao, player.getUniqueId());
+ if (registeredPlayer == null && Settings.IMP.MAIN.SAVE_PREMIUM_ACCOUNTS) {
+ registeredPlayer = new RegisteredPlayer(
+ nickname,
+ nickname.toLowerCase(Locale.ROOT),
+ "",
+ player.getRemoteAddress().getAddress().getHostAddress(),
+ "",
+ System.currentTimeMillis(),
+ player.getUniqueId().toString(),
+ player.getUniqueId().toString()
+ );
+
+ try {
+ this.playerDao.create(registeredPlayer);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
if (registeredPlayer == null || registeredPlayer.getHash().isEmpty()) {
// Due to the current connection state, which is set to LOGIN there, we cannot send the packets.
// We need to wait for the PLAY connection state to set.
diff --git a/src/main/java/net/elytrium/limboauth/Settings.java b/src/main/java/net/elytrium/limboauth/Settings.java
index 99bb2f0..68102eb 100644
--- a/src/main/java/net/elytrium/limboauth/Settings.java
+++ b/src/main/java/net/elytrium/limboauth/Settings.java
@@ -73,6 +73,11 @@ public class Settings extends YamlConfig {
"If the player had the cracked account, and switched to the premium account, the cracked UUID will be used."
})
public boolean SAVE_UUID = true;
+ @Comment({
+ "Saves in the database the accounts of premium users whose login is via online-mode-need-auth: false",
+ "Can be disabled to reduce the size of stored data in the database"
+ })
+ public boolean SAVE_PREMIUM_ACCOUNTS = true;
public boolean ENABLE_TOTP = true;
public boolean TOTP_NEED_PASSWORD = true;
public boolean REGISTER_NEED_REPEAT_PASSWORD = true;