aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-12-14 13:39:33 +0300
committerPetr Ilin <hevav@hevav.dev>2022-12-14 13:39:33 +0300
commit4a0ea72c73006ba4b3cad31240f66c748f53d96b (patch)
tree84f0e09e52d2591064a0d0a7595ce0a50fa36779 /src
parent008dac8850ac4cb93c1fc25bf92c1dd7049e6394 (diff)
downloadLimboAuth-4a0ea72c73006ba4b3cad31240f66c748f53d96b.tar.gz
LimboAuth-4a0ea72c73006ba4b3cad31240f66c748f53d96b.tar.bz2
LimboAuth-4a0ea72c73006ba4b3cad31240f66c748f53d96b.zip
Fix duplicate entry and possible fix of "must provide non-null hash"
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/elytrium/limboauth/LimboAuth.java14
-rw-r--r--src/main/java/net/elytrium/limboauth/listener/AuthListener.java10
2 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/net/elytrium/limboauth/LimboAuth.java b/src/main/java/net/elytrium/limboauth/LimboAuth.java
index b2d2e43..f8e3755 100644
--- a/src/main/java/net/elytrium/limboauth/LimboAuth.java
+++ b/src/main/java/net/elytrium/limboauth/LimboAuth.java
@@ -494,8 +494,20 @@ public class LimboAuth {
if (onlineMode || isFloodgate) {
if (registeredPlayer == null || registeredPlayer.getHash().isEmpty()) {
+ RegisteredPlayer nicknameRegisteredPlayer = registeredPlayer;
registeredPlayer = AuthSessionHandler.fetchInfo(this.playerDao, player.getUniqueId());
- if (registeredPlayer == null && Settings.IMP.MAIN.SAVE_PREMIUM_ACCOUNTS) {
+
+ if (nicknameRegisteredPlayer != null && registeredPlayer == null && nicknameRegisteredPlayer.getHash().isEmpty()) {
+ registeredPlayer = nicknameRegisteredPlayer;
+ registeredPlayer.setPremiumUuid(player.getUniqueId().toString());
+ try {
+ this.playerDao.update(registeredPlayer);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (nicknameRegisteredPlayer == null && registeredPlayer == null && Settings.IMP.MAIN.SAVE_PREMIUM_ACCOUNTS) {
registeredPlayer = new RegisteredPlayer(
nickname,
nickname.toLowerCase(Locale.ROOT),
diff --git a/src/main/java/net/elytrium/limboauth/listener/AuthListener.java b/src/main/java/net/elytrium/limboauth/listener/AuthListener.java
index 2c4b668..2529e80 100644
--- a/src/main/java/net/elytrium/limboauth/listener/AuthListener.java
+++ b/src/main/java/net/elytrium/limboauth/listener/AuthListener.java
@@ -94,16 +94,6 @@ public class AuthListener {
if (registeredPlayer != null) {
String currentUuid = registeredPlayer.getUuid();
- if (event.isOnlineMode() && registeredPlayer.getHash().isEmpty() && registeredPlayer.getPremiumUuid().isEmpty()) {
- try {
- registeredPlayer.setPremiumUuid(event.getOriginalProfile().getId().toString());
- this.playerDao.update(registeredPlayer);
- } catch (SQLException e) {
- e.printStackTrace();
- return;
- }
- }
-
if (currentUuid.isEmpty()) {
try {
registeredPlayer.setUuid(event.getGameProfile().getId().toString());