Small method rename

This commit is contained in:
Keir Nellyer 2016-10-22 19:21:38 +01:00
parent 35048b46a7
commit 81bf9bc406
10 changed files with 17 additions and 17 deletions

View File

@ -38,7 +38,7 @@ public class SnapshotManager
_snapshotRepository = snapshotRepository; _snapshotRepository = snapshotRepository;
} }
public SnapshotRepository getSnapshotRepository() public SnapshotRepository getRepository()
{ {
return _snapshotRepository; return _snapshotRepository;
} }

View File

@ -35,7 +35,7 @@ public class PushSnapshotsHandler implements CommandCallback
if (messages.size() > 0) if (messages.size() > 0)
{ {
_reportManager.getReportRepository().getReport(reportId).thenAccept(reportOptional -> _reportManager.getRepository().getReport(reportId).thenAccept(reportOptional ->
{ {
if (reportOptional.isPresent()) if (reportOptional.isPresent())
{ {

View File

@ -38,7 +38,7 @@ public class ReportHandlerTask extends BukkitRunnable
private CompletableFuture<Optional<Report>> getReport() private CompletableFuture<Optional<Report>> getReport()
{ {
return _reportManager.getReportRepository().getReport(_reportId); return _reportManager.getRepository().getReport(_reportId);
} }
public void start(JavaPlugin plugin) public void start(JavaPlugin plugin)
@ -70,7 +70,7 @@ public class ReportHandlerTask extends BukkitRunnable
{ {
if (isActive) if (isActive)
{ {
_reportManager.getReportRepository().getAccountName(report.getSuspectId()) _reportManager.getRepository().getAccountName(report.getSuspectId())
.thenAccept(suspectName -> .thenAccept(suspectName ->
{ {
String prefix = F.main(ReportManager.getReportPrefix(reportId), ""); String prefix = F.main(ReportManager.getReportPrefix(reportId), "");
@ -121,7 +121,7 @@ public class ReportHandlerTask extends BukkitRunnable
int handlerId = handlerIdOptional.get(); int handlerId = handlerIdOptional.get();
JsonMessage finalJsonMessage = jsonMessage; JsonMessage finalJsonMessage = jsonMessage;
_reportManager.getReportRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> _reportManager.getRepository().getAccountUUID(handlerId).thenAccept(handlerUUID ->
{ {
if (handlerUUID != null) if (handlerUUID != null)
{ {
@ -165,7 +165,7 @@ public class ReportHandlerTask extends BukkitRunnable
for (ReportMessage reportMessage : reportMessages) for (ReportMessage reportMessage : reportMessages)
{ {
// this is blocking, but that's okay as it will only be called asynchronously // 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 // 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()); 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());

View File

@ -105,7 +105,7 @@ public class ReportManager
* *
* @return the repository * @return the repository
*/ */
public ReportRepository getReportRepository() public ReportRepository getRepository()
{ {
return _reportRepository; return _reportRepository;
} }
@ -157,7 +157,7 @@ public class ReportManager
// create snapshot id ahead of time // create snapshot id ahead of time
if (category == ReportCategory.CHAT_ABUSE) if (category == ReportCategory.CHAT_ABUSE)
{ {
SnapshotMetadata snapshotMetadata = _snapshotManager.getSnapshotRepository().createSnapshot(null).join(); SnapshotMetadata snapshotMetadata = _snapshotManager.getRepository().createSnapshot(null).join();
report.setSnapshotMetadata(snapshotMetadata); report.setSnapshotMetadata(snapshotMetadata);
} }
@ -454,7 +454,7 @@ public class ReportManager
*/ */
public CompletableFuture<Boolean> isActiveReport(long reportId) public CompletableFuture<Boolean> isActiveReport(long reportId)
{ {
return getReportRepository().getReport(reportId).thenCompose(reportOptional -> return getRepository().getReport(reportId).thenCompose(reportOptional ->
{ {
if (reportOptional.isPresent()) if (reportOptional.isPresent())
{ {

View File

@ -33,13 +33,13 @@ public class ReportRedisManager implements CommandCallback
{ {
HandlerNotification reportNotification = (HandlerNotification) command; HandlerNotification reportNotification = (HandlerNotification) command;
_reportManager.getReportRepository().getReport(reportNotification.getReportId()).thenAccept(report -> _reportManager.getRepository().getReport(reportNotification.getReportId()).thenAccept(report ->
{ {
if (report != null) if (report != null)
{ {
int handlerId = reportNotification.getHandlerId(); int handlerId = reportNotification.getHandlerId();
_reportManager.getReportRepository().getAccountUUID(handlerId).thenAccept(handlerUUID -> _reportManager.getRepository().getAccountUUID(handlerId).thenAccept(handlerUUID ->
{ {
if (handlerUUID != null) if (handlerUUID != null)
{ {

View File

@ -45,7 +45,7 @@ public class ReportCloseCommand extends CommandBase<ReportPlugin>
{ {
Report report = reportOptional.get(); 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 reportResultPage = new ReportResultPage(Plugin, report, player, suspectName, reason);
reportResultPage.openInventory(); // report is closed when player selects the result reportResultPage.openInventory(); // report is closed when player selects the result

View File

@ -32,13 +32,13 @@ public class ReportHistoryCommand extends CommandBase<ReportPlugin>
{ {
String playerName = args[0]; String playerName = args[0];
Plugin.getReportManager().getReportRepository().getAccountId(playerName).thenAccept(accountIdOptional -> Plugin.getReportManager().getRepository().getAccountId(playerName).thenAccept(accountIdOptional ->
{ {
if (accountIdOptional.isPresent()) if (accountIdOptional.isPresent())
{ {
int accountId = accountIdOptional.get(); 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))); UtilPlayer.message(player, F.main(Plugin.getName(), "Report History for " + F.elem(playerName)));

View File

@ -43,7 +43,7 @@ public class ReportInfoCommand extends CommandBase<ReportPlugin>
long reportId = Long.parseLong(args[0]); long reportId = Long.parseLong(args[0]);
ReportManager reportManager = Plugin.getReportManager(); ReportManager reportManager = Plugin.getReportManager();
ReportRepository repository = reportManager.getReportRepository(); ReportRepository repository = reportManager.getRepository();
repository.getReport(reportId).thenAccept(reportOptional -> repository.getReport(reportId).thenAccept(reportOptional ->
{ {

View File

@ -344,7 +344,7 @@ public class ReportRepository
int snapshotId = resultSet.getInt("snapshotId"); int snapshotId = resultSet.getInt("snapshotId");
if (!resultSet.wasNull()) if (!resultSet.wasNull())
{ {
SnapshotMetadata snapshotMetadata = _reportManager.getSnapshotManager().getSnapshotRepository() SnapshotMetadata snapshotMetadata = _reportManager.getSnapshotManager().getRepository()
.getSnapshotMetadata(snapshotId).join(); .getSnapshotMetadata(snapshotId).join();
report.setSnapshotMetadata(snapshotMetadata); report.setSnapshotMetadata(snapshotMetadata);

View File

@ -60,7 +60,7 @@ public class ReportHandlePage extends SimpleGui implements ReportCategoryCallbac
public void handleReport(ReportCategory category) public void handleReport(ReportCategory category)
{ {
ReportManager reportManager = _plugin.getReportManager(); ReportManager reportManager = _plugin.getReportManager();
ReportRepository reportRepository = reportManager.getReportRepository(); ReportRepository reportRepository = reportManager.getRepository();
reportManager.isHandlingReport(_handler).whenComplete((handlingReport, throwable) -> reportManager.isHandlingReport(_handler).whenComplete((handlingReport, throwable) ->
{ {