From 1efa38fefca86aea231eef064a04c2465c72aa55 Mon Sep 17 00:00:00 2001 From: Swirny Date: Fri, 22 May 2020 19:48:24 +0200 Subject: [PATCH 1/3] Added CFH counter --- .../eu/habbo/threading/runnables/UpdateModToolIssue.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index 70ea304b..2f6d043c 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -30,5 +30,12 @@ public class UpdateModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + ? WHERE user_id = ?")) { + statement.setInt(1, 1); + statement.setInt(2, this.issue.senderId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } } } From b958c4dbfe60d7280e4880b052c27d4d041df66b Mon Sep 17 00:00:00 2001 From: Swirny <140-Swirny@users.noreply.git.krews.org> Date: Thu, 4 Jun 2020 05:18:32 -0400 Subject: [PATCH 2/3] Update UpdateModToolIssue.java --- .../com/eu/habbo/threading/runnables/UpdateModToolIssue.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index 2f6d043c..f51a2a04 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -30,8 +30,7 @@ public class UpdateModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + ? WHERE user_id = ?")) { - statement.setInt(1, 1); + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + 1 WHERE user_id = ?")) { statement.setInt(2, this.issue.senderId); statement.execute(); } catch (SQLException e) { From 4c92dbf277d3f11dc365e8a92dbbdd0c00feb833 Mon Sep 17 00:00:00 2001 From: Mike <76-Mike@users.noreply.git.krews.org> Date: Sun, 7 Jun 2020 02:08:59 +0200 Subject: [PATCH 3/3] Fix entire merge request --- .../eu/habbo/threading/runnables/InsertModToolIssue.java | 8 ++++++++ .../eu/habbo/threading/runnables/UpdateModToolIssue.java | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java index 9c7e8624..56742599 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/InsertModToolIssue.java @@ -43,5 +43,13 @@ public class InsertModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } + + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + 1 WHERE user_id = ?")) { + statement.setInt(1, this.issue.senderId); + statement.execute(); + } catch (SQLException e) { + LOGGER.error("Caught SQL exception", e); + } } } diff --git a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java index f51a2a04..2a26db69 100644 --- a/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java +++ b/src/main/java/com/eu/habbo/threading/runnables/UpdateModToolIssue.java @@ -20,7 +20,8 @@ public class UpdateModToolIssue implements Runnable { @Override public void run() { - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE support_tickets SET state = ?, type = ?, mod_id = ?, category = ? WHERE id = ?")) { + try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); + PreparedStatement statement = connection.prepareStatement("UPDATE support_tickets SET state = ?, type = ?, mod_id = ?, category = ? WHERE id = ?")) { statement.setInt(1, this.issue.state.getState()); statement.setInt(2, this.issue.type.getType()); statement.setInt(3, this.issue.modId); @@ -30,11 +31,5 @@ public class UpdateModToolIssue implements Runnable { } catch (SQLException e) { LOGGER.error("Caught SQL exception", e); } - try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET cfh_send = cfh_send + 1 WHERE user_id = ?")) { - statement.setInt(2, this.issue.senderId); - statement.execute(); - } catch (SQLException e) { - LOGGER.error("Caught SQL exception", e); - } } }