From bb68a4a690ee6e550763451492aae9ca8d9342d2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 2 Jun 2022 17:08:29 +0200 Subject: [PATCH 1/4] Using sql connections in round robbin mode instead of the same (possibly) --- src/de/steamwar/bungeecore/sql/Statement.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/sql/Statement.java b/src/de/steamwar/bungeecore/sql/Statement.java index a216c89..61fcc00 100644 --- a/src/de/steamwar/bungeecore/sql/Statement.java +++ b/src/de/steamwar/bungeecore/sql/Statement.java @@ -115,7 +115,7 @@ public class Statement implements AutoCloseable { } synchronized (connections) { - connections.push(connection); + connections.addLast(connection); } return result; From 6d0a1f6bfdb8f0a0b48ce3616790f8e4205879b7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 4 Jun 2022 16:23:13 +0200 Subject: [PATCH 2/4] Fix geyser floodgate null Signed-off-by: Lixfel --- .../bungeecore/listeners/SubserverProtocolFixer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java index b87c960..927d47c 100644 --- a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java +++ b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java @@ -49,12 +49,18 @@ public class SubserverProtocolFixer extends BasicListener { @EventHandler public void loginEvent(LoginEvent e) { InitialHandler initialHandler = ((InitialHandler) e.getConnection()); - LoginResult.Property[] properties = initialHandler.getLoginProfile().getProperties(); - try { - String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString()); + + String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString()); + + LoginResult result = initialHandler.getLoginProfile(); + if (result != null) { + LoginResult.Property[] properties = result.getProperties(); if (properties.length > 0) { extraData += "\00" + BungeeCord.getInstance().gson.toJson(properties); } + } + + try { field.set(initialHandler, extraData); } catch (IllegalAccessException ex) { BungeeCord.getInstance().getLogger().log(Level.SEVERE, ex.getMessage(), ex); From 9f7f5eef366d0047f8191b6dbe985babf7c7dde1 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 4 Jun 2022 22:49:07 +0200 Subject: [PATCH 3/4] Test fix ban timeout Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/listeners/BanListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/bungeecore/listeners/BanListener.java b/src/de/steamwar/bungeecore/listeners/BanListener.java index 548058c..a868ba3 100644 --- a/src/de/steamwar/bungeecore/listeners/BanListener.java +++ b/src/de/steamwar/bungeecore/listeners/BanListener.java @@ -50,6 +50,7 @@ public class BanListener extends BasicListener { user.updateBanIP(event.getConnection().getAddress().getAddress().getHostAddress()); event.setCancelled(true); ChatSender.of(event).system(user.punishmentMessage(Punishment.PunishmentType.Ban)); + event.completeIntent(BungeeCore.get()); return; } From c74b2b2c84f45613c953aca52541613534d3979d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 7 Jun 2022 14:13:51 +0200 Subject: [PATCH 4/4] Fix settings changed npe Signed-off-by: Lixfel --- .../bungeecore/listeners/SettingsChangedListener.java | 4 +--- src/de/steamwar/bungeecore/sql/SteamwarUser.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java b/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java index 3858a69..5affb64 100644 --- a/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java +++ b/src/de/steamwar/bungeecore/listeners/SettingsChangedListener.java @@ -26,15 +26,13 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.event.SettingsChangedEvent; import net.md_5.bungee.event.EventHandler; -import java.util.Objects; - public class SettingsChangedListener extends BasicListener { @EventHandler public void onSettingsChanged(SettingsChangedEvent event) { BungeeCord.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> { ProxiedPlayer player = event.getPlayer(); - SteamwarUser.get(player).setLocale(Objects.requireNonNull(player.getLocale()), false); + SteamwarUser.get(player).setLocale(player.getLocale(), false); }); } } diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index 901c219..829ee84 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -382,7 +382,7 @@ public class SteamwarUser { } public void setLocale(Locale locale, boolean manualLocale) { - if (this.manualLocale && !manualLocale) + if (locale == null || (this.manualLocale && !manualLocale)) return; this.locale = locale;