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; } 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/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); 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; 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;