From 81bf9bc406839959e4d38bff1d6c3e8de1dbf57a Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Sat, 22 Oct 2016 19:21:38 +0100 Subject: [PATCH] Small method rename --- .../src/mineplex/core/chatsnap/SnapshotManager.java | 2 +- .../core/chatsnap/redis/PushSnapshotsHandler.java | 2 +- .../src/mineplex/core/report/ReportHandlerTask.java | 8 ++++---- .../src/mineplex/core/report/ReportManager.java | 6 +++--- .../src/mineplex/core/report/ReportRedisManager.java | 4 ++-- .../mineplex/core/report/command/ReportCloseCommand.java | 2 +- .../core/report/command/ReportHistoryCommand.java | 4 ++-- .../mineplex/core/report/command/ReportInfoCommand.java | 2 +- .../src/mineplex/core/report/data/ReportRepository.java | 2 +- .../src/mineplex/core/report/ui/ReportHandlePage.java | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java index 389d772bb..bed67e9c0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotManager.java @@ -38,7 +38,7 @@ public class SnapshotManager _snapshotRepository = snapshotRepository; } - public SnapshotRepository getSnapshotRepository() + public SnapshotRepository getRepository() { return _snapshotRepository; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/redis/PushSnapshotsHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/redis/PushSnapshotsHandler.java index 5ee86ecb4..b6668041c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/redis/PushSnapshotsHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/redis/PushSnapshotsHandler.java @@ -35,7 +35,7 @@ public class PushSnapshotsHandler implements CommandCallback if (messages.size() > 0) { - _reportManager.getReportRepository().getReport(reportId).thenAccept(reportOptional -> + _reportManager.getRepository().getReport(reportId).thenAccept(reportOptional -> { if (reportOptional.isPresent()) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java index f8d4974ba..bee2d6181 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportHandlerTask.java @@ -38,7 +38,7 @@ public class ReportHandlerTask extends BukkitRunnable private CompletableFuture> getReport() { - return _reportManager.getReportRepository().getReport(_reportId); + return _reportManager.getRepository().getReport(_reportId); } public void start(JavaPlugin plugin) @@ -70,7 +70,7 @@ public class ReportHandlerTask extends BukkitRunnable { if (isActive) { - _reportManager.getReportRepository().getAccountName(report.getSuspectId()) + _reportManager.getRepository().getAccountName(report.getSuspectId()) .thenAccept(suspectName -> { String prefix = F.main(ReportManager.getReportPrefix(reportId), ""); @@ -121,7 +121,7 @@ public class ReportHandlerTask extends BukkitRunnable int handlerId = handlerIdOptional.get(); JsonMessage finalJsonMessage = jsonMessage; - _reportManager.getReportRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> + _reportManager.getRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> { if (handlerUUID != null) { @@ -165,7 +165,7 @@ public class ReportHandlerTask extends BukkitRunnable for (ReportMessage reportMessage : reportMessages) { // this is blocking, but that's okay as it will only be called asynchronously - String reporterName = _reportManager.getReportRepository().getAccountName(reportMessage.getReporterId()).join(); + String reporterName = _reportManager.getRepository().getAccountName(reportMessage.getReporterId()).join(); // triple backslashes so this translates to valid JSON output[count++] = String.format("%4$s(%d%4$s) %s%s%s - \\\"%s%s%4$s\\\"", count, C.cGold, reporterName, C.cGray, C.cPurple, reportMessage.getMessage()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index d899bae48..076b362b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -105,7 +105,7 @@ public class ReportManager * * @return the repository */ - public ReportRepository getReportRepository() + public ReportRepository getRepository() { return _reportRepository; } @@ -157,7 +157,7 @@ public class ReportManager // create snapshot id ahead of time if (category == ReportCategory.CHAT_ABUSE) { - SnapshotMetadata snapshotMetadata = _snapshotManager.getSnapshotRepository().createSnapshot(null).join(); + SnapshotMetadata snapshotMetadata = _snapshotManager.getRepository().createSnapshot(null).join(); report.setSnapshotMetadata(snapshotMetadata); } @@ -454,7 +454,7 @@ public class ReportManager */ public CompletableFuture isActiveReport(long reportId) { - return getReportRepository().getReport(reportId).thenCompose(reportOptional -> + return getRepository().getReport(reportId).thenCompose(reportOptional -> { if (reportOptional.isPresent()) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRedisManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRedisManager.java index 4b4e1afa3..757f82501 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRedisManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportRedisManager.java @@ -33,13 +33,13 @@ public class ReportRedisManager implements CommandCallback { HandlerNotification reportNotification = (HandlerNotification) command; - _reportManager.getReportRepository().getReport(reportNotification.getReportId()).thenAccept(report -> + _reportManager.getRepository().getReport(reportNotification.getReportId()).thenAccept(report -> { if (report != null) { int handlerId = reportNotification.getHandlerId(); - _reportManager.getReportRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> + _reportManager.getRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> { if (handlerUUID != null) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java index cea670742..432fe5856 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java @@ -45,7 +45,7 @@ public class ReportCloseCommand extends CommandBase { Report report = reportOptional.get(); - reportManager.getReportRepository().getAccountName(report.getSuspectId()).thenCompose(BukkitFuture.accept(suspectName -> + reportManager.getRepository().getAccountName(report.getSuspectId()).thenCompose(BukkitFuture.accept(suspectName -> { ReportResultPage reportResultPage = new ReportResultPage(Plugin, report, player, suspectName, reason); reportResultPage.openInventory(); // report is closed when player selects the result diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHistoryCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHistoryCommand.java index f581a902d..fccd6787b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHistoryCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHistoryCommand.java @@ -32,13 +32,13 @@ public class ReportHistoryCommand extends CommandBase { String playerName = args[0]; - Plugin.getReportManager().getReportRepository().getAccountId(playerName).thenAccept(accountIdOptional -> + Plugin.getReportManager().getRepository().getAccountId(playerName).thenAccept(accountIdOptional -> { if (accountIdOptional.isPresent()) { int accountId = accountIdOptional.get(); - Plugin.getReportManager().getReportRepository().getAccountStatistics(accountId).thenCompose(BukkitFuture.accept(stats -> + Plugin.getReportManager().getRepository().getAccountStatistics(accountId).thenCompose(BukkitFuture.accept(stats -> { UtilPlayer.message(player, F.main(Plugin.getName(), "Report History for " + F.elem(playerName))); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java index 4f5b92b46..c97979861 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportInfoCommand.java @@ -43,7 +43,7 @@ public class ReportInfoCommand extends CommandBase long reportId = Long.parseLong(args[0]); ReportManager reportManager = Plugin.getReportManager(); - ReportRepository repository = reportManager.getReportRepository(); + ReportRepository repository = reportManager.getRepository(); repository.getReport(reportId).thenAccept(reportOptional -> { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java index e0c2554d3..1336ed555 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -344,7 +344,7 @@ public class ReportRepository int snapshotId = resultSet.getInt("snapshotId"); if (!resultSet.wasNull()) { - SnapshotMetadata snapshotMetadata = _reportManager.getSnapshotManager().getSnapshotRepository() + SnapshotMetadata snapshotMetadata = _reportManager.getSnapshotManager().getRepository() .getSnapshotMetadata(snapshotId).join(); report.setSnapshotMetadata(snapshotMetadata); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java index a10835ae2..9cacb7adf 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ui/ReportHandlePage.java @@ -60,7 +60,7 @@ public class ReportHandlePage extends SimpleGui implements ReportCategoryCallbac public void handleReport(ReportCategory category) { ReportManager reportManager = _plugin.getReportManager(); - ReportRepository reportRepository = reportManager.getReportRepository(); + ReportRepository reportRepository = reportManager.getRepository(); reportManager.isHandlingReport(_handler).whenComplete((handlingReport, throwable) -> {