From 6d4130a44a5f2deb44d74802d0bc8afe1a8887ed Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 8 Sep 2019 19:08:53 +0200 Subject: [PATCH] Fixing webpw --- .../steamwar/bungeecore/listeners/mods/Forge.java | 4 ++-- src/de/steamwar/bungeecore/sql/SQL.java | 13 +++++++++++++ src/de/steamwar/bungeecore/sql/SteamwarUser.java | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/mods/Forge.java b/src/de/steamwar/bungeecore/listeners/mods/Forge.java index fb2098c..178ce62 100644 --- a/src/de/steamwar/bungeecore/listeners/mods/Forge.java +++ b/src/de/steamwar/bungeecore/listeners/mods/Forge.java @@ -322,11 +322,11 @@ public class Forge extends BasicListener { @EventHandler public void onPluginMessageEvent(PluginMessageEvent e){ - BungeeCore.log(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData())); - if(!enabled) return; + BungeeCore.log(e.getSender().getAddress().getHostString() + " " + e.getTag() + " " + Arrays.toString(e.getData())); + if(!e.getTag().equals(FMLHS)) return; diff --git a/src/de/steamwar/bungeecore/sql/SQL.java b/src/de/steamwar/bungeecore/sql/SQL.java index c993e68..8686b31 100644 --- a/src/de/steamwar/bungeecore/sql/SQL.java +++ b/src/de/steamwar/bungeecore/sql/SQL.java @@ -59,6 +59,19 @@ public class SQL { } } + static void webupdate(String qry) { + try (PreparedStatement st = webcon.prepareStatement(qry)) { + st.executeUpdate(); + } catch (SQLException e) { + sqlException(); + try (PreparedStatement st = webcon.prepareStatement(qry)) { + st.executeUpdate(); + } catch (SQLException ex) { + BungeeCore.log("Could not execute update statement", ex); + } + } + } + static ResultSet select(String qry){ try{ PreparedStatement st = con.prepareStatement(qry); diff --git a/src/de/steamwar/bungeecore/sql/SteamwarUser.java b/src/de/steamwar/bungeecore/sql/SteamwarUser.java index c65ab7f..2b5a91a 100644 --- a/src/de/steamwar/bungeecore/sql/SteamwarUser.java +++ b/src/de/steamwar/bungeecore/sql/SteamwarUser.java @@ -96,7 +96,7 @@ public class SteamwarUser { } public void setWebpw(String password){ - SQL.update("INSERT INTO User\n" + + SQL.webupdate("INSERT INTO User\n" + " (UID, WebPassword)\n" + "VALUES\n" + " (" + id + ", password('"+ SQL.disarmString(password) + "'))\n" +