From 58df3022a5cc8b2963e4c3e07128ec1b434a427b Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Thu, 7 Jul 2016 18:08:19 -0400 Subject: [PATCH] Completely remove old staff notifications system --- .../preferences/PreferencesRepository.java | 8 +--- .../core/preferences/UserPreferences.java | 1 - .../ui/ExclusivePreferencesPage.java | 22 +-------- .../mineplex/core/report/ReportManager.java | 13 ------ .../command/ReportNotificationCallback.java | 46 +++++++------------ 5 files changed, 19 insertions(+), 71 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java index a0ac20836..3dacfb2a4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/PreferencesRepository.java @@ -23,10 +23,9 @@ public class PreferencesRepository extends MinecraftRepository // privateMessaging BOOL NOT NULL DEFAULT 1, partyRequests BOOL NOT NULL // DEFAULT 0, invisibility BOOL NOT NULL DEFAULT 0, forcefield BOOL NOT NULL // DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL - // NOT NULL DEFAULT 0, showUserReports BOOL NOT NULL DEFAULT 0, PRIMARY - // KEY (id), UNIQUE INDEX uuid_index (uuid));"; + // NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));"; private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; - private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ?, disableAds = ?, showUserReports = ? WHERE uuid=?;"; + private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ?, disableAds = ? WHERE uuid=?;"; public PreferencesRepository(JavaPlugin plugin) { @@ -65,7 +64,6 @@ public class PreferencesRepository extends MinecraftRepository preparedStatement.setBoolean(13, entry.getValue().ClanTips); preparedStatement.setBoolean(14, entry.getValue().HubMusic); preparedStatement.setBoolean(15, entry.getValue().DisableAds); - preparedStatement.setBoolean(16, entry.getValue().ShowUserReports); System.out.println(">> " + entry.getValue().ClanTips); preparedStatement.setString(17, entry.getKey()); @@ -96,7 +94,6 @@ public class PreferencesRepository extends MinecraftRepository preparedStatement.setBoolean(13, entry.getValue().ClanTips); preparedStatement.setBoolean(14, entry.getValue().HubMusic); preparedStatement.setBoolean(15, entry.getValue().DisableAds); - preparedStatement.setBoolean(16, entry.getValue().ShowUserReports); System.out.println(">> " + entry.getValue().ClanTips); preparedStatement.setString(17, entry.getKey()); preparedStatement.execute(); @@ -132,7 +129,6 @@ public class PreferencesRepository extends MinecraftRepository preferences.ClanTips = resultSet.getBoolean(13); preferences.HubMusic = resultSet.getBoolean(14); preferences.DisableAds = resultSet.getBoolean(15); - preferences.ShowUserReports = resultSet.getBoolean(16); } return preferences; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java index f6ef8efba..ee8e1ca3b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/UserPreferences.java @@ -12,7 +12,6 @@ public class UserPreferences public boolean Invisibility = false; public boolean HubForcefield = false; public boolean ShowMacReports = false; - public boolean ShowUserReports = false; public boolean IgnoreVelocity = false; public boolean PendingFriendRequests = true; public boolean friendDisplayInventoryUI = true; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java index 26ece8cbe..f9a682df6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/preferences/ui/ExclusivePreferencesPage.java @@ -24,13 +24,11 @@ public class ExclusivePreferencesPage extends ShopPageBase + _reportManager.getReportRepository().getReport(reportNotification.getReportId()).thenAccept(report -> + { + if (report != null) + { + int handlerId = reportNotification.getHandlerId(); + + _reportManager.getReportRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> { - if (report != null) + if (handlerUUID != null) { - int handlerId = reportNotification.getHandlerId(); + Player handler = Bukkit.getPlayer(handlerUUID); - _reportManager.getReportRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> + if (handler != null) { - if (handlerUUID != null) - { - Player handler = Bukkit.getPlayer(handlerUUID); - - if (handler != null) - { - sendRawMessage(handler, reportNotification.getNotification()); - } - } - }); + sendRawMessage(handler, reportNotification.getNotification()); + } } - } - ); - } - else if (command instanceof ReportNotification) - { - ReportNotification reportNotification = (ReportNotification) command; - - // Message all players that can receive report notifications. - for (Player player : UtilServer.getPlayers()) - { - if (_reportManager.hasReportNotifications(player)) - { - sendRawMessage(player, reportNotification.getNotification()); - } - } + }); + } + } + ); } }