From dd5a284d55fc19ba254d4c67f9f05386f85c3ade Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 00:29:57 +0100 Subject: [PATCH 01/30] Print stacktrace when unable to fetch report player is handling --- .../src/mineplex/core/report/command/ReportCloseCommand.java | 3 +++ 1 file changed, 3 insertions(+) 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 0efd2481c..cea670742 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportCloseCommand.java @@ -1,5 +1,7 @@ package mineplex.core.report.command; +import java.util.logging.Level; + import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; @@ -57,6 +59,7 @@ public class ReportCloseCommand extends CommandBase else { UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "An error occurred, please try again later.")); + Plugin.getPlugin().getLogger().log(Level.SEVERE, "An error occurred whilst fetching the report being handled by " + player.getName(), throwable); } }); } From 26d6540b2f3ede7e66b781fece1620f56185bebe Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 00:36:52 +0100 Subject: [PATCH 02/30] Fix closing reason being truncated with long closing messages --- Plugins/Mineplex.ReportSite/sql/hotfix.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 Plugins/Mineplex.ReportSite/sql/hotfix.sql diff --git a/Plugins/Mineplex.ReportSite/sql/hotfix.sql b/Plugins/Mineplex.ReportSite/sql/hotfix.sql new file mode 100644 index 000000000..0cc5dac41 --- /dev/null +++ b/Plugins/Mineplex.ReportSite/sql/hotfix.sql @@ -0,0 +1 @@ +ALTER TABLE Account.reportResults MODIFY reason VARCHAR(100); \ No newline at end of file From 45eeac8cee6d4ccfefe56476350745d130bf1094 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 01:05:50 +0100 Subject: [PATCH 03/30] Prevent double exception printing when an error occurs whilst saving a report --- .../mineplex/core/report/ReportManager.java | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 4f5a2e263..2e18feb97 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -266,64 +266,68 @@ public class ReportManager saveCompletableFuture.thenAccept(reportId -> { - if (reportResult.getType() == ReportResultType.ABUSIVE) + try { - // if report was marked abusive, check if each of the reporters - // should be banned from using the report system - report.getReporterIds().forEach(reporterId -> - _reportRepository.getAccountUUID(reporterId).thenAccept(reporterUUID -> - { - CoreClient reporterClient = _clientManager.Get(reporterUUID); - checkAbuseBan(reporterClient, reportCloser, reportId); - })); - } - - Bukkit.getScheduler().runTask(_plugin, () -> - { - String prefix = getReportPrefix(reportId); - String reason = reportResult.getReason().orElse("No reason specified."); - - if (reportCloser != null) + if (reportResult.getType() == ReportResultType.ABUSIVE) { - if (reportResult.getType() == ReportResultType.ACCEPTED) - { - // TODO: force moderator to choose a punishment (requires new punish gui) - CommandCenter.Instance.onPlayerCommandPreprocess( - new PlayerCommandPreprocessEvent(reportCloser, - String.format("/punish %s Report #%s - %s", suspectName, reportId, reason))); - } - - // TODO: send these after punishment has been decided (requires new punish gui) - reportCloser.sendMessage( - F.main(prefix, "Report marked as: " - + C.cGold + reportResult.getType().getName())); - reportCloser.sendMessage(F.main(prefix, "Reason: " + F.elem(reason))); + // if report was marked abusive, check if each of the reporters + // should be banned from using the report system + report.getReporterIds().forEach(reporterId -> + _reportRepository.getAccountUUID(reporterId).thenAccept(reporterUUID -> + { + CoreClient reporterClient = _clientManager.Get(reporterUUID); + checkAbuseBan(reporterClient, reportCloser, reportId); + })); } - getUUIDs(report.getReporterIds()).thenAccept(ids -> + Bukkit.getScheduler().runTask(_plugin, () -> { - ReportResultType resultType = reportResult.getType(); - ChildJsonMessage jsonMessage = new JsonMessage(F.main( - prefix, - "Your report against " + F.elem(suspectName) + " was marked as " + F.elem(resultType.getName()) + ".")) - .extra("\n"); + String prefix = getReportPrefix(reportId); + String reason = reportResult.getReason().orElse("No reason specified."); - if (resultType == ReportResultType.ABUSIVE) + if (reportCloser != null) { - jsonMessage = jsonMessage.add(F.main(prefix, C.cRed + "Submitting false reports may result in punishment.")) - .add("\n"); + if (reportResult.getType() == ReportResultType.ACCEPTED) + { + // TODO: force moderator to choose a punishment (requires new punish gui) + CommandCenter.Instance.onPlayerCommandPreprocess( + new PlayerCommandPreprocessEvent(reportCloser, + String.format("/punish %s Report #%s - %s", suspectName, reportId, reason))); + } + + // TODO: send these after punishment has been decided (requires new punish gui) + reportCloser.sendMessage( + F.main(prefix, "Report marked as: " + + C.cGold + reportResult.getType().getName())); + reportCloser.sendMessage(F.main(prefix, "Reason: " + F.elem(reason))); } - jsonMessage = jsonMessage.add(F.main(prefix, "Reason: " + F.elem(reason))); + getUUIDs(report.getReporterIds()).thenAccept(ids -> + { + ReportResultType resultType = reportResult.getType(); + ChildJsonMessage jsonMessage = new JsonMessage(F.main( + prefix, + "Your report against " + F.elem(suspectName) + " was marked as " + F.elem(resultType.getName()) + ".")) + .extra("\n"); - new ReportersNotification(ids, jsonMessage).publish(); + if (resultType == ReportResultType.ABUSIVE) + { + jsonMessage = jsonMessage.add(F.main(prefix, C.cRed + "Submitting false reports may result in punishment.")) + .add("\n"); + } + + jsonMessage = jsonMessage.add(F.main(prefix, "Reason: " + F.elem(reason))); + + new ReportersNotification(ids, jsonMessage).publish(); + }); }); - }); - _reportRepository.clearCache(reportId); - }).exceptionally(throwable -> { - _plugin.getLogger().log(Level.SEVERE, "Post-report save failed.", throwable); - return null; + _reportRepository.clearCache(reportId); + } + catch (Throwable throwable) + { + _plugin.getLogger().log(Level.SEVERE, "Post-report save failed.", throwable); + } }); }); } From 4818936943afc516080ef29c6a3b53a256fbc40c Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 01:16:30 +0100 Subject: [PATCH 04/30] Prevent double exception logging --- .../src/mineplex/core/report/ReportManager.java | 6 +----- .../mineplex/core/report/command/ReportHandleCommand.java | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 2e18feb97..c9b95c904 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -579,11 +579,7 @@ public class ReportManager return Optional.ofNullable(report); }); - future.exceptionally(throwable -> - { - _plugin.getLogger().log(Level.SEVERE, "Error getting the report account is handling.", throwable); - return Optional.empty(); - }); + future.exceptionally(throwable -> Optional.empty()); return future; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java index ffb7f53cc..e78cf6e17 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java @@ -39,9 +39,9 @@ public class ReportHandleCommand extends CommandBase ReportRepository reportRepository = reportManager.getReportRepository(); int accountId = _commandCenter.GetClientManager().getAccountId(player); - reportManager.isHandlingReport(player).thenAccept(isHandlingReport -> + reportManager.isHandlingReport(player).thenAccept(handlingReport -> { - if (!isHandlingReport) + if (!handlingReport) { Map reportPriorities = Collections.synchronizedMap(new HashMap<>()); boolean devMode = reportManager.isDevMode(player.getUniqueId()); From de72f119fe909fdb87e2492966a8640ba5539285 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 01:28:07 +0100 Subject: [PATCH 05/30] Don't allow players to handle new accounts in exceptional cases --- .../src/mineplex/core/report/ReportManager.java | 13 ++++--------- .../mineplex/core/report/data/ReportRepository.java | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index c9b95c904..0dca31d6d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -519,14 +519,6 @@ public class ReportManager CompletableFuture> future = _reportRepository.getReportsHandling(accountId); return future.thenApply(reportIds -> { - // if for some reason we cannot fetch the report a user is handling - // assume the worst and return true - // this means we do not end up allowing a user to handle multiple reports simultaneously - if (reportIds == null) - { - return true; - } - for (long reportId : reportIds) { if (isActiveReport(reportId).join()) @@ -536,7 +528,10 @@ public class ReportManager } return false; - }); + }).exceptionally(throwable -> true); + // ^ if for some reason we cannot fetch the report a user is handling + // assume the worst and return true + // this means we do not end up allowing a user to handle multiple reports simultaneously } /** 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 e21a29c71..a90cc8f86 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -230,7 +230,7 @@ public class ReportRepository future.exceptionally(throwable -> { _logger.log(Level.SEVERE, "Error fetching reports being handled by specified account.", throwable); - return new ArrayList<>(); + return null; }); return future; From ee532c1b8e018818bce60ce3eabc75a4cb7e78b4 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 01:44:49 +0100 Subject: [PATCH 06/30] Improve exception handling --- .../mineplex/core/report/ReportManager.java | 48 +++++---- .../report/command/ReportAbortCommand.java | 24 +++-- .../report/command/ReportHandleCommand.java | 97 ++++++++++--------- .../core/report/data/ReportRepository.java | 6 +- 4 files changed, 101 insertions(+), 74 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 0dca31d6d..e1875e1bd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -627,31 +627,43 @@ public class ReportManager { int playerId = _clientManager.Get(player).getAccountId(); - getReportHandling(playerId).thenAccept(reportOptional -> + getReportHandling(playerId).whenComplete((reportOptional, throwable) -> { - if (reportOptional.isPresent()) + if (throwable == null) { - Report report = reportOptional.get(); - - if (!report.getHandlerTask().isPresent()) + if (reportOptional.isPresent()) { - long reportId = report.getId().orElseThrow(() -> new IllegalStateException("Report id is not present.")); - new ReportHandlerTask(this, reportId).start(_plugin); + Report report = reportOptional.get(); + + if (!report.getHandlerTask().isPresent()) + { + long reportId = report.getId().orElseThrow(() -> new IllegalStateException("Report id is not present.")); + new ReportHandlerTask(this, reportId).start(_plugin); + } } } + else + { + _plugin.getLogger().log(Level.SEVERE, "Error whilst checking for report being handled by " + player.getName(), throwable); + } }); - _reportRepository.getOngoingReports(playerId) - .thenAccept(reports -> - { - for (Report report : reports) - { - sendHandlerNotification(report, - F.main(getReportPrefix(report), - String.format("%s has joined %s.", player.getName(), F.elem(_serverName)))); - } - } - ); + _reportRepository.getOngoingReports(playerId).whenComplete((reports, throwable) -> + { + if (throwable == null) + { + for (Report report : reports) + { + sendHandlerNotification(report, + F.main(getReportPrefix(report), + String.format("%s has joined %s.", player.getName(), F.elem(_serverName)))); + } + } + else + { + _plugin.getLogger().log(Level.SEVERE, "Error whilst checking for on-going reports against " + player.getName(), throwable); + } + }); } protected void onPlayerQuit(Player player) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java index 6230407df..4c44e8953 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java @@ -1,5 +1,7 @@ package mineplex.core.report.command; +import java.util.logging.Level; + import org.bukkit.entity.Player; import mineplex.core.command.CommandBase; @@ -30,19 +32,27 @@ public class ReportAbortCommand extends CommandBase { ReportManager reportManager = Plugin.getReportManager(); - reportManager.getReportHandling(player).thenApply(BukkitFuture.accept(reportOptional -> + reportManager.getReportHandling(player).whenComplete(BukkitFuture.complete((reportOptional, throwable) -> { - if (reportOptional.isPresent()) + if (throwable != null) { - Report report = reportOptional.get(); + if (reportOptional.isPresent()) + { + Report report = reportOptional.get(); - reportManager.abortReport(report).thenApply(BukkitFuture.accept(voidValue -> - UtilPlayer.message(player, F.main(ReportManager.getReportPrefix(report), - "Report has been aborted and may be handled by another staff member.")))); + reportManager.abortReport(report).thenApply(BukkitFuture.accept(voidValue -> + UtilPlayer.message(player, F.main(ReportManager.getReportPrefix(report), + "Report has been aborted and may be handled by another staff member.")))); + } + else + { + UtilPlayer.message(player, F.main(Plugin.getName(), "You aren't currently handling a report.")); + } } else { - UtilPlayer.message(player, F.main(Plugin.getName(), "You aren't currently handling a report.")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Internal error, please try again.")); + Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst aborting report for player " + player.getName(), throwable); } })); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java index e78cf6e17..8613c648e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; +import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -39,62 +40,70 @@ public class ReportHandleCommand extends CommandBase ReportRepository reportRepository = reportManager.getReportRepository(); int accountId = _commandCenter.GetClientManager().getAccountId(player); - reportManager.isHandlingReport(player).thenAccept(handlingReport -> + reportManager.isHandlingReport(player).whenComplete((handlingReport, throwable) -> { - if (!handlingReport) + if (throwable == null) { - Map reportPriorities = Collections.synchronizedMap(new HashMap<>()); - boolean devMode = reportManager.isDevMode(player.getUniqueId()); - - // the below fetches the ids of all unhandled reports and gets a Report object for each of these ids - // the priority of the report is then calculated and the results placed in a map - reportRepository.getUnhandledReports(accountId, devMode).thenCompose(reportRepository::getReports).thenAccept(reports -> - CompletableFuture.allOf(reports.stream().map(report -> - reportManager.calculatePriority(report).thenAccept(priority -> - { - if (priority > 0) - { - reportPriorities.put(report, priority); - } - else - { - // mark the report as expired to keep the database clean - // and reduce future query time - reportManager.expireReport(report); - } - } - ) - ).toArray(CompletableFuture[]::new)).join() - ).thenApply(aVoid -> + if (!handlingReport) { - Map.Entry mostImportant = null; + Map reportPriorities = Collections.synchronizedMap(new HashMap<>()); + boolean devMode = reportManager.isDevMode(player.getUniqueId()); - for (Map.Entry entry : reportPriorities.entrySet()) + // the below fetches the ids of all unhandled reports and gets a Report object for each of these ids + // the priority of the report is then calculated and the results placed in a map + reportRepository.getUnhandledReports(accountId, devMode).thenCompose(reportRepository::getReports).thenAccept(reports -> + CompletableFuture.allOf(reports.stream().map(report -> + reportManager.calculatePriority(report).thenAccept(priority -> + { + if (priority > 0) + { + reportPriorities.put(report, priority); + } + else + { + // mark the report as expired to keep the database clean + // and reduce future query time + reportManager.expireReport(report); + } + } + ) + ).toArray(CompletableFuture[]::new)).join() + ).thenApply(aVoid -> { - if (mostImportant == null || (double) entry.getValue() > mostImportant.getValue()) + Map.Entry mostImportant = null; + + for (Map.Entry entry : reportPriorities.entrySet()) { - mostImportant = entry; + if (mostImportant == null || (double) entry.getValue() > mostImportant.getValue()) + { + mostImportant = entry; + } } - } - return mostImportant == null ? null : mostImportant.getKey(); - }).thenCompose(BukkitFuture.accept(report -> + return mostImportant == null ? null : mostImportant.getKey(); + }).thenCompose(BukkitFuture.accept(report -> + { + if (report != null) + { + reportManager.handleReport(report, player); + } + else + { + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "No report found, report queue is empty.")); + } + })); + } + else { - if (report != null) - { - reportManager.handleReport(report, player); - } - else - { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "No report found, report queue is empty.")); - } - })); + Bukkit.getScheduler().runTask(Plugin.getPlugin(), () -> + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You are already handling a report."))); + + } } else { - Bukkit.getScheduler().runTask(Plugin.getPlugin(), () -> - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "You are already handling a report."))); - + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Internal error, please try again")); + Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst checking for reports being handled by " + player.getName(), throwable); } }); } 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 a90cc8f86..2f7373bac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/data/ReportRepository.java @@ -227,11 +227,7 @@ public class ReportRepository return reportsHandling; }); - future.exceptionally(throwable -> - { - _logger.log(Level.SEVERE, "Error fetching reports being handled by specified account.", throwable); - return null; - }); + future.exceptionally(throwable -> null); return future; } From 2a2cd5024a117f5e4eb1720dee78c8e942a7a416 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 01:56:49 +0100 Subject: [PATCH 07/30] Change message displayed when an error occurs --- .../src/mineplex/core/report/command/ReportAbortCommand.java | 2 +- .../src/mineplex/core/report/command/ReportHandleCommand.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java index 4c44e8953..f210d5b01 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java @@ -51,7 +51,7 @@ public class ReportAbortCommand extends CommandBase } else { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Internal error, please try again.")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "An error occurred, please try again later.")); Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst aborting report for player " + player.getName(), throwable); } })); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java index 8613c648e..a988ab3d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportHandleCommand.java @@ -102,7 +102,7 @@ public class ReportHandleCommand extends CommandBase } else { - UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Internal error, please try again")); + UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "An error occurred, please try again later.")); Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst checking for reports being handled by " + player.getName(), throwable); } }); From 7926d88d5b7af279a037851fa945957303b26e83 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Fri, 30 Sep 2016 17:18:47 +0100 Subject: [PATCH 08/30] Update report result reason length as future version of Minecraft will be increasing message lengths --- Plugins/Mineplex.ReportSite/sql/hotfix.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.ReportSite/sql/hotfix.sql b/Plugins/Mineplex.ReportSite/sql/hotfix.sql index 0cc5dac41..aa902c45e 100644 --- a/Plugins/Mineplex.ReportSite/sql/hotfix.sql +++ b/Plugins/Mineplex.ReportSite/sql/hotfix.sql @@ -1 +1 @@ -ALTER TABLE Account.reportResults MODIFY reason VARCHAR(100); \ No newline at end of file +ALTER TABLE Account.reportResults MODIFY reason VARCHAR(256); \ No newline at end of file From 0181e21853e024df89504784aac4fc3ab0d67370 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Sat, 1 Oct 2016 23:44:16 -0300 Subject: [PATCH 09/30] Fixes for the Block Morph --- .../mineplex/core/cosmetic/ui/page/GadgetPage.java | 6 ------ .../mineplex/core/cosmetic/ui/page/MorphPage.java | 13 +++++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 293e6b84d..1f3d5b4e5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -18,7 +18,6 @@ import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetChangeEvent; -import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphWitch; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -76,11 +75,6 @@ public class GadgetPage extends ShopPageBase protected void addGadget(Gadget gadget, int slot) { - if (gadget instanceof MorphBlock) - { - if (getPlayer().getPassenger() != null) - return; - } List itemLore = new ArrayList(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java index 0d7daaafb..291921cd4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java @@ -1,18 +1,18 @@ package mineplex.core.cosmetic.ui.page; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; - import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; public class MorphPage extends GadgetPage { @@ -31,7 +31,8 @@ public class MorphPage extends GadgetPage addGadget(gadget, slot); if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) - addGlow(slot); + if (!(gadget instanceof MorphBlock)) + addGlow(slot); slot++; From 17b04a6a846057ad85a06122738081886abe795d Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Mon, 3 Oct 2016 10:00:04 +0100 Subject: [PATCH 10/30] PC-1021 Prevent 'null' player being punished --- .../src/mineplex/core/report/ReportManager.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index e1875e1bd..902de4282 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -12,7 +12,6 @@ import java.util.logging.Level; import java.util.stream.Collectors; import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -248,11 +247,8 @@ public class ReportManager checkNotNull(report); checkNotNull(reportResult); - return _reportRepository.getAccountUUID(report.getSuspectId()).thenAccept(suspectUUID -> + return _reportRepository.getAccountName(report.getSuspectId()).thenAccept(suspectName -> { - OfflinePlayer suspect = Bukkit.getOfflinePlayer(suspectUUID); - String suspectName = suspect.getName(); - if (reportCloser != null) { int closerId = _clientManager.Get(reportCloser).getAccountId(); @@ -292,7 +288,7 @@ public class ReportManager // TODO: force moderator to choose a punishment (requires new punish gui) CommandCenter.Instance.onPlayerCommandPreprocess( new PlayerCommandPreprocessEvent(reportCloser, - String.format("/punish %s Report #%s - %s", suspectName, reportId, reason))); + String.format("/punish %s Report #%d - %s", suspectName, reportId, reason))); } // TODO: send these after punishment has been decided (requires new punish gui) From a923f80438b11e7de16a98d68a5bb4ccfda581b0 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Mon, 3 Oct 2016 19:24:01 +0100 Subject: [PATCH 11/30] Accidentally missed out inserting reportTeams' "enums" --- Plugins/Mineplex.ReportSite/sql/upgrade.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.ReportSite/sql/upgrade.sql b/Plugins/Mineplex.ReportSite/sql/upgrade.sql index c089a9c96..e55ad6b17 100644 --- a/Plugins/Mineplex.ReportSite/sql/upgrade.sql +++ b/Plugins/Mineplex.ReportSite/sql/upgrade.sql @@ -161,4 +161,6 @@ INSERT INTO Account.reportResultTypes (id, globalStat, name) VALUES (3, 1, 'EXPI INSERT INTO Account.snapshotTypes (id, name) VALUES (0, 'CHAT'); INSERT INTO Account.snapshotTypes (id, name) VALUES (1, 'PM'); -INSERT INTO Account.snapshotTypes (id, name) VALUES (2, 'PARTY'); \ No newline at end of file +INSERT INTO Account.snapshotTypes (id, name) VALUES (2, 'PARTY'); + +INSERT INTO Account.reportTeams (id, name) VALUES (0, 'RC'); \ No newline at end of file From fb29947705345a49a7c4edcd8a2723752c966864 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Mon, 3 Oct 2016 22:43:49 -0300 Subject: [PATCH 12/30] Fixes for the Witch Morph --- .../core/gadget/gadgets/morph/MorphWitch.java | 31 +++++++++++++------ .../core/treasure/TreasureManager.java | 20 +++++++++--- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java index 70f8e22ab..3b457ee01 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java @@ -1,14 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.*; -import mineplex.core.disguise.disguises.DisguiseWitch; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetSelectLocationEvent; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -17,6 +8,20 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseWitch; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MorphWitch extends MorphGadget { @@ -97,6 +102,14 @@ public class MorphWitch extends MorphGadget UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!")); return; } + for (Location blockLocation : Manager.getTreasureManager().getBlockLocations()) + { + if (blockLocation.distanceSquared(cauldronLocation) <= 25) + { + UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!")); + return; + } + } } // Checks if the player is close to a cactus diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index a63dc4b6f..01c4b1e54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -2,7 +2,14 @@ package mineplex.core.treasure; import java.util.List; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.plugin.java.JavaPlugin; + import com.google.common.collect.Lists; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; @@ -18,11 +25,6 @@ import mineplex.core.reward.RewardPool; import mineplex.core.reward.RewardType; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.plugin.java.JavaPlugin; /** * Created by Shaun on 8/27/2014. @@ -36,6 +38,7 @@ public class TreasureManager extends MiniPlugin private HologramManager _hologramManager; private StatsManager _statsManager; private List _treasureLocations; + private List _blockLocations; public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, GadgetManager gadgetManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) { @@ -49,11 +52,13 @@ public class TreasureManager extends MiniPlugin _rewardManager = rewardManager; _treasureLocations = Lists.newArrayList(); + _blockLocations = Lists.newArrayList(); for(Location location : LocationConstants.CHEST_LOCATIONS) { Location resetLocation = LocationConstants.getResetLocation(location); Block[] blocks = setup(location.getBlock()); + _blockLocations.add(location); _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, location.getBlock(), blocks, resetLocation, _hologramManager, gadgetManager, statusManager)); } @@ -151,4 +156,9 @@ public class TreasureManager extends MiniPlugin { return _treasureLocations; } + + public List getBlockLocations() + { + return _blockLocations; + } } From afee339e161f4e169e96ae9b328faf20ee1a1510 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 4 Oct 2016 16:20:11 +0100 Subject: [PATCH 13/30] Any report with a handler and no conclusion is an active report, therefore we don't need to check if the report is active --- .../mineplex/core/report/ReportManager.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 902de4282..0710cbba2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -553,22 +553,22 @@ public class ReportManager reportIds.stream().map(_reportRepository::getReport).collect(Collectors.toList()) ).thenCompose(UtilFuture::sequence) .thenApply(UtilCollections::unboxPresent) - .thenCompose(reports -> UtilFuture.filter(reports, this::isActiveReport)).thenApply(reports -> - { - Report report = null; - int size = reports.size(); + .thenApply(reports -> + { + Report report = null; + int size = reports.size(); - if (size == 1) - { - report = reports.get(0); - } - else if (size > 1) - { - throw new IllegalStateException("Account is handling multiple reports."); - } + if (size == 1) + { + report = reports.get(0); + } + else if (size > 1) + { + throw new IllegalStateException("Account is handling multiple reports."); + } - return Optional.ofNullable(report); - }); + return Optional.ofNullable(report); + }); future.exceptionally(throwable -> Optional.empty()); From 6709001c8906dbd5a46992dd2c259b0fd07ab886 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 4 Oct 2016 16:25:51 +0100 Subject: [PATCH 14/30] Remove double handle check, pointless and can potentially cause issues --- .../src/mineplex/core/report/ReportManager.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java index 0710cbba2..34b92a4f7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/ReportManager.java @@ -512,19 +512,9 @@ public class ReportManager */ public CompletableFuture isHandlingReport(int accountId) { - CompletableFuture> future = _reportRepository.getReportsHandling(accountId); - - return future.thenApply(reportIds -> { - for (long reportId : reportIds) - { - if (isActiveReport(reportId).join()) - { - return true; - } - } - - return false; - }).exceptionally(throwable -> true); + return _reportRepository.getReportsHandling(accountId) + .thenApply(reportIds -> reportIds.size() > 0) + .exceptionally(throwable -> true); // ^ if for some reason we cannot fetch the report a user is handling // assume the worst and return true // this means we do not end up allowing a user to handle multiple reports simultaneously From 22707d6d2e0ab7b7a2be85239baa35c7b9f6ca64 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 4 Oct 2016 16:34:19 +0100 Subject: [PATCH 15/30] Only execute if throwable is null --- .../src/mineplex/core/report/command/ReportAbortCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java index f210d5b01..67450ea61 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/report/command/ReportAbortCommand.java @@ -34,7 +34,7 @@ public class ReportAbortCommand extends CommandBase reportManager.getReportHandling(player).whenComplete(BukkitFuture.complete((reportOptional, throwable) -> { - if (throwable != null) + if (throwable == null) { if (reportOptional.isPresent()) { From 5d8c079be693543ba2d7db9c0bf68043a40403ca Mon Sep 17 00:00:00 2001 From: Sam Sun Date: Tue, 4 Oct 2016 15:28:12 -0400 Subject: [PATCH 16/30] Understand the squid disguise code (#217) --- .../core/disguise/DisguiseManager.java | 126 +----------------- 1 file changed, 6 insertions(+), 120 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index 89f265793..57bf4a047 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -13,6 +13,7 @@ import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseInsentient; import mineplex.core.disguise.disguises.DisguiseLiving; import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketInfo; @@ -85,10 +86,6 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler // The map of which players should a disguise be shown to private Map> _disguisePlayerMap = new HashMap<>(); - // todo understand how this works - private Map _movePacketMap = new HashMap<>(); - private Set _goingUp = new HashSet<>(); - private HashSet _blockedNames = new HashSet<>(); private boolean _handlingPacket = false; @@ -106,9 +103,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler PacketPlayOutSpawnEntityLiving.class, PacketPlayOutUpdateAttributes.class, PacketPlayOutEntityEquipment.class, - PacketPlayOutEntityVelocity.class, - PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, - PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class + PacketPlayOutEntityVelocity.class ); createBedChunk(); @@ -441,127 +436,18 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler } } } - // honestly im not really sure how this works or what it's really meant to do - // it unbreaks squid in SSM though so I guess it's useful - // todo understand how it works else if (packet instanceof PacketPlayOutEntityVelocity) { PacketPlayOutEntityVelocity velocityPacket = (PacketPlayOutEntityVelocity) packet; - // Only for viewers - if (velocityPacket.a == owner.getEntityId()) - { - if (velocityPacket.c > 0) - _goingUp.add(velocityPacket.a); - } - else if (velocityPacket.b == 0 && velocityPacket.c == 0 && velocityPacket.d == 0) - { - return; - } - else if (_spawnPacketMap.containsKey(velocityPacket.a)) + DisguiseBase latestDisguise = getActiveDisguise(velocityPacket.a); + + // Squids will move using their current velocity every tick. So let's just not give them any velocities + if (latestDisguise != null && latestDisguise instanceof DisguiseSquid && getActiveDisguise(owner) != latestDisguise) { packetInfo.setCancelled(true); } } - else if (packet instanceof PacketPlayOutEntity.PacketPlayOutRelEntityMove) - { - final PacketPlayOutEntity.PacketPlayOutRelEntityMove movePacket = (PacketPlayOutEntity.PacketPlayOutRelEntityMove) packet; - - // Only for viewers - if (movePacket.a == owner.getEntityId()) - return; - - if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c < 20) - { - _goingUp.remove(movePacket.a); - _movePacketMap.remove(movePacket.a); - } - - if (!containsSpawnDisguise(owner, getActiveDisguise(movePacket.a))) - return; - - final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(); - velocityPacket.a = movePacket.a; - velocityPacket.b = movePacket.b * 100; - velocityPacket.c = movePacket.c * 100; - velocityPacket.d = movePacket.d * 100; - - if (_movePacketMap.containsKey(movePacket.a)) - { - PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); - - velocityPacket.b = (int) (.8 * lastVelocityPacket.b); - velocityPacket.c = (int) (.8 * lastVelocityPacket.c); - velocityPacket.d = (int) (.8 * lastVelocityPacket.d); - } - - _movePacketMap.put(movePacket.a, velocityPacket); - - packetVerifier.bypassProcess(velocityPacket); - - if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20) - { - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - public void run() - { - packetVerifier.bypassProcess(velocityPacket); - } - }); - } - - if (getActiveDisguise(movePacket.a) instanceof DisguiseBlock) - { - - } - } - else if (packet instanceof PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook) - { - final PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook movePacket = (PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook) packet; - - // Only for viewers - if (movePacket.a == owner.getEntityId()) - return; - - if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c <= 20) - { - _goingUp.remove(movePacket.a); - _movePacketMap.remove(movePacket.a); - } - - if (!containsSpawnDisguise(owner, getActiveDisguise(movePacket.a))) - return; - - final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(); - velocityPacket.a = movePacket.a; - velocityPacket.b = movePacket.b * 100; - velocityPacket.c = movePacket.c * 100; - velocityPacket.d = movePacket.d * 100; - - if (_movePacketMap.containsKey(movePacket.a)) - { - PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); - - velocityPacket.b = (int) (.8 * lastVelocityPacket.b); - velocityPacket.c = (int) (.8 * lastVelocityPacket.c); - velocityPacket.d = (int) (.8 * lastVelocityPacket.d); - } - - _movePacketMap.put(movePacket.a, velocityPacket); - - packetVerifier.bypassProcess(velocityPacket); - - if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20) - { - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() - { - public void run() - { - packetVerifier.bypassProcess(velocityPacket); - } - }); - } - } } private void handlePacket(Packet packet, PacketVerifier verifier) From 46db80a056af99dbcf6bbf7c5cc2a3dc3fba21d0 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Tue, 4 Oct 2016 20:32:04 +0100 Subject: [PATCH 17/30] Always check game object is not null before attempting to access it (#225) --- .../nautilus/game/arcade/ArcadeManager.java | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 79cd35f11..0b5f9ad30 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -839,26 +839,22 @@ public class ArcadeManager extends MiniPlugin implements IRelation { UtilServer.broadcast(F.sys("Quit", event.getPlayer().getName())); - if (_game.GetCountdown() > 0) //Lobby is counting down + if (_game != null && _game.GetCountdown() > 0) //Lobby is counting down { - // Clean - if (_game != null) + // Remove Data + _game.RemoveTeamPreference(event.getPlayer()); + _game.GetPlayerKits().remove(event.getPlayer()); + _game.GetPlayerGems().remove(event.getPlayer()); + + // Leave Team + GameTeam team = _game.GetTeam(event.getPlayer()); + + if (team != null) { - // Remove Data - _game.RemoveTeamPreference(event.getPlayer()); - _game.GetPlayerKits().remove(event.getPlayer()); - _game.GetPlayerGems().remove(event.getPlayer()); - - // Leave Team - GameTeam team = _game.GetTeam(event.getPlayer()); - - if (team != null) - { - team.RemovePlayer(event.getPlayer()); - } + team.RemovePlayer(event.getPlayer()); } } - else if (_game.GetState() != GameState.Recruit) //Game is NOT in lobby + else if (_game != null && _game.GetState() != GameState.Recruit) //Game is NOT in lobby { addSpectator(event.getPlayer(), true); _specList.add(event.getPlayer()); @@ -874,16 +870,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation { UtilServer.broadcast(F.sys("Join", event.getPlayer().getName())); - if (!(_game.GetState() == GameState.Live || _game.GetState() == GameState.Prepare)) + if (_game != null) { - _specList.remove(event.getPlayer()); - if (_game.GetTeam(event.getPlayer()) != null) - _game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.IN); - } + if (!(_game.GetState() == GameState.Live || _game.GetState() == GameState.Prepare)) + { + _specList.remove(event.getPlayer()); + if (_game.GetTeam(event.getPlayer()) != null) + _game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.IN); + } - if (_game != null && isSpectator(event.getPlayer())) - { - event.show(false); + if (isSpectator(event.getPlayer())) + { + event.show(false); + } } } } From 8da5813f299aa0686f5acad0c8f7e198b7c6422b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Oct 2016 11:27:45 -0300 Subject: [PATCH 18/30] Add Halloween Cosmetics (#227) * Internal: Changed imports from java.awt.Color to org.bukkit.Color External: Added Double Jump Halloween Added Arrow Trail Halloween Added Pumpkin Hat * Internal: Fixed Arrow Trail Halloween Added new methods to ParticleData Renamed playerNPC to _playerNPC (WinEffectLavaTrap) Removed unecessary method (WinEffectManager) Added a command to test win rooms properly Fixed Squid Morph not showing name unless players hovered over it Created a Manager for the Morphs so we avoid using deprecated methods External: Added Halloween Win Room Added Grim Reaper Morph Added Headless Horseman Morph Added Nightmare Steed * Internal: Renamed RewardType enums to have upper case External: Added Halloween Death Effect Added Haunted Chest Added Baby Zombie Jockey Pet Changed the names of the items Added Grim Reaper pet * Slack integration to test stuff (Will not be in the code in the last commit) * Fixed Grim Reaper Hoe not being removed after the morph is disabled * Details for the Haunted Chest * Details for all the items (lores, icons, texts, effects, etc) Removed Headless Horseman Morph * Fixes for lores and names Support server stuff * Fixes for the Lock and Unlock cosmetics commands * Fixes for the Grim Reaper Morph * Fixes for the Grim Reaper Morph Removed debug messages * Fixed a memory leak. Thanks to Sam * Fix imports * Removed unused code Added javadocs to UtilTextBottom#displayProgress() Added javadocs to UtilAlg#getRandomLocation() * Removed Death Effect Increased Arrow Trail particles Increased Double Jump particles --- .../core/common/shape/ShapeWings.java | 13 + .../mineplex/core/common/skin/SkinData.java | 3 + .../mineplex/core/common/util/UtilAlg.java | 34 ++- .../core/common/util/UtilTextBottom.java | 32 ++- .../util/particles/ColoredParticle.java | 11 +- .../common/util/particles/DustSpellColor.java | 2 +- .../core/common/util/particles/NoteColor.java | 2 +- .../common/util/particles/ParticleColor.java | 2 - .../common/util/particles/ParticleData.java | 22 +- .../bonuses/commands/AnimationCommand.java | 2 +- .../mineplex/core/bonuses/gui/SpinGui.java | 6 +- .../core/cosmetic/CosmeticManager.java | 30 ++- .../cosmetic/event/SlackCosmeticEvent.java | 45 ++++ .../core/cosmetic/ui/page/GadgetPage.java | 5 + .../core/cosmetic/ui/page/MountPage.java | 13 +- .../core/cosmetic/ui/page/PetPage.java | 33 ++- .../disguise/disguises/DisguiseZombie.java | 8 +- .../src/mineplex/core/elo/TopEloCommand.java | 6 +- .../core/events/AddConditionEvent.java | 232 ++++++++++++++++++ .../core/events/EnableArcadeSpawnEvent.java | 37 +++ .../mineplex/core/gadget/GadgetManager.java | 61 +++-- .../gadget/commands/WinRoomTestCommand.java | 72 ++++++ .../arrowtrail/ArrowTrailHalloween.java | 56 +++++ .../arrowtrail/freedom/ArrowTrailFreedom.java | 5 +- .../doublejump/DoubleJumpHalloween.java | 78 ++++++ .../cupidslove/DoubleJumpCupidsWings.java | 13 +- .../core/gadget/gadgets/hat/HatType.java | 23 +- .../core/gadget/gadgets/item/ItemCoal.java | 2 +- .../core/gadget/gadgets/morph/BlockForm.java | 7 +- .../core/gadget/gadgets/morph/MorphBat.java | 11 +- .../core/gadget/gadgets/morph/MorphBlaze.java | 11 +- .../core/gadget/gadgets/morph/MorphBunny.java | 23 +- .../gadget/gadgets/morph/MorphChicken.java | 13 +- .../core/gadget/gadgets/morph/MorphCow.java | 11 +- .../gadget/gadgets/morph/MorphCreeper.java | 13 +- .../gadget/gadgets/morph/MorphEnderman.java | 13 +- .../gadget/gadgets/morph/MorphGrimReaper.java | 228 +++++++++++++++++ .../core/gadget/gadgets/morph/MorphPig.java | 11 +- .../gadgets/morph/MorphPumpkinKing.java | 18 +- .../core/gadget/gadgets/morph/MorphSlime.java | 11 +- .../gadget/gadgets/morph/MorphSnowman.java | 11 +- .../core/gadget/gadgets/morph/MorphSquid.java | 12 +- .../core/gadget/gadgets/morph/MorphTitan.java | 11 +- .../gadget/gadgets/morph/MorphVillager.java | 17 +- .../gadget/gadgets/morph/MorphWither.java | 11 +- .../gadgets/morph/managers/SoulManager.java | 112 +++++++++ .../morph/{swim => managers}/SwimManager.java | 2 +- .../gadgets/morph/managers/UtilMorph.java | 81 ++++++ .../unrelated/BabyFireworkEffect.java | 40 ++- .../unrelated/FreedomFireworkEffect.java | 2 +- .../unrelated/FreedomTrailEffect.java | 2 - .../unrelated/HalloweenSmashedEffect.java | 25 ++ .../particle/unrelated/MetalManEffect.java | 1 + .../wineffect/WinEffectBabyChicken.java | 46 +--- .../gadgets/wineffect/WinEffectHalloween.java | 181 ++++++++++++++ .../gadgets/wineffect/WinEffectLavaTrap.java | 8 +- .../mineplex/core/gadget/types/Gadget.java | 19 +- .../core/gadget/types/WinEffectGadget.java | 72 +++++- .../listeners/GlobalGiveItem.java | 4 +- .../src/mineplex/core/mount/MountManager.java | 1 + .../core/mount/types/MountNightmareSteed.java | 123 ++++++++++ .../core/mount/types/MountSpider.java | 4 +- .../core/mount/types/MountZombie.java | 9 +- .../core/pet/GrimReaperPetManager.java | 85 +++++++ .../src/mineplex/core/pet/Pet.java | 20 +- .../src/mineplex/core/pet/PetFactory.java | 6 +- .../src/mineplex/core/pet/PetManager.java | 162 +++++++----- .../mineplex/core/reward/RewardManager.java | 127 +++++++--- .../src/mineplex/core/reward/RewardPool.java | 1 + .../src/mineplex/core/reward/RewardType.java | 25 +- .../core/reward/rewards/RankReward.java | 4 +- .../core/shop/item/SalesPackageBase.java | 4 +- .../src/mineplex/core/slack/SlackAPI.java | 8 +- .../src/mineplex/core/slack/SlackMessage.java | 23 +- .../src/mineplex/core/slack/SlackTeam.java | 2 +- .../src/mineplex/core/treasure/Treasure.java | 12 +- .../core/treasure/TreasureLocation.java | 8 +- .../mineplex/core/treasure/TreasureStyle.java | 7 + .../mineplex/core/treasure/TreasureType.java | 16 +- .../animation/BlockChangeAnimation.java | 38 ++- .../animation/ChestSpawnAnimation.java | 36 ++- .../treasure/event/TreasureStartEvent.java | 10 +- .../core/treasure/gui/BuyChestButton.java | 3 +- .../core/treasure/gui/TreasurePage.java | 51 ++-- .../valentines/ValentinesGiftManager.java | 4 +- .../src/mineplex/hub/HubManager.java | 2 +- .../hub/modules/HolidayGiftManager.java | 2 +- .../src/mineplex/hub/modules/JumpManager.java | 24 +- .../mineplex/hub/modules/StackerManager.java | 54 ++-- .../game/core/condition/Condition.java | 15 +- .../customerSupport/CustomerSupport.java | 45 ++++ .../salespackage/SalesPackageManager.java | 20 +- .../salespackages/HauntedChest.java | 19 ++ .../nautilus/game/arcade/ArcadeManager.java | 98 +++++--- .../arcade/game/games/typewars/Minion.java | 2 +- .../game/arcade/managers/GameLootManager.java | 4 +- .../game/arcade/managers/HolidayManager.java | 85 +++++-- .../arcade/wineffect/WinEffectManager.java | 10 +- 98 files changed, 2517 insertions(+), 527 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java rename Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/{swim => managers}/SwimManager.java (89%) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java index f42dcaddc..6d5ca87be 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/shape/ShapeWings.java @@ -35,6 +35,19 @@ public class ShapeWings extends ShapeGrid implements CosmeticShape "00$#$0000000000$#$00", "000$000000000000$000", }; + + public static final String[] SMALL_ANGEL_WING_PATTERN = new String[] + { + "00$0000$00", + "0$#$00$#$0", + "$##$00$##$", + "$###$$###$", + "$########$", + "$########$", + "$##$$$$##$", + "0$#$00$#$0", + "00$0000$00" + }; public static final String[] BUTTERFLY_WING_PATTERN = new String[] { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index b551ca902..29abc2b86 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -57,6 +57,9 @@ public class SkinData public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M="); public final static SkinData METAL_MAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTExNTk3OTQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDdlOGQ3MmI0MzI3MjIzZmI1ZjI5OWViN2NiNTVhMTU4OTM4MGYxMWE2ZDIzYmVmZTQ1OWFjNzg3YWY2YTcifX19", "EYXUVtnqtDhaSjBE313TpxriRtW0X7wNdmVR0ARa9qvE8CtP//AhnNxyKkERue1XIyefrYApzM4DWGzU5ZvzraOXg98p/3PSFW5p0PAp14ud/1uJWoq0FuEiJDn7Qo/+K0cuoCVsAn6Bx8nWexxr0XB8ANq/0vpRZpDOPO+irFFGwF8CPbt+7sh09glaHD9q7CM4JzPXrNjLt+ZkhYt7wEuevCXuOONT50tH0BlmfHajs9ai0IiwEwC3R+o0DooMVdCViuVEKWQfMnBDNHN4ZLwEazAcRiFO4VXOG0k/+dbKfX0EwnnygN0qmHKyhQeuR7PUumaRUMHn7sCvWmvgpNzzJMv4f9Biw2SWSI2gpaxHdCoCfFMjCdal+/BbXue6jCvDYq6yQEu+C9BjB3vT633/mbXZZMCl7bRjBzqG/jfeI1ove9o0oSqc4Nx3aA1cOnRE2iMEE74ChgY/sVk4aRVx+GTxKtyRGSzt2V7AvOVlfJh17FQhT/PkiztJ6L1RFLsFKaxQxyiCPgZSXpQ4Dz0iPonxFZl0FjAluElHYb3zn4Uop9sPBqOIeskVUl9zbdlRb7CgDG8a57YkUfs7ZyzzYYmZyt6t08H/PQr++cflY0kfy9eOBDmf9gtes7FLrHHRTE6GJ1+xAkLi5gNEkEUZKZy2embgI5JzuwCIIY8="); public final static SkinData OMEGA_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzI1MTAzNzAwOTksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85MDM2MjNjMmRkMjdhNWM0Y2NlYzY5MWY3NjM0YTNkMzVkNTRiNDg0YjIzNTdhNWQ1ZWFmYmYwNTRkY2NlIn19fQ==", "cQty4zNF2QgzNuVOHTGGX5YVofApKr01KkQ70bO1n+I9nlkc9qqhcigA+uBYdw4THANFsTRwIrskgTS3TTmuaXYmMUoNnj7gr2Gp7D2t7L53QyJJhIw0hHNDvQucf19SOxhtR9FvW+xnh1JcgOTF3VZxIeRaN4bCtqkeFitCJwts4Z7SlDxB4EFZVsifM+gK4iel9YWYGNnZiQm48lxU+dMFd0cCa4L00ngBExQoWC8zbJc3K9LGdqI1YOMh3bCt81F4jcrPnDycxWwOTj/tBri4yeXK1htq5dAixHwq1EF86gQMnfeIIk6D/BREtVKoXK9K4lstYPHLFiBqkwpijArbC0sZp8s/j88NYUz9PgSJ2z/b5jhPChH2OkoGQOL0/QrxqUZUet+WHaIQtvFoqmcFRCKJQembgJGZV0X86XQxEEtevkNgXPigJVyQ5GVuDCeowRkMGfSadQCBsnmdOVZNshS60tBSDcbd2oWeQUJn1+OJkmz+OktbMbP4ttN6x3+MPMSZoGT1bc1BSRNFRYOBZuNz1zLWsHFRyNLaVS3ep/ktE+Rt5sbapo+r4GjrKGV7Unx6pbfoxcnMVxWZ9X/sMgztQdwYEQlnvAxGvCY/1ZIm3/izqB2zAgG7ZfWzKjU2P5VseKokMjHXrzZX9Uqtn0zpITEaG5HjUpRSaJg="); + public final static SkinData HEADLESS_HORSEMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM4ODc2MjAzODksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZGM2M2M5NWFjOTA1YjEyMWU5YTE3NmY5ZDFiN2M0MDc2ZGJjMTk3NzhkYjgzMzBlOWIzNTdhOTQ3MzMxZCJ9fX0=", "pQgM6o3nO6+NaxEmkoK33gQefe726HeVA5TVcbnGRY99S8l1UVlTu1W9Unc4IczHRYZ29I75aXUz6UDA7kIRQj4NOQHBXOxlw4cah34WkDECXYwKbgcM3HkRI/JGQf6Uooe5Mz/IaWlisEdXp9i7+WPeqz1qvzwuJ2jUqF8gaJyCbgKSWE8135k+YwinFVA78+so5meRZ6qBNfSeU48Bhf9j3H+Jmq/vwi9EJGDXKAzjYSufdYWQA7gXJQHiUFVgVKSC0wBAMHBVK7ABE2g5GIaLxOfjhOKN8Gdea9dqOUN+uXrGvg7uHxJd9Obw7MbBDVPgXnYDWYDU18DAWJcGVA8tnuPnN2a+mQrbTn9UPftYReUYJA4zpkfEKkljW6lkQ5DkVN/ueQg9QDYjxvjLblSyKHV8lX/ATt4aGiQrCcaQn6c8EeLWijPwozO+pI3MX26ydF8l+B9lTvGvQOqfUS4+TgEI5SEKlKFF4i6rTBAYCHAH8uXry7fZQDoIkcpWiB5b+e7Tr29WoScyFNuR3BMIh0Nky1TPadLxxhkqht8o9AXtccYOmtoMMh06kKWZK5m8w16j+VTUNDYwTV+jxtSFBMh4FPuiH+TzpeHY6P2Cb4gT2UlozWj8ZxZHYIGbYXAFOlDT8IQmRh5zyrXeAZrwoXJPP2OoXl31roChTxw="); + public final static SkinData GHOST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5NjQxOTY3ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84NjViODU3N2NlNmFhYzY4N2IxNGQ0ZGIzYmQ1MGU1NjdlZGY4Njc4MDU3ZWM2NjMyZDcxMDQ4MzFhNDk3MmIifX19", "J3nw3OIZYuYxbhOKgPGL+Kn4kWv9cjEB9ygBD07xVJUY/rdPW/BeE15qKpZQt5d8kjj0VGp1Q7g3uIS24NuiQxDZ82l1GT4dLyUN2eOj0im6VGA2yXrnGPaedfu1oPAiG+STFq0ST2IYQKYuOcncsdovxHLrpNHF6ud3WJMnSOYSfAX5NOny1UNkswzCN2OCX+QzW9hwQ+gKOc2U6g47hIcpBcTNlmD3lqXjP7OTn0Ul3kJG5J3lnwBkPnNI5OV9+oI9OWs/fbTee3pK6UVHjgH2w+fO/0jlRnShw7o1BKv/ILBkWZYuq31YiAMWKRm508SS3+kjqU37t6mqBc9AUcAeKfR4G6UiW18+eRfDPaaSnY2mTBwD3boWHYI7fM7pnPF1LmSxwSa9QSu3wsrYF9ID0QI7vyyrPIeZU/eUXE+WbFZ+Nuo/2LlZMjUmcLWa/SuuPo6lA5zJtgkVc/Rgkph+s/sZnPwgeHTFmCr2VJqgWg+J9dnO/fLPkddgzjoy5uOCAO70E/cwbpqGxKD+0iQU0Vk9TzQnCMAUDtzeoyNkuk204cDSqPKtH5JIoQHa6wFAEgaKZoSETBJMZmKzZhne5pVr+NVkmGHOuZ/uE6JH1F4T+vTeeLSEroPDhrNfwVtrrqBFnI/xijfEHdPmtP9OTSDju7MHnEZu4RS7y6Q="); + public final static SkinData HAUNTED_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzUyNTUzOTE3OTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWM5MmU4ODNiOGFjODI0MDU5YTk5NGM5NTNjNTQ0NDQ0Yjk3ZWFkZDdhNWFjNGY3ZTZhOTUxOGQ5YTkxMSJ9fX0=", "GqycEQvWoZeXDLAJ6ricUx3coA4Y6AswL0GV1KebetoTkd9XNtkJJ9eUf6ViwpSgmL0H89sdMjghThHKczUEmjaFeNl2Z9cwGnR1WOK3KpD+v8C7f10l2DNd7z8s1clJfkVay/5KkgNMneu+ZStF8mCt+uyOSfZX4toLRBba6ZDaz4RlmcNt3e6h+dCaB/npbrWxddX7YZWsAMEKxmMKrG/Rm1Gx7ZOchmd4l6+pypA3Vrjoc0LVjqDV/TsePiNxV9LWFB7Rc6YGkIyz2+z5m168iLnn4+qMMXOYndwH7RGcTLEJDPRfNjawuPNcRlYZ6bf30S540MQdC0dJbRLu0uT9CAyi1vjxezdKjGJZSiY5WmtWrhkiRRtCMr9fGxBRNxPDdf5bs7IgWClFgafkGFZKZjLlOV8qtlMrPQSduPtGBCM64veJchSMFS6MfxgE2O/+4EZ246ZN1bdV6KiLRDIzFmy9PBn2o6MNtcdFc/G5XdD7aCTwuGD6sbG2T97Aiai56CN1vYsc6yXUfeZafSm6qviXAx3zTEd1aw1oAZLj3PAt0uZRHggsBEKvwPVKsgHsOVFj5vu0BfHFbdaSdhL3GFotk06Ilr5cLxOrTwqoVNp/hiIJ8pu7T0AEWy1pMYD1+RszsTjJ76l305cQ3UHvinjnbXllsFQIIVE899s="); public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY="); // Comments this out for now, so it doesn't load the player profile diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index adcc05264..e22672fa7 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -1,5 +1,7 @@ package mineplex.core.common.util; +import java.util.*; + import net.minecraft.server.v1_8_R3.AxisAlignedBB; import org.bukkit.Location; import org.bukkit.block.Block; @@ -10,15 +12,6 @@ import org.bukkit.entity.Player; import org.bukkit.util.EulerAngle; import org.bukkit.util.Vector; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.TreeSet; - public class UtilAlg { public static TreeSet sortKey(Set toSort) @@ -663,4 +656,27 @@ public class UtilAlg int z = r.nextInt(radius * 2) - radius; return center.clone().add(x, y, z); } + + /** + * Gets a random location, with specific radius + * @param center The center location + * @param radiusX The X radius + * @param radiusY The Y radius + * @param radiusZ The Z radius + * @return A random location in that range + */ + public static Location getRandomLocation(Location center, double radiusX, double radiusY, double radiusZ) + { + double minX = radiusX * -1, minY = radiusY * -1, minZ = radiusZ * -1; + double x = minX + (UtilMath.random.nextDouble() * 2 * radiusX); + double y = minY + (UtilMath.random.nextDouble() * 2 * radiusY); + double z = minZ + (UtilMath.random.nextDouble() * 2 * radiusZ); + Location newLocation = center.clone().add((radiusX == 0) ? 0 : x, (radiusY == 0) ? 0 : y, (radiusZ == 0) ? 0 : z); + return newLocation; + } + + public static Location getRandomLocation(Location center, double radius) + { + return getRandomLocation(center, radius, radius, radius); + } } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java index 98ebb1805..16589f2b3 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java @@ -1,11 +1,11 @@ package mineplex.core.common.util; -import mineplex.core.common.jsonchat.JsonMessage; -import mineplex.core.common.jsonchat.JsonMessage.MessageType; - import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.jsonchat.JsonMessage.MessageType; + public class UtilTextBottom { public static void display(String text, Player... players) @@ -52,5 +52,29 @@ public class UtilTextBottom } display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); - } + } + + /** + * Displays a bottom text progress bar with a specific number of bars + * @param prefix The prefix of the progress bar + * @param suffix The suffix of the progress bar + * @param bars The number of bars to display + * @param filledBars The number of filled bars + * @param players The players who will receive the progress bar + */ + public static void displayProgress(String prefix, String suffix, int bars, int filledBars, Player... players) + { + String progressBar = C.cGreen + ""; + for (int i = 0; i < bars; i++) + { + if (i > filledBars - 1) + { + progressBar += C.cRed; + } + progressBar += "▌"; + } + + display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); + } + } diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java index 09ef34668..03cb5e95e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ColoredParticle.java @@ -1,6 +1,5 @@ package mineplex.core.common.util.particles; - import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilServer; import org.bukkit.Location; @@ -36,6 +35,16 @@ public class ColoredParticle extends ParticleData UtilParticle.PlayParticle(_particleType, _location, x, _color.getY(), _color.getZ(), 1, 0, viewDist, players); } + @Override + public void display(int count, UtilParticle.ViewDist viewDist, Player... players) + { + // It's not possible to have colored particles with count, so just repeat it + for (int i = 0; i < count; i++) + { + display(viewDist, players); + } + } + @Override public void display(UtilParticle.ViewDist viewDist) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java index be36f059d..f3cb0466b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/DustSpellColor.java @@ -1,6 +1,6 @@ package mineplex.core.common.util.particles; -import java.awt.*; +import org.bukkit.Color; public class DustSpellColor extends ParticleColor { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java index 94cf5d5d2..511c23528 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/NoteColor.java @@ -1,6 +1,6 @@ package mineplex.core.common.util.particles; -import java.awt.*; +import org.bukkit.Color; public class NoteColor extends ParticleColor { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java index 56fff7eca..0bc1da18b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleColor.java @@ -1,7 +1,5 @@ package mineplex.core.common.util.particles; -import java.awt.*; - public abstract class ParticleColor { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java index c6e020ddf..b0eaa5b80 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/particles/ParticleData.java @@ -17,6 +17,15 @@ public class ParticleData _location = location; } + /** + * Displays the particles for all the players with a different ammount + * @param count the ammount of particles + */ + public void display(int count) + { + display(count, UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers()); + } + /** * Displays the particles for selected players * @param viewDist The distance of the particle view @@ -24,7 +33,18 @@ public class ParticleData */ public void display(UtilParticle.ViewDist viewDist, Player... players) { - UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist); + UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist, players); + } + + /** + * Displays the particles for the selected players, with a custom amount + * @param count the amount of particles + * @param viewDist the distance of the particle view + * @param players the players that will receive the particle + */ + public void display(int count, UtilParticle.ViewDist viewDist, Player... players) + { + UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, count, viewDist, players); } /** diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java index f3b20f8f8..08ae3db23 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/commands/AnimationCommand.java @@ -22,7 +22,7 @@ public class AnimationCommand extends CommandBase{ public void Execute(Player caller, String[] args) { caller = Bukkit.getPlayer(args[0]); - _plugin.addPendingExplosion(caller, _plugin.getRewardManager().nextReward(caller, null, false, RewardType.SpinnerFiller, true)); + _plugin.addPendingExplosion(caller, _plugin.getRewardManager().nextReward(caller, null, false, RewardType.SPINNER_FILLER, true)); if (args.length >= 2) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java index b1d9bdbb2..d450c357a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/SpinGui.java @@ -102,16 +102,16 @@ public class SpinGui extends SimpleGui { if (i != _stopSpinnerAt + 4) { - _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SpinnerFiller, true); + _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SPINNER_FILLER, true); } else { - _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SpinnerReal, true); + _rewards[i] = rewardManager.nextReward(player, Type.CARL_SPINNER, null, false, RewardType.SPINNER_REAL, true); _reward = _rewards[i]; } } - _reward.giveReward(RewardType.SpinnerReal, getPlayer(), new Callback() + _reward.giveReward(RewardType.SPINNER_REAL, getPlayer(), new Callback() { @Override public void run(RewardData data) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java index 8da12b5d9..be0c8a6bb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/CosmeticManager.java @@ -1,18 +1,8 @@ package mineplex.core.cosmetic; -import mineplex.core.boosters.BoosterManager; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; +import mineplex.core.boosters.BoosterManager; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; @@ -28,6 +18,15 @@ import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.mount.MountManager; import mineplex.core.pet.PetManager; import mineplex.core.treasure.TreasureManager; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; public class CosmeticManager extends MiniPlugin { @@ -37,7 +36,7 @@ public class CosmeticManager extends MiniPlugin private PetManager _petManager; private TreasureManager _treasureManager; private BoosterManager _boosterManager; - + private CosmeticShop _shop; private boolean _showInterface = true; @@ -56,6 +55,12 @@ public class CosmeticManager extends MiniPlugin _shop = new CosmeticShop(this, clientManager, donationManager, _moduleName); } + + /*@Override + public void addCommands() + { + addCommand(new CosmeticsSlackCommand(this)); + }*/ public void showInterface(boolean showInterface) { @@ -213,4 +218,5 @@ public class CosmeticManager extends MiniPlugin } } } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java new file mode 100644 index 000000000..3bbc3380e --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/event/SlackCosmeticEvent.java @@ -0,0 +1,45 @@ +package mineplex.core.cosmetic.event; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class SlackCosmeticEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + private String _message; + private String _player; + + public SlackCosmeticEvent(String message) + { + _message = message; + _player = null; + } + + public SlackCosmeticEvent(String message, String player) + { + _message = message; + _player = player; + } + + public String getMessage() + { + return _message; + } + + public String getPlayer() + { + return _player; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index 293e6b84d..d39c1e64b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -146,6 +146,11 @@ public class GadgetPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Freedom Chests"); } + else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -9) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Haunted Chests"); + } //Rank Unlocks else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java index 020297748..9f39b1322 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MountPage.java @@ -1,5 +1,9 @@ package mineplex.core.cosmetic.ui.page; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; @@ -17,10 +21,6 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class MountPage extends ShopPageBase { public MountPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) @@ -96,6 +96,11 @@ public class MountPage extends ShopPageBase itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Freedom Chests"); } + else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -9) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Chests"); + } //Rank Unlocks else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java index 77b4c15ee..57cc96538 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/PetPage.java @@ -1,9 +1,15 @@ package mineplex.core.cosmetic.ui.page; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.PetSorter; @@ -25,10 +31,6 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - public class PetPage extends ShopPageBase { public PetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) @@ -51,8 +53,14 @@ public class PetPage extends ShopPageBase List itemLore = new ArrayList(); itemLore.add(C.cBlack); - itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); - + if (pet.getLore() != null) + { + Collections.addAll(itemLore, UtilText.splitLineToArray(C.cGray + pet.getLore(), LineFormat.LORE)); + } + else + { + itemLore.add(C.cGray + "Your very own " + pet.getName() + "!"); + } //Chest Unlocks if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType())) { @@ -74,13 +82,24 @@ public class PetPage extends ShopPageBase else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -4) { itemLore.add(C.cBlack); - itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); + itemLore.add(C.cBlue + "Earned by defeating the Pumpkin King"); + itemLore.add(C.cBlue + "in the 2014 Christmas Chaos Event."); } else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -5) { itemLore.add(C.cBlack); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); } + else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -8) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Pumpkin's Revenge"); + } + else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -9) + { + itemLore.add(C.cBlack); + itemLore.add(C.cBlue + "Found in Halloween Chests"); + } //Rank Unlocks else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -10) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java index c5f45f804..df1d4118e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseZombie.java @@ -20,22 +20,22 @@ public class DisguiseZombie extends DisguiseMonster DataWatcher.a(14, Byte.valueOf((byte) 0), EntityZombie.META_CONVERTING, false); } - public boolean IsBaby() + public boolean isBaby() { return DataWatcher.getByte(12) == 1; } - public void SetBaby(boolean baby) + public void setBaby(boolean baby) { DataWatcher.watch(12, Byte.valueOf((byte) (baby ? 1 : 0)), EntityZombie.META_CHILD, baby); } - public boolean IsVillager() + public boolean isVillager() { return DataWatcher.getByte(13) == 1; } - public void SetVillager(boolean villager) + public void setVillager(boolean villager) { DataWatcher.watch(13, Byte.valueOf((byte) (villager ? 1 : 0)), EntityZombie.META_VILLAGER, villager); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java index 1f5e1a4de..9a8e6359c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/TopEloCommand.java @@ -1,5 +1,7 @@ package mineplex.core.elo; +import java.util.List; + import com.google.common.collect.Lists; import mineplex.core.command.CommandBase; import mineplex.core.common.Rank; @@ -11,15 +13,13 @@ import mineplex.core.slack.SlackMessage; import mineplex.core.slack.SlackTeam; import org.bukkit.entity.Player; -import java.util.List; - /** * Generates a list of top elos */ public class TopEloCommand extends CommandBase { - private static final List NAMES = Lists.newArrayList("Relyh", "TadahTech"); + private static final List NAMES = Lists.newArrayList("Relyh", "TadahTech", "LCastr0"); public TopEloCommand(EloManager plugin) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java new file mode 100644 index 000000000..0ae983248 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/events/AddConditionEvent.java @@ -0,0 +1,232 @@ +package mineplex.core.events; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class AddConditionEvent extends Event +{ + + public enum CoreConditionType + { + CLOAK, + SHOCK, + POISON_SHOCK, + SILENCE, + BURNING, + FALLING, + LIGHTNING, + INVULNERABLE, + EXPLOSION, + FIRE_ITEM_IMMUNITY, + ARCADE_HUNGER_DISABLE, + + CUSTOM, + + ABSORBTION, + BLINDNESS, + CONFUSION, + DAMAGE_RESISTANCE, + FAST_DIGGING, + FIRE_RESISTANCE, + HARM, + HEAL, + HEALTH_BOOST, + HUNGER, + INCREASE_DAMAGE, + INVISIBILITY, + JUMP, + NIGHT_VISION, + POISON, + REGENERATION, + SLOW, + SLOW_DIGGING, + SPEED, + WATER_BREATHING, + WEAKNESS, + WITHER + } + + /** + * Allows adding Condition outside Arcade module + */ + + private static final HandlerList handlers = new HandlerList(); + + protected long _time; + + protected String _reason; + + protected String _informOn; + protected String _informOff; + + protected LivingEntity _ent; + protected LivingEntity _source; + + protected CoreConditionType _type; + protected int _mult; + protected int _ticks; + protected int _ticksTotal; + protected boolean _ambient; + + protected Material _indicatorType; + protected byte _indicatorData; + + protected boolean _add = false; + protected boolean _live = false; + + protected boolean _cancelPotion = false; + + protected boolean _showIndicator = true; + + public AddConditionEvent(String reason, LivingEntity ent, LivingEntity source, + CoreConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, boolean showIndicator, boolean ambient) + { + _time = System.currentTimeMillis(); + + _reason = reason; + + _ent = ent; + _source = source; + + _type = type; + _mult = mult; + _ticks = ticks; + _ticksTotal = ticks; + _ambient = ambient; + + _indicatorType = visualType; + _indicatorData = visualData; + _showIndicator = showIndicator; + + _add = add; + + //Live if NOT Additive + _live = !add; + } + + public AddConditionEvent(String reason, LivingEntity ent, LivingEntity source, + CoreConditionType type, int mult, int ticks, boolean add, Material visualType, byte visualData, boolean showIndicator, boolean ambient, boolean cancelPotion) + { + _time = System.currentTimeMillis(); + + _reason = reason; + + _ent = ent; + _source = source; + + _type = type; + _mult = mult; + _ticks = ticks; + _ticksTotal = ticks; + _ambient = ambient; + + _indicatorType = visualType; + _indicatorData = visualData; + _showIndicator = showIndicator; + + _cancelPotion = cancelPotion; + + _add = add; + + //Live if NOT Additive + _live = !add; + } + + public long getTime() + { + return _time; + } + + public String getReason() + { + return _reason; + } + + public String getInformOn() + { + return _informOn; + } + + public String getInformOff() + { + return _informOff; + } + + public LivingEntity getEnt() + { + return _ent; + } + + public LivingEntity getSource() + { + return _source; + } + + public CoreConditionType getType() + { + return _type; + } + + public int getMult() + { + return _mult; + } + + public int getTicks() + { + return _ticks; + } + + public int getTicksTotal() + { + return _ticksTotal; + } + + public boolean isAmbient() + { + return _ambient; + } + + public Material getIndicatorType() + { + return _indicatorType; + } + + public byte getIndicatorData() + { + return _indicatorData; + } + + public boolean isAdd() + { + return _add; + } + + public boolean isLive() + { + return _live; + } + + public boolean isCancelPotion() + { + return _cancelPotion; + } + + public boolean isShowIndicator() + { + return _showIndicator; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java new file mode 100644 index 000000000..aed1bc944 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/events/EnableArcadeSpawnEvent.java @@ -0,0 +1,37 @@ +package mineplex.core.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + +public class EnableArcadeSpawnEvent extends Event +{ + + /** + * Allows spawning mobs inside arcade games without having to do it inside Arcade's code + */ + + private static final HandlerList handlers = new HandlerList(); + + private boolean _enable; + + public EnableArcadeSpawnEvent(boolean enable) + { + _enable = enable; + } + + public boolean canEnable() + { + return _enable; + } + + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index f2ffcee5d..a3695d0c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -1,11 +1,13 @@ package mineplex.core.gadget; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; import java.util.function.Predicate; -import mineplex.core.gadget.event.PlayerToggleSwimEvent; -import mineplex.core.gadget.gadgets.morph.swim.SwimManager; -import mineplex.core.treasure.TreasureManager; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -25,15 +27,23 @@ import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.util.*; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.commands.AmmoCommand; import mineplex.core.gadget.commands.LockCosmeticsCommand; import mineplex.core.gadget.commands.UnlockCosmeticsCommand; +import mineplex.core.gadget.commands.WinRoomTestCommand; import mineplex.core.gadget.event.GadgetChangeEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetEnableEvent; +import mineplex.core.gadget.event.PlayerToggleSwimEvent; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -58,6 +68,7 @@ import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.titan.DeathTitan; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; @@ -78,7 +89,6 @@ import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStr import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.hat.HatItem; import mineplex.core.gadget.gadgets.hat.HatType; -import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.item.ItemBatGun; import mineplex.core.gadget.gadgets.item.ItemBow; import mineplex.core.gadget.gadgets.item.ItemCoal; @@ -104,14 +114,18 @@ import mineplex.core.gadget.gadgets.morph.MorphChicken; import mineplex.core.gadget.gadgets.morph.MorphCow; import mineplex.core.gadget.gadgets.morph.MorphCreeper; import mineplex.core.gadget.gadgets.morph.MorphEnderman; +import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; import mineplex.core.gadget.gadgets.morph.MorphPig; import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; import mineplex.core.gadget.gadgets.morph.MorphSlime; import mineplex.core.gadget.gadgets.morph.MorphSnowman; +import mineplex.core.gadget.gadgets.morph.MorphSquid; import mineplex.core.gadget.gadgets.morph.MorphTitan; import mineplex.core.gadget.gadgets.morph.MorphUncleSam; import mineplex.core.gadget.gadgets.morph.MorphVillager; import mineplex.core.gadget.gadgets.morph.MorphWither; +import mineplex.core.gadget.gadgets.morph.managers.SoulManager; +import mineplex.core.gadget.gadgets.morph.managers.SwimManager; import mineplex.core.gadget.gadgets.outfit.OutfitTeam; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; @@ -143,17 +157,16 @@ import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.titan.ParticleTitan; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; -import mineplex.core.gadget.persistence.UserGadgetPersistence; -import mineplex.core.gadget.set.suits.SetRaveSuit; -import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; +import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium; import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; +import mineplex.core.gadget.persistence.UserGadgetPersistence; import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetCupidsLove; import mineplex.core.gadget.set.SetEmerald; @@ -166,6 +179,8 @@ import mineplex.core.gadget.set.SetShadow; import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetVampire; import mineplex.core.gadget.set.SetWisdom; +import mineplex.core.gadget.set.suits.SetRaveSuit; +import mineplex.core.gadget.set.suits.SetSpaceSuit; import mineplex.core.gadget.types.ArrowEffectGadget; import mineplex.core.gadget.types.DeathEffectGadget; import mineplex.core.gadget.types.DoubleJumpEffectGadget; @@ -190,6 +205,7 @@ import mineplex.core.packethandler.PacketHandler; import mineplex.core.pet.PetManager; import mineplex.core.preferences.PreferencesManager; import mineplex.core.projectile.ProjectileManager; +import mineplex.core.treasure.TreasureManager; public class GadgetManager extends MiniPlugin { @@ -208,6 +224,7 @@ public class GadgetManager extends MiniPlugin private final OutfitWindUpSuitBoosterManager _boosterManager; private final IncognitoManager _incognitoManager; private TreasureManager _treasureManager; + private SoulManager _soulManager; private NautHashMap> _gadgets; @@ -246,7 +263,8 @@ public class GadgetManager extends MiniPlugin _userGadgetPersistence = new UserGadgetPersistence(this); _boosterManager = new OutfitWindUpSuitBoosterManager(this); _incognitoManager = incognitoManager; - + _soulManager = new SoulManager(); + createGadgets(); createSets(); } @@ -257,6 +275,7 @@ public class GadgetManager extends MiniPlugin addCommand(new UnlockCosmeticsCommand(this)); addCommand(new LockCosmeticsCommand(this)); addCommand(new AmmoCommand(this)); + addCommand(new WinRoomTestCommand(this)); } private void createSets() @@ -343,8 +362,9 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSnowman(this)); addGadget(new MorphUncleSam(this)); addGadget(new MorphSquid(this)); - addGadget(new MorphWitch(this)); - //addGadget(new MorphMetalMan(this)); // Soon: reward for signup + addGadget(new MorphGrimReaper(this)); + // Not being added in this update! + //addGadget(new MorphMetalMan(this)); // Particles addGadget(new ParticleFoot(this)); @@ -383,7 +403,8 @@ public class GadgetManager extends MiniPlugin addGadget(new ArrowTrailBlood(this)); addGadget(new ArrowTrailMusic(this)); addGadget(new ArrowTrailFreedom(this)); - + addGadget(new ArrowTrailHalloween(this)); + // Death Effect addGadget(new DeathFrostLord(this)); addGadget(new DeathTitan(this)); @@ -397,7 +418,7 @@ public class GadgetManager extends MiniPlugin addGadget(new DeathBlood(this)); addGadget(new DeathMusic(this)); addGadget(new DeathFreedom(this)); - + // Double Jump addGadget(new DoubleJumpFrostLord(this)); addGadget(new DoubleJumpTitan(this)); @@ -411,7 +432,8 @@ public class GadgetManager extends MiniPlugin addGadget(new DoubleJumpBlood(this)); addGadget(new DoubleJumpMusic(this)); addGadget(new DoubleJumpFreedom(this)); - + addGadget(new DoubleJumpHalloween(this)); + // Hat for (HatType hatType : HatType.values()) { @@ -429,7 +451,8 @@ public class GadgetManager extends MiniPlugin addGadget(new WinEffectLightningStrike(this)); addGadget(new WinEffectRiseOfTheElderGuardian(this)); addGadget(new WinEffectLavaTrap(this)); - + addGadget(new WinEffectHalloween(this)); + // Music addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, -2, 2257, 185000)); @@ -856,6 +879,7 @@ public class GadgetManager extends MiniPlugin _playerActiveGadgetMap.remove(event.getPlayer()); event.getPlayer().setWalkSpeed(0.2f); event.getPlayer().setFlySpeed(0.1f); + _soulManager.giveSoul(event.getPlayer()); } @EventHandler @@ -1164,4 +1188,9 @@ public class GadgetManager extends MiniPlugin { return _treasureManager; } + + public SoulManager getSoulManager() + { + return _soulManager; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java new file mode 100644 index 000000000..a6a029bc5 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/WinRoomTestCommand.java @@ -0,0 +1,72 @@ +package mineplex.core.gadget.commands; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.wineffect.*; +import mineplex.core.gadget.types.WinEffectGadget; +import org.bukkit.entity.Player; + +public class WinRoomTestCommand extends CommandBase +{ + + private GadgetManager _manager; + + public WinRoomTestCommand(GadgetManager manager) + { + super(manager, Rank.JNR_DEV, "winroomtest"); + _manager = manager; + } + + @Override + public void Execute(Player player, String[] args) + { + if (args.length < 1 || args.length > 2) + { + UtilPlayer.message(player, F.main("Win Rooms", "Usage: /winroomtest [play]")); + return; + } + boolean play = false; + if (args.length == 2) + { + if (args[1].equalsIgnoreCase("true")) + { + play = true; + } + } + loadWinRoom(args[0], player, play); + } + + private void loadWinRoom(String roomName, Player player, boolean play) + { + List names = Arrays.asList("BabyChicken", "DragonRider", "Fireworks", "Flames", "Halloween", "LavaTrap", + "LightningStrike", "MrPunchMan", "Podium", "RiseOfTheElderGuardian", "SnowTrails"); + List winClasses = Arrays.asList(WinEffectBabyChicken.class, WinEffectDragonRider.class, + WinEffectFireworks.class, WinEffectFlames.class, WinEffectHalloween.class, WinEffectLavaTrap.class, + WinEffectLightningStrike.class, WinEffectMrPunchMan.class, WinEffectPodium.class, + WinEffectRiseOfTheElderGuardian.class, WinEffectSnowTrails.class); + if (names.contains(roomName)) + { + int index = names.indexOf(roomName); + WinEffectGadget gadget = (WinEffectGadget) _manager.getGadget(winClasses.get(index)); + gadget.setup(player, new ArrayList<>(), new ArrayList<>(), player.getLocation().clone().add(100, 0, 100)); + gadget.buildWinnerRoom(); + gadget.teleport(); + if (play) + { + gadget.runPlay(); + } + } + else + { + UtilPlayer.message(player, F.main("Win Rooms", "Wrong room name!")); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java new file mode 100644 index 000000000..f9d03dd03 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java @@ -0,0 +1,56 @@ +package mineplex.core.gadget.gadgets.arrowtrail; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Material; +import org.bukkit.entity.Arrow; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.ArrowEffectGadget; + +public class ArrowTrailHalloween extends ArrowEffectGadget +{ + + private static Map _arrowColors = new HashMap<>(); + + public ArrowTrailHalloween(GadgetManager manager) + { + super(manager, "Halloween Arrows", UtilText.splitLineToArray(C.cGray + "Don't listen to the critics; orange and black is in all year.", LineFormat.LORE), + -9, Material.PUMPKIN, (byte) 0); + } + + @Override + public void doTrail(Arrow arrow) + { + if (_arrowColors.containsKey(arrow)) + { + Color nextColor = _arrowColors.get(arrow); + nextColor = (nextColor == Color.ORANGE) ? Color.BLACK : Color.ORANGE; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(nextColor), arrow.getLocation()); + coloredParticle.display(15); + _arrowColors.put(arrow, nextColor); + } + else + { + Color nextColor = Color.ORANGE; + _arrowColors.put(arrow, nextColor); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(nextColor), arrow.getLocation()); + coloredParticle.display(2); + } + } + + @Override + public void doHitEffect(Arrow arrow) + { + + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java index dc7e1ccb2..8e6d2bd51 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/freedom/ArrowTrailFreedom.java @@ -1,8 +1,5 @@ package mineplex.core.gadget.gadgets.arrowtrail.freedom; -import java.awt.*; - -import mineplex.core.common.util.C; import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilText; @@ -10,9 +7,9 @@ import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; -import mineplex.core.gadget.gadgets.particle.unrelated.FreedomFireworkEffect; import mineplex.core.gadget.types.ArrowEffectGadget; import org.bukkit.ChatColor; +import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.Arrow; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java new file mode 100644 index 000000000..8381c5a93 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/DoubleJumpHalloween.java @@ -0,0 +1,78 @@ +package mineplex.core.gadget.gadgets.doublejump; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.types.DoubleJumpEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class DoubleJumpHalloween extends DoubleJumpEffectGadget +{ + + private static final int PARTICLE_AMOUNT = 50; + + private HashMap _playerMap = new HashMap<>(); + + public DoubleJumpHalloween(GadgetManager manager) + { + super(manager, "Trick-Or-Leap", UtilText.splitLineToArray(C.cGray + "Unfortunately we're all out of candy, so have this instead!", LineFormat.LORE), -9, + Material.PUMPKIN, (byte) 0); + } + + @Override + public void doEffect(Player player) + { + _playerMap.put(player, System.currentTimeMillis() + 1000); + for(int amount = 0; amount < PARTICLE_AMOUNT; amount++) + { + Vector r = Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(2).setY(Math.random() * 0.4); + Location loc = player.getLocation().add(r).add(0, UtilMath.random(.5, 2.3), 0); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.ORANGE), loc); + coloredParticle.display(7); + + r = Vector.getRandom().subtract(Vector.getRandom()).normalize().multiply(2).setY(Math.random() * 0.4); + loc = player.getLocation().add(r).add(0, 0.3, 0); + coloredParticle.setLocation(loc); + coloredParticle.setColor(new DustSpellColor(Color.BLACK)); + coloredParticle.display(5); + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.ORANGE), player.getLocation().clone().add(0, .4, 0)); + coloredParticle.display(7); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if(event.getType() != UpdateType.FASTEST) return; + + for(Iterator> it = _playerMap.entrySet().iterator(); it.hasNext();) + { + Map.Entry e = it.next(); + if(e.getValue() >= System.currentTimeMillis()) + { + it.remove(); + continue; + } + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.ORANGE), e.getKey().getLocation()); + coloredParticle.display(5); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java index f5bda1408..71a7b66b5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/doublejump/cupidslove/DoubleJumpCupidsWings.java @@ -4,13 +4,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.util.Vector; - import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.UtilColor; import mineplex.core.common.util.UtilParticle; @@ -21,6 +14,12 @@ import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.DoubleJumpEffectGadget; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; public class DoubleJumpCupidsWings extends DoubleJumpEffectGadget { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java index 7a8fa997b..c6f623e20 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/hat/HatType.java @@ -11,17 +11,18 @@ import org.bukkit.inventory.ItemStack; public enum HatType { - Coal("Lump of Coal Hat", UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, Material.COAL_BLOCK), - Companion_Block("Companion Block", UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), -2, SkinData.COMPANION_CUBE, "Companion"), - Grinch("The Grinch", UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH, "The Grinch Hat"), - Lovestruck("Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), -6, SkinData.LOVESTRUCK, "Love Struck Hat", "Lovestruck"), - Present("Present", UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT), - Rudolph("Rudolph", UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH), - Santa("Santa", UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), -3, SkinData.SANTA), - Secret_Package("Secret Package", UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), -6, SkinData.SECRET_PACKAGE), - Snowman("Snowman Head", UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), -2, SkinData.SNOWMAN), - Teddy_Bear("Teddy Bear", UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), -6, SkinData.TEDDY_BEAR), - Uncle_Sam("Uncle Sam Hat", UtilText.splitLineToArray(UtilText.colorWords("Uncle Sam has a big hat but now you can too.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, SkinData.UNCLE_SAM); + COAL("Lump of Coal Hat", UtilText.splitLineToArray(C.cGray + "When life gives you coal, make a weird cube hat out it!", LineFormat.LORE), -1, Material.COAL_BLOCK), + COMPANION_BLOCK("Companion Block", UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE), -2, SkinData.COMPANION_CUBE, "Companion"), + GRINCH("The Grinch", UtilText.splitLineToArray(C.cGray + "Great! Now where's the Roast Beast?!", LineFormat.LORE), -3, SkinData.THE_GRINCH, "The Grinch Hat"), + LOVESTRUCK("Love Struck", UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE), -6, SkinData.LOVESTRUCK, "Love Struck Hat", "Lovestruck"), + PRESENT("Present", UtilText.splitLineToArray(C.cGray + "WHAT'S IN THE PRESENT? Oh, it's just you...", LineFormat.LORE), -3, SkinData.PRESENT), + RUDOLPH("Rudolph", UtilText.splitLineToArray(C.cGray + "HEY YOU! Wanna lead Santa's sleigh team?", LineFormat.LORE), -3, SkinData.RUDOLPH), + SANTA("Santa", UtilText.splitLineToArray(C.cGray + "Now you can work the Mall circuit!", LineFormat.LORE), -3, SkinData.SANTA), + SECRET_PACKAGE("Secret Package", UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE), -6, SkinData.SECRET_PACKAGE), + SNOWMAN("Snowman Head", UtilText.splitLineToArray(C.cGray + "Do you want to be a snowman?", LineFormat.LORE), -2, SkinData.SNOWMAN), + TEDDY_BEAR("Teddy Bear", UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE), -6, SkinData.TEDDY_BEAR), + UNCLE_SAM("Uncle Sam Hat", UtilText.splitLineToArray(UtilText.colorWords("Uncle Sam has a big hat but now you can too.", ChatColor.RED, ChatColor.WHITE, ChatColor.BLUE), LineFormat.LORE), -8, SkinData.UNCLE_SAM), + PUMPKIN("Pumpkin Hat", UtilText.splitLineToArray(C.cGray + "Pumpkin on the head, don't end up dead!", LineFormat.LORE), -9, Material.PUMPKIN); private final String _name; private final String[] _lore; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java index f031776d3..ebe2d8083 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/item/ItemCoal.java @@ -80,7 +80,7 @@ public class ItemCoal extends ItemGadget int goal = -1; //Coal Hat - if (!Manager.getHatGadget(HatType.Coal).ownsGadget(player)) + if (!Manager.getHatGadget(HatType.COAL).ownsGadget(player)) { goal = _hat; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java index 294e5f68c..94a9d55de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/BlockForm.java @@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseCat; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.gadget.event.GadgetBlockEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; import net.minecraft.server.v1_8_R3.Entity; @@ -65,7 +66,8 @@ public class BlockForm disguise.setBaby(); disguise.setSoundDisguise(new DisguiseCat(_player)); disguise.setInvisible(true); - _host.Manager.getDisguiseManager().disguise(disguise); + //_host.Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(_player, disguise, _host.Manager.getDisguiseManager()); // Apply Falling Block FallingBlockCheck(); @@ -91,7 +93,8 @@ public class BlockForm { SolidifyRemove(); - _host.Manager.getDisguiseManager().undisguise(_player); + //_host.Manager.getDisguiseManager().undisguise(_player); + UtilMorph.undisguise(_player, _host.Manager.getDisguiseManager()); // Remove FB if (_player.getPassenger() != null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java index d7a971b6a..ae9608fe1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBat.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; @@ -59,16 +60,18 @@ public class MorphBat extends MorphGadget implements IThrown this.applyArmor(player, message); DisguiseBat disguise = new DisguiseBat(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); player.setFlying(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java index 292731c04..a0c3dad2a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBlaze.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -42,16 +43,18 @@ public class MorphBlaze extends MorphGadget this.applyArmor(player, message); DisguiseBlaze disguise = new DisguiseBlaze(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java index a79b99e70..08252f554 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphBunny.java @@ -1,5 +1,9 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; @@ -7,6 +11,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.disguise.disguises.DisguiseRabbit; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; @@ -25,10 +30,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; - public class MorphBunny extends MorphGadget { private HashSet _jumpCharge = new HashSet(); @@ -55,10 +56,11 @@ public class MorphBunny extends MorphGadget this.applyArmor(player, message); DisguiseRabbit disguise = new DisguiseRabbit(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); - + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1)); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999999, 1)); } @@ -68,8 +70,9 @@ public class MorphBunny extends MorphGadget { _jumpCharge.remove(player); this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.removePotionEffect(PotionEffectType.SPEED); player.removePotionEffect(PotionEffectType.JUMP); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java index a47ac5929..1b033eabb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphChicken.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; @@ -48,17 +49,19 @@ public class MorphChicken extends MorphGadget this.applyArmor(player, message); DisguiseChicken disguise = new DisguiseChicken(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.setAllowFlight(false); player.setFlying(false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java index ab8854690..c8597bc3e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCow.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -36,16 +37,18 @@ public class MorphCow extends MorphGadget this.applyArmor(player, message); DisguiseCow disguise = new DisguiseCow(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java index acc2f9b55..af1aa5cb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphCreeper.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashMap; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.EntityEffect; import org.bukkit.Material; import org.bukkit.Sound; @@ -30,7 +31,7 @@ import mineplex.core.gadget.types.MorphGadget; public class MorphCreeper extends MorphGadget { - private HashMap _active = new HashMap(); + private HashMap _active = new HashMap<>(); public MorphCreeper(GadgetManager manager) { @@ -50,16 +51,18 @@ public class MorphCreeper extends MorphGadget this.applyArmor(player, message); DisguiseCreeper disguise = new DisguiseCreeper(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java index 97b71e2f6..616364633 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphEnderman.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.FireworkEffect; @@ -47,17 +48,19 @@ public class MorphEnderman extends MorphGadget this.applyArmor(player, message); DisguiseEnderman disguise = new DisguiseEnderman(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.setAllowFlight(false); player.setFlying(false); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java new file mode 100644 index 000000000..6586967cd --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphGrimReaper.java @@ -0,0 +1,228 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.LeatherArmorMeta; +import org.bukkit.util.Vector; + +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.C; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.SoulManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + +public class MorphGrimReaper extends MorphGadget +{ + + private Map _flying = new HashMap<>(); + private List _flyReady = new ArrayList<>(); + + private SoulManager _soulManager; + private ItemStack _hoe; + + private static final int FLY_DELAY = 15000; + + private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + + public MorphGrimReaper(GadgetManager manager) + { + super(manager, "Grim Reaper Morph", UtilText.splitLinesToArray(new String[]{ + C.cGray + "The Grim Reaper is the collector of souls.", + "", + C.cWhite + "Right Click a player with Grim Reaper Scythe to steal their soul" + }, LineFormat.LORE), -9, + Material.WOOD_HOE, (byte) 0); + _soulManager = manager.getSoulManager(); + createHoe(); + } + + private void createHoe() + { + ItemStack hoe = new ItemStack(Material.WOOD_HOE); + ItemMeta meta = hoe.getItemMeta(); + meta.setDisplayName(C.cGreen + "Grim Reaper Scythe"); + meta.setLore(UtilText.splitLines(new String[]{C.cWhite + "Right Click a player to steal their soul!", + C.cWhite + "Cooldown of 10 seconds."}, LineFormat.LORE)); + hoe.setItemMeta(meta); + _hoe = hoe; + } + + @Override + public void enableCustom(Player player, boolean message) + { + this.applyArmor(player, message); + + ItemStack blackChest = new ItemStack(Material.LEATHER_CHESTPLATE), + blackPants = new ItemStack(Material.LEATHER_LEGGINGS), blackBoots = new ItemStack(Material.LEATHER_BOOTS); + LeatherArmorMeta chestMeta = (LeatherArmorMeta) blackChest.getItemMeta(), + pantsMeta = (LeatherArmorMeta) blackPants.getItemMeta(), bootsMeta = (LeatherArmorMeta) blackBoots.getItemMeta(); + chestMeta.setColor(Color.BLACK); + pantsMeta.setColor(Color.BLACK); + bootsMeta.setColor(Color.BLACK); + blackChest.setItemMeta(chestMeta); + blackPants.setItemMeta(pantsMeta); + blackBoots.setItemMeta(bootsMeta); + + player.getInventory().setItem(2, _hoe); + DisguiseSkeleton skeleton = new DisguiseSkeleton(player); + skeleton.SetSkeletonType(Skeleton.SkeletonType.WITHER); + skeleton.setChestplate(blackChest); + skeleton.setLeggings(blackPants); + skeleton.setBoots(blackBoots); + UtilMorph.disguise(player, skeleton, Manager.getDisguiseManager()); + } + + @Override + public void disableCustom(Player player, boolean message) + { + this.removeArmor(player); + _flying.remove(player); + _flyReady.remove(player); + _soulManager.resetSouls(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.getInventory().setItem(2, new ItemStack(Material.AIR)); + } + + @EventHandler + public void stealSoul(PlayerInteractEntityEvent event) + { + if (event.getRightClicked().getType() != EntityType.PLAYER) + return; + + if (_flyReady.contains(event.getPlayer())) + return; + + Player player = event.getPlayer(); + + if (!player.getItemInHand().equals(_hoe)) + return; + + Player clicked = (Player) event.getRightClicked(); + boolean stolen = _soulManager.stealSoul(player, clicked); + if (stolen) + { + player.playSound(player.getLocation(), Sound.WITHER_DEATH, 1f, 1f); + UtilTextBottom.displayProgress("Grim Reaper Fly", _soulManager.checkSouls(player) + "/20 souls", 20, _soulManager.checkSouls(player), player); + if (_soulManager.checkSouls(player) == 20) + { + _flyReady.add(player); + UtilTextBottom.displayProgress("Grim Reaper Fly", 100, "Sneak to fly!", player); + } + } + } + + @EventHandler + public void sneak(PlayerToggleSneakEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (!event.isSneaking()) + return; + + Player player = event.getPlayer(); + + if (_soulManager.checkSouls(player) == 20) + { + setFlying(player, true, true); + _flying.put(player, System.currentTimeMillis()); + _soulManager.resetSouls(player); + } + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + _soulManager.giveSoul(); + List stopFlying = new ArrayList<>(); + for (Player player : _flying.keySet()) + { + if (UtilTime.elapsed(_flying.get(player), FLY_DELAY)) + { + stopFlying.add(player); + setFlying(player, false, event.getType()==UpdateType.FAST); + } + else + { + setFlying(player, true, event.getType()==UpdateType.FAST); + } + } + stopFlying.forEach(p -> _flying.remove(p)); + + if (event.getType() != UpdateType.SEC) + return; + + for (Player player : _flyReady) + { + UtilTextBottom.displayProgress("Grim Reaper Fly", 100, "Sneak to fly!", player); + } + } + + private void setFlying(Player player, boolean flying, boolean isFast) + { + if (flying) + { + if (UtilPlayer.isSpectator(player)) + return; + + player.setAllowFlight(true); + player.setFlying(true); + + _flyReady.remove(player); + + if (UtilEnt.isGrounded(player)) + UtilAction.velocity(player, new Vector(0,1,0)); + + Location loc = player.getLocation().add(0, 1.2, 0).add(player.getLocation().getDirection().multiply(-0.2)); + if (isFast) + { + _wings.display(loc); + _wingsEdge.display(loc); + } + } + else + { + player.setAllowFlight(false); + } + } + + /** + * Removes the blindness effect for that player when they leave + * @param event + */ + @EventHandler + public void onQuit(PlayerQuitEvent event) + { + _soulManager.giveSoul(event.getPlayer()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java index 9ba729c67..f4584bcee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPig.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph; import java.util.HashSet; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -49,16 +50,18 @@ public class MorphPig extends MorphGadget this.applyArmor(player, message); DisguisePig disguise = new DisguisePig(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java index 175c37b02..21c28ec95 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphPumpkinKing.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton.SkeletonType; @@ -21,8 +22,11 @@ public class MorphPumpkinKing extends MorphGadget super(manager, "Pumpkin Kings Head", UtilText.splitLinesToArray(new String[] { C.cGray + "Transforms the wearer into the dreaded Pumpkin King!", + "", + C.cBlue + "Earned by defeating the Pumpkin King", + C.cBlue + "in the 2013 Halloween Horror Event" }, LineFormat.LORE), - -4, + -1, Material.PUMPKIN, (byte)0); } @@ -34,11 +38,12 @@ public class MorphPumpkinKing extends MorphGadget DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.showArmor(); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); disguise.SetSkeletonType(SkeletonType.WITHER); - Manager.getDisguiseManager().disguise(disguise); - + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); + player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers()); @@ -49,7 +54,8 @@ public class MorphPumpkinKing extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.getInventory().setHelmet(null); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java index 5eac2c67f..0c41fc0a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSlime.java @@ -1,5 +1,6 @@ package mineplex.core.gadget.gadgets.morph; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -48,8 +49,8 @@ public class MorphSlime extends MorphGadget this.applyArmor(player, message); DisguiseSlime disguise = new DisguiseSlime(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); int size = 1 + (_achievementManager.getMineplexLevelNumber(player, _clientManager.Get(player).GetRank())) / 8; @@ -61,14 +62,16 @@ public class MorphSlime extends MorphGadget disguise.SetSize(size); - Manager.getDisguiseManager().disguise(disguise); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java index fb18e05e2..e103f0d0c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSnowman.java @@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph; import java.util.WeakHashMap; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; @@ -59,16 +60,18 @@ public class MorphSnowman extends MorphGadget this.applyArmor(player, message); DisguiseSnowman disguise = new DisguiseSnowman(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java index 620b34454..618e48fd9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphSquid.java @@ -4,7 +4,8 @@ import mineplex.core.common.util.*; import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.event.PlayerToggleSwimEvent; -import mineplex.core.gadget.gadgets.morph.swim.SwimManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.gadgets.morph.managers.SwimManager; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.itemstack.ItemStackFactory; @@ -44,8 +45,10 @@ public class MorphSquid extends MorphGadget implements IThrown { applyArmor(player, message); DisguiseSquid disguiseSquid = new DisguiseSquid(player); - disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); - Manager.getDisguiseManager().disguise(disguiseSquid); + //disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank()); + //disguiseSquid.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguiseSquid); + UtilMorph.disguise(player, disguiseSquid, Manager); onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId()))); } @@ -53,7 +56,8 @@ public class MorphSquid extends MorphGadget implements IThrown public void disableCustom(Player player, boolean message) { removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java index d2a2002aa..d175ef849 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphTitan.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -63,17 +64,19 @@ public class MorphTitan extends MorphGadget this.applyArmor(player, message); DisguiseGuardian disguise = new DisguiseGuardian(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); disguise.setElder(true); - Manager.getDisguiseManager().disguise(disguise); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); player.setAllowFlight(false); player.setFlying(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java index f358e0662..f50043402 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphVillager.java @@ -1,10 +1,14 @@ package mineplex.core.gadget.gadgets.morph; +import java.util.HashSet; +import java.util.Iterator; + import mineplex.core.common.currency.GlobalCurrency; import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseVillager; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; @@ -24,9 +28,6 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.inventory.ItemStack; -import java.util.HashSet; -import java.util.Iterator; - public class MorphVillager extends MorphGadget implements IThrown { private HashSet _gems = new HashSet(); @@ -51,16 +52,18 @@ public class MorphVillager extends MorphGadget implements IThrown this.applyArmor(player, message); DisguiseVillager disguise = new DisguiseVillager(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); - disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setCustomNameVisible(true); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager); } @Override public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); } @EventHandler diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java index fb765a163..6bca2d624 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWither.java @@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; import mineplex.core.gadget.types.MorphGadget; import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.data.Item; @@ -64,9 +65,10 @@ public class MorphWither extends MorphGadget player.setHealth(300); DisguiseWither disguise = new DisguiseWither(player); - disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); + //disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank()); //disguise.setCustomNameVisible(true); - Manager.getDisguiseManager().disguise(disguise); + //Manager.getDisguiseManager().disguise(disguise); + UtilMorph.disguise(player, disguise, Manager, true); player.setMaxHealth(20); player.setHealth(20); @@ -76,8 +78,9 @@ public class MorphWither extends MorphGadget public void disableCustom(Player player, boolean message) { this.removeArmor(player); - Manager.getDisguiseManager().undisguise(player); - + //Manager.getDisguiseManager().undisguise(player); + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + player.setAllowFlight(false); player.setFlying(false); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java new file mode 100644 index 000000000..c5c70dd28 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SoulManager.java @@ -0,0 +1,112 @@ +package mineplex.core.gadget.gadgets.morph.managers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; + +public class SoulManager +{ + + /** + * Steals souls from players + */ + + private Map _timer = new HashMap<>(); + private Map _stolenSouls = new HashMap<>(); + + /** + * Removes the soul from the player + * @param stealer Player that stole the soul + * @param player Player whose soul was stolen + * @return if the player had their soul stolen already or not + */ + public boolean stealSoul(Player stealer, Player player) + { + if (_timer.containsKey(player.getUniqueId())) + { + return false; + } + if (_stolenSouls.containsKey(stealer)) + { + if (_stolenSouls.get(stealer) == 20) + { + return false; + } + } + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100000, 1, true, false)); + UtilPlayer.message(player, F.main("Soul", "Your soul was stolen by " + F.name(stealer.getName()) + "!")); + UtilPlayer.message(stealer, F.main("Soul", "You stole " + F.name(player.getName()) + "'s soul!")); + _timer.put(player.getUniqueId(), System.currentTimeMillis()); + _stolenSouls.put(stealer.getUniqueId(), + (_stolenSouls.containsKey(stealer.getUniqueId()) ? _stolenSouls.get(stealer.getUniqueId()) + 1 : 1)); + return true; + } + + /** + * Gives the soul back to the players + */ + public void giveSoul() + { + for (Player player : UtilServer.getPlayers()) + { + if (!_timer.containsKey(player.getUniqueId())) + { + continue; + } + long timeStarted = _timer.get(player.getUniqueId()); + long currentTime = System.currentTimeMillis(); + if (timeStarted + 5000 < currentTime) + { + player.removePotionEffect(PotionEffectType.BLINDNESS); + UtilPlayer.message(player, F.main("Soul", "Oh well, I wasn't using it anyway I guess")); + _timer.remove(player.getUniqueId()); + } + } + } + + /** + * Forces giving a soul to that player + * @param player The player that will receive the soul + */ + public void giveSoul(Player player) + { + if (_timer.containsKey(player.getUniqueId())) + { + player.removePotionEffect(PotionEffectType.BLINDNESS); + UtilPlayer.message(player, F.main("Soul", "Oh well, I wasn't using it anyway I guess")); + _timer.remove(player.getUniqueId()); + } + } + + /** + * Checks how many souls that player has stolen + * @param player The player + * @return souls that they stole + */ + public int checkSouls(Player player) + { + if (_stolenSouls.containsKey(player.getUniqueId())) + { + return _stolenSouls.get(player.getUniqueId()); + } + return 0; + } + + /** + * Resets the souls that the player stole + * @param player The player + */ + public void resetSouls(Player player) + { + _stolenSouls.remove(player.getUniqueId()); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java similarity index 89% rename from Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java rename to Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java index a1945d257..6a76f4a96 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/swim/SwimManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/SwimManager.java @@ -1,4 +1,4 @@ -package mineplex.core.gadget.gadgets.morph.swim; +package mineplex.core.gadget.gadgets.morph.managers; import java.util.ArrayList; import java.util.List; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java new file mode 100644 index 000000000..828e096eb --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/managers/UtilMorph.java @@ -0,0 +1,81 @@ +package mineplex.core.gadget.gadgets.morph.managers; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseInsentient; +import mineplex.core.gadget.GadgetManager; +import org.bukkit.entity.Player; + +public class UtilMorph +{ + + /** + * UtilMorph helps disguising and undisguising players, avoiding the use of deprecated methods + */ + + private static Map _disguises = new HashMap<>(); + + /** + * Disguises a player with custom name + * @param player The player that will be disguised + * @param disguiseInsentient The disguise that will be applied + * @param gadgetManager The gadget manager + */ + public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager) + { + _disguises.put(player.getUniqueId(), disguiseInsentient); + disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); + disguiseInsentient.setCustomNameVisible(true); + gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + } + + /** + * Disguises a player with custom name (special case for the Wither Morph) + * @param player The player that will be disguised + * @param disguiseInsentient The disguise that will be applied + * @param gadgetManager The gadget manager + * @param wither + */ + public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager, boolean wither) + { + _disguises.put(player.getUniqueId(), disguiseInsentient); + disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank()); + if (!wither) + { + disguiseInsentient.setCustomNameVisible(true); + } + gadgetManager.getDisguiseManager().disguise(disguiseInsentient); + } + + /** + * Disguises a player without a custom name + * @param player The player that will be disguised + * @param disguiseInsentient The disguise that will be applied + * @param disguiseManager The disguise manager + */ + public static void disguise(Player player, DisguiseInsentient disguiseInsentient, DisguiseManager disguiseManager) + { + _disguises.put(player.getUniqueId(), disguiseInsentient); + disguiseManager.disguise(disguiseInsentient); + } + + /** + * Removes the disguise of a player + * @param player The player that will be undisguised + * @param disguiseManager The disguise manager + */ + public static void undisguise(Player player, DisguiseManager disguiseManager) + { + if (_disguises.containsKey(player.getUniqueId())) + { + DisguiseBase disguiseBase = _disguises.get(player.getUniqueId()); + disguiseManager.undisguise(disguiseBase); + _disguises.remove(player.getUniqueId()); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java index f6914a598..61f5c5c79 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/BabyFireworkEffect.java @@ -1,12 +1,12 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -import java.awt.*; import java.util.Random; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; import mineplex.core.common.util.particles.NormalParticle; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.plugin.java.JavaPlugin; @@ -18,6 +18,8 @@ public class BabyFireworkEffect extends Effect private Random _random = new Random(); private int _count = 0, _fireworkCount = 0; private boolean _multipleColors = false; + private int _currentColor = 0; + private Color[] _colors; public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color color) { @@ -31,6 +33,20 @@ public class BabyFireworkEffect extends Effect } } + public BabyFireworkEffect(Location location, JavaPlugin javaPlugin, Color... colors) + { + super(10, new EffectLocation(location), javaPlugin, 2); + _fireworkLocation = location.clone(); + _colors = colors; + _fireworkColor = _colors[0]; + _multipleColors = true; + } + + public void setCount(int count) + { + _count = count; + } + @Override public void runEffect() { @@ -79,12 +95,24 @@ public class BabyFireworkEffect extends Effect _fireworkCount++; if (_multipleColors) { - if (_fireworkColor == Color.RED) - _fireworkColor = Color.WHITE; - else if (_fireworkColor == Color.WHITE) - _fireworkColor = Color.BLUE; + if (_colors.length == 0) + { + if (_fireworkColor == Color.RED) + _fireworkColor = Color.WHITE; + else if (_fireworkColor == Color.WHITE) + _fireworkColor = Color.BLUE; + else + _fireworkColor = Color.RED; + } else - _fireworkColor = Color.RED; + { + _currentColor++; + if (_currentColor == _colors.length) + { + _currentColor = 0; + } + _fireworkColor = _colors[_currentColor]; + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java index 5f1558e67..cc63e8fae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomFireworkEffect.java @@ -1,6 +1,6 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -import java.awt.*; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java index 67b04993a..2a0be19fa 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/FreedomTrailEffect.java @@ -1,7 +1,5 @@ package mineplex.core.gadget.gadgets.particle.unrelated; -import java.awt.Color; - import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.particles.ColoredParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java new file mode 100644 index 000000000..c8ab96a6f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/HalloweenSmashedEffect.java @@ -0,0 +1,25 @@ +package mineplex.core.gadget.gadgets.particle.unrelated; + +import mineplex.core.common.util.UtilFirework; +import org.bukkit.FireworkEffect; +import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; + +public class HalloweenSmashedEffect extends Effect +{ + + private FireworkEffect _fireworkEffect; + + public HalloweenSmashedEffect(Location location, FireworkEffect fireworkEffect, JavaPlugin javaPlugin) + { + super(140, new EffectLocation(location), javaPlugin, 5); + _fireworkEffect = fireworkEffect; + } + + @Override + public void runEffect() + { + UtilFirework.playFirework(_effectLocation.getLocation(), _fireworkEffect); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java index 5273f0e7e..b60de7ee9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/particle/unrelated/MetalManEffect.java @@ -6,6 +6,7 @@ import java.util.HashMap; import mineplex.core.common.util.*; import mineplex.core.common.util.particles.ColoredParticle; import mineplex.core.common.util.particles.DustSpellColor; +import org.bukkit.Color; import mineplex.core.gadget.types.Gadget; import org.bukkit.Location; import org.bukkit.Material; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java index 9b5836cfe..d7d20aa75 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectBabyChicken.java @@ -1,34 +1,11 @@ package mineplex.core.gadget.gadgets.wineffect; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; -import org.bukkit.entity.Chicken; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.inventory.ItemStack; -import org.bukkit.scoreboard.Team; -import org.bukkit.util.Vector; - -import mineplex.core.common.util.C; -import mineplex.core.common.util.LineFormat; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilShapes; -import mineplex.core.common.util.UtilText; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.types.WinEffectGadget; @@ -38,6 +15,15 @@ import mineplex.core.updater.event.UpdateEvent; import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_8_R3.PathfinderGoal; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftChicken; +import org.bukkit.entity.Chicken; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; +import org.bukkit.util.Vector; public class WinEffectBabyChicken extends WinEffectGadget { @@ -81,15 +67,7 @@ public class WinEffectBabyChicken extends WinEffectGadget public Chicken spawnChicken(Player player, Location loc) { Chicken chicken = loc.getWorld().spawn(loc, Chicken.class); - String rank = ""; - for(Team t : player.getScoreboard().getTeams()) - { - if(t.hasEntry(player.getName())) - { - rank = t.getPrefix(); - break; - } - } + String rank = getRank(player); chicken.setCustomName(rank + player.getName()); chicken.setCustomNameVisible(true); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java new file mode 100644 index 000000000..038495d65 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectHalloween.java @@ -0,0 +1,181 @@ +package mineplex.core.gadget.gadgets.wineffect; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.*; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.particle.unrelated.BabyFireworkEffect; +import mineplex.core.gadget.types.WinEffectGadget; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.entity.Skeleton; +import org.bukkit.event.EventHandler; +import org.bukkit.inventory.ItemStack; + +public class WinEffectHalloween extends WinEffectGadget +{ + + private DisguisePlayer _npc; + private Skeleton _skeleton; + private List _disguisePlayers = new ArrayList<>(); + private int _tick; + + public WinEffectHalloween(GadgetManager manager) + { + super(manager, "Return of The Pumpkin", UtilText.splitLineToArray(C.cGray + "The Pumpkin King will rise again...", LineFormat.LORE), + -9, Material.PUMPKIN, (byte) 0); + _schematicName = "HalloweenRoom"; + setGameTime(16000); + } + + @Override + public void setup(Player player, List team, List nonTeam, Location loc) + { + Location fixedLoc = loc.setDirection(loc.getDirection().multiply(-1)); + super.setup(player, team, nonTeam, fixedLoc); + } + + @Override + public void teleport() + { + Location loc = getBaseLocation().add(getBaseLocation().getDirection().normalize().multiply(17)).add(0, 3, 0); + loc.setDirection(getBaseLocation().clone().subtract(loc).toVector()); + super.teleport(loc); + } + + @Override + public void play() + { + spawnNPC(); + _tick = 0; + } + + @Override + public void finish() + { + UtilPlayer.showForAll(_player); + _team.forEach(p -> UtilPlayer.showForAll(p)); + _nonTeam.forEach(p -> UtilPlayer.showForAll(p)); + _disguisePlayers.forEach(d -> d.getEntity().getBukkitEntity().remove()); + _disguisePlayers.clear(); + _skeleton.remove(); + _skeleton = null; + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (!isRunning()) + return; + + if (event.getType() != UpdateType.TICK) + return; + + _tick++; + + if (_tick == 50) + { + transformPlayer(); + } + + if (_tick > 50 && _tick <= 60) + { + int particles = 50; + double radius = 0.5; + + for (int i = 0; i < particles; i++) + { + double angle = (double) 2 * Math.PI * i / particles; + double x = Math.cos(angle) * radius; + double z = Math.sin(angle) * radius; + Location loc = getBaseLocation().clone().add(x, .2 * (_tick - 50), z); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor((i % 2 == 0) ? Color.ORANGE : Color.BLACK), loc); + coloredParticle.display(); + } + } + } + + private void spawnNPC() + { + Location loc = getBaseLocation().setDirection(getBaseLocation().getDirection()); + _npc = getNPC(_player, loc); + } + + private void transformPlayer() + { + _npc.getEntity().getBukkitEntity().remove(); + spawnSkeleton(); + spawnGhosts(); + UtilPlayer.hideFromAll(_player); + _player.getWorld().playSound(getBaseLocation(), Sound.CAT_MEOW, .5f, .5f); + } + + private void spawnSkeleton() + { + Skeleton skeleton = getBaseLocation().getWorld().spawn(getBaseLocation(), Skeleton.class); + skeleton.setCustomName(getRank(_player) + _player.getName()); + skeleton.setCustomNameVisible(true); + skeleton.setSkeletonType(Skeleton.SkeletonType.WITHER); + skeleton.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN)); + UtilEnt.ghost(skeleton, true, false); + UtilEnt.Vegetate(skeleton); + for (int i = 0; i < 15; i++) + { + playFirework(skeleton.getLocation().clone().add(0, 2, 0), i, true); + } + } + + private void spawnGhosts() + { + int i = 0; + List circle = UtilShapes.getPointsInCircle(getBaseLocation(), _nonTeam.size(), 7); + for (Player player : _nonTeam) + { + ItemStack playerHead = UtilSkull.getPlayerHead(player.getName(), player.getName() + " skull", null); + Location ghostLoc = circle.get(i); + // Makes sure the block under the zombie is not air + while (ghostLoc.clone().subtract(0, 1, 0).getBlock().getType() == Material.AIR) + { + ghostLoc.subtract(0, 1, 0); + } + DisguisePlayer disguisePlayer = getNPC(player, ghostLoc, SkinData.GHOST); + disguisePlayer.setHelmet(playerHead); + UtilEnt.CreatureLook(disguisePlayer.getEntity().getBukkitEntity(), getBaseLocation()); + UtilPlayer.hideFromAll(player); + for (int j = 0; j < 5; j++) + { + playFirework(ghostLoc.clone().add(0, 1, 0), j, false); + } + i++; + } + } + + private void playFirework(Location entityLocation, int i, boolean randomLoc) + { + Location randLocation = UtilAlg.getRandomLocation(entityLocation.clone(), 0.7d, 0.7d, 0d); + Color color = (i == 0) ? Color.ORANGE : Color.BLACK; + BabyFireworkEffect babyFireworkEffect; + if (i %2 == 0) + { + babyFireworkEffect = new BabyFireworkEffect((randomLoc) ? randLocation : entityLocation, Manager.getPlugin(), color); + } + else + { + babyFireworkEffect = new BabyFireworkEffect((randomLoc) ? randLocation : entityLocation, Manager.getPlugin(), Color.ORANGE, Color.BLACK); + } + // Starts without the firework trail + babyFireworkEffect.setCount(6); + babyFireworkEffect.start(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java index 6624ce9a8..21dae8773 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/WinEffectLavaTrap.java @@ -24,7 +24,7 @@ public class WinEffectLavaTrap extends WinEffectGadget private int _tick = 0; private Block _lever; - private DisguisePlayer playerNPC; + private DisguisePlayer _playerNPC; public WinEffectLavaTrap(GadgetManager manager) { @@ -42,7 +42,7 @@ public class WinEffectLavaTrap extends WinEffectGadget _lever = getBaseLocation().add(_baseLocation.getDirection().normalize()).getBlock(); _lever.setTypeIdAndData(Material.LEVER.getId(), (byte) 5, false); - playerNPC = getNPC(_player, getBaseLocation()); + _playerNPC = getNPC(_player, getBaseLocation()); { Vector forward = getBaseLocation().getDirection().normalize().multiply(1.3); @@ -101,13 +101,13 @@ public class WinEffectLavaTrap extends WinEffectGadget Location loc = getBaseLocation(); loc.setDirection(_lever.getLocation().add(0.5, 0, 0.5).subtract(loc.clone().add(0, 1.8, 0)).toVector()); - playerNPC.getEntity().getBukkitEntity().teleport(loc); + _playerNPC.getEntity().getBukkitEntity().teleport(loc); } if(_tick == 20*3) { - playerNPC.sendHit(); + _playerNPC.sendHit(); _lever.setTypeIdAndData(Material.LEVER.getId(), (byte) (5 | 0x8), false); _lever.getWorld().playSound(_lever.getLocation(), Sound.CLICK, 0.3f, 0.6f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java index b76e4e86b..ba38e4d5f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/Gadget.java @@ -1,5 +1,14 @@ package mineplex.core.gadget.types; +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerQuitEvent; + import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -8,14 +17,6 @@ import mineplex.core.gadget.event.GadgetAppliedEvent; import mineplex.core.gadget.event.GadgetDisableEvent; import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.shop.item.SalesPackageBase; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerQuitEvent; - -import java.util.HashSet; public abstract class Gadget extends SalesPackageBase implements Listener { @@ -107,8 +108,6 @@ public abstract class Gadget extends SalesPackageBase implements Listener return; } - System.out.println(player.getName() + " has activated " + Name); - Manager.setActive(player, this); enableCustom(player, message); Bukkit.getServer().getPluginManager().callEvent(new GadgetAppliedEvent(player, this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java index c328c1517..e2857ec77 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/WinEffectGadget.java @@ -2,34 +2,30 @@ package mineplex.core.gadget.types; import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import com.mojang.authlib.GameProfile; +import mineplex.core.common.block.schematic.Schematic; +import mineplex.core.common.block.schematic.UtilSchematic; +import mineplex.core.common.skin.SkinData; import mineplex.core.common.util.*; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import org.bukkit.*; -import org.bukkit.Color; -import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; - -import com.mojang.authlib.GameProfile; - -import mineplex.core.common.block.schematic.Schematic; -import mineplex.core.common.block.schematic.UtilSchematic; -import mineplex.core.disguise.disguises.DisguisePlayer; -import mineplex.core.gadget.GadgetManager; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; -import org.spigotmc.event.entity.EntityDismountEvent; /** * A wrapper for different win effects @@ -42,6 +38,7 @@ public abstract class WinEffectGadget extends Gadget protected long _start; protected long _finish; protected Location _baseLocation; + private int _gameTime = 12000; /** * The file name of the schematic used for this win room. Schematics can be found in the "schematic" folder @@ -293,6 +290,30 @@ public abstract class WinEffectGadget extends Gadget Manager.getDisguiseManager().disguise(disguise); return disguise; } + + /** + * Get a disguised ArmorStand with the skin of the provided skindata at the provided location. The ArmorStand got no gravity and + * 2048 health. + * @param player The player to create the disguise from + * @param loc The location to spawn the ArmorStand at + * @param skinData The skin data to disguise the armorstand + * @return Returns a disguised ArmorStand at the given location + */ + public DisguisePlayer getNPC(Player player, Location loc, SkinData skinData) { + ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class); + + stand.setMaxHealth(2048); + stand.setHealth(2048); + stand.setGravity(false); + + GameProfile profile = new GameProfile(UUID.randomUUID(), player.getName()); + profile.getProperties().clear(); + profile.getProperties().put("textures", skinData.getProperty()); + + DisguisePlayer disguise = new DisguisePlayer(stand, profile); + Manager.getDisguiseManager().disguise(disguise); + return disguise; + } /** * Paste a schematic relative to the base location @@ -414,4 +435,29 @@ public abstract class WinEffectGadget extends Gadget blockLocation.getBlock().setType(Material.BARRIER); } + /** + * Gets the formatted rank of the player + * @param player + * @return + */ + protected String getRank(Player player) + { + return Manager.getClientManager().Get(player).getRealOrDisguisedRank().getTag(true, true) + " " + C.Reset; + } + + public int getGameTime() + { + return _gameTime; + } + + protected void setGameTime(int gameTime) + { + _gameTime = gameTime; + } + + protected void setBaseLocation(Location baseLocation) + { + _baseLocation = baseLocation; + } + } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java index 1420cac3e..53cd1dde6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/globalpacket/listeners/GlobalGiveItem.java @@ -138,8 +138,8 @@ public class GlobalGiveItem implements Listener { for (final Player p : UtilServer.getPlayers()) { - Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GameLoot, true); - reward.giveReward(RewardType.GameLoot, p, new Callback() + Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GAME_LOOT, true); + reward.giveReward(RewardType.GAME_LOOT, p, new Callback() { @Override public void run(RewardData data) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java index 07f07b5a0..399bbd25c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/MountManager.java @@ -63,6 +63,7 @@ public class MountManager extends MiniPlugin _types.add(new MountBabyReindeer(this)); _types.add(new MountValentinesSheep(this)); _types.add(new MountFreedomHorse(this)); + _types.add(new MountNightmareSteed(this)); //_types.add(new MountSheep(this)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java new file mode 100644 index 000000000..1e2459c3b --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountNightmareSteed.java @@ -0,0 +1,123 @@ +package mineplex.core.mount.types; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import mineplex.core.common.util.*; +import mineplex.core.common.util.particles.ColoredParticle; +import mineplex.core.common.util.particles.DustSpellColor; +import mineplex.core.mount.HorseMount; +import mineplex.core.mount.MountManager; +import mineplex.core.mount.SingleEntityMountData; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Horse; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +public class MountNightmareSteed extends HorseMount +{ + + private boolean _foot = false; + private HashMap _steps = new HashMap<>(); + + public MountNightmareSteed(MountManager manager) + { + super(manager, "Nightmare Steed", UtilText.splitLineToArray(C.cGray + "The Nightmare Steed comes in the darkness of night, the fires of the underworld still trailing from its hooves.", LineFormat.LORE), + Material.WOOL, (byte) 15, -9, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1, null); + } + + @EventHandler + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.SEC) + { + for (SingleEntityMountData singleEntityMountData : getActive().values()) + { + UtilParticle.PlayParticleToAll(UtilParticle.ParticleType.FOOTSTEP, + singleEntityMountData.getEntity().getLocation(), 0f, 0f, 0f, 0f, 1, UtilParticle.ViewDist.NORMAL); + } + } + + if (event.getType() != UpdateType.FASTEST) + return; + + for (SingleEntityMountData singleEntityMountData : getActive().values()) + { + Entity entity = singleEntityMountData.getEntity(); + + if (event.getType() != UpdateType.FASTEST) return; + + _foot = !_foot; + + cleanSteps(); + + if (!UtilEnt.isGrounded(entity)) return; + + Vector offset; + + Vector dir = entity.getLocation().getDirection(); + dir.setY(0); + dir.normalize(); + + if (_foot) + { + offset = new Vector(dir.getZ() * -1, 0.1, dir.getX()); + } + else + { + offset = new Vector(dir.getZ(), 0.1, dir.getX() * -1); + } + + Location loc = entity.getLocation().add(offset.multiply(0.2)); + + if (nearStep(loc)) return; + + if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN))) return; + + _steps.put(loc, System.currentTimeMillis()); + + UtilParticle.PlayParticle(UtilParticle.ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1, UtilParticle.ViewDist.NORMAL, UtilServer.getPlayers()); + + for (int i = 0; i < 10; i++) + { + Location randLoc = UtilAlg.getRandomLocation(singleEntityMountData.getEntity().getLocation().clone().add(0, 1, 0), 1d); + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor(Color.BLACK), randLoc); + coloredParticle.display(2); + } + + } + } + + public void cleanSteps() + { + if (_steps.isEmpty()) return; + + Iterator> stepIterator = _steps.entrySet().iterator(); + + while (stepIterator.hasNext()) + { + Map.Entry entry = stepIterator.next(); + + if (UtilTime.elapsed(entry.getValue(), 10000)) stepIterator.remove(); + } + } + + public boolean nearStep(Location loc) + { + for (Location other : _steps.keySet()) + { + if (UtilMath.offset(loc, other) < 0.3) return true; + } + + return false; + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java index 6f22ffc3e..4ee91ff52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountSpider.java @@ -50,8 +50,10 @@ public class MountSpider extends HorseMount C.blankLine, "#" + C.cWhite + "Look Up to use Wall Climb", "#" + C.cWhite + "Jump to use Leap", + "", + C.cBlue + "Only buyable during Halloween 2015" }, LineFormat.LORE), - Material.WEB, (byte) 0, -4, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); + Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java index 949a50f23..8e237ae73 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountZombie.java @@ -16,10 +16,15 @@ public class MountZombie extends HorseMount public MountZombie(MountManager manager) { super(manager, "Decrepit Warhorse", - UtilText.splitLineToArray(C.cGray + "Once a fierce warhorse, this undead beast will send fear into the hearts of your enemies.", LineFormat.LORE), + UtilText.splitLinesToArray(new String[]{ + C.cGray + "Once a fierce warhorse, this undead beast will send fear into the hearts of your enemies.", + "", + C.cBlue + "Earned by defeating the Pumpkin King", + C.cBlue + "in the 2015 Halloween Horror Event." + }, LineFormat.LORE), Material.ROTTEN_FLESH, (byte)0, - -4, + -1, Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java new file mode 100644 index 000000000..781c0b884 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/GrimReaperPetManager.java @@ -0,0 +1,85 @@ +package mineplex.core.pet; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; +import org.bukkit.Location; +import org.bukkit.entity.Blaze; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class GrimReaperPetManager +{ + + /** + * Makes the Grim Reaper Pet fly around the player + * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} + */ + + private Player _player; + private Blaze _blaze; + private Location _grimReaperLoc, _target; + private Vector _direction; + private double _speed; + private long _idleTime; + + public GrimReaperPetManager(Player player, Blaze blaze) + { + _player = player; + _blaze = blaze; + _grimReaperLoc = player.getEyeLocation(); + _target = getNewTarget(); + _speed = 0.2; + _idleTime = 0; + _direction = new Vector(1, 0, 0); + } + + public void update() + { + //Update Target + if (UtilMath.offset(_player.getEyeLocation(), _target) > 3 || UtilMath.offset(_grimReaperLoc, _target) < 1) + _target = getNewTarget(); + + //Pause? + if (Math.random() > 0.98) + _idleTime = System.currentTimeMillis() + (long)(Math.random() * 3000); + + //Speed + if (UtilMath.offset(_player.getEyeLocation(), _grimReaperLoc) < 3) + { + if (_idleTime > System.currentTimeMillis()) + { + _speed = Math.max(0, _speed - 0.005); + } + else + { + _speed = Math.min(0.15, _speed + 0.005); + } + } + else + { + _idleTime = 0; + + _speed = Math.min(0.15 + UtilMath.offset(_player.getEyeLocation(), _grimReaperLoc) * 0.05, _speed + 0.02); + } + + + //Modify Direction + _direction.add(UtilAlg.getTrajectory(_grimReaperLoc, _target).multiply(0.15)); + if (_direction.length() < 1) + _speed = _speed * _direction.length(); + UtilAlg.Normalize(_direction); + + //Move + if (UtilMath.offset(_grimReaperLoc, _target) > 0.1) + _grimReaperLoc.add(_direction.clone().multiply(_speed)); + + _blaze.teleport(_grimReaperLoc); + _blaze.setVelocity(new Vector(0, .25, 0)); + } + + private Location getNewTarget() + { + return _player.getEyeLocation().add(Math.random() * 6 - 3, Math.random() * 1.5, Math.random() * 6 - 3); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java index e6f918520..7ea9aebe7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/Pet.java @@ -10,7 +10,8 @@ public class Pet extends SalesPackageBase { private String _name; private EntityType _petType; - + private String _lore = null; + public Pet(String name, EntityType petType, int cost) { super(name, Material.MONSTER_EGG, (byte)petType.getTypeId(), new String[] {}); @@ -21,6 +22,18 @@ public class Pet extends SalesPackageBase KnownPackage = false; } + + public Pet(String name, EntityType petType, int cost, String lore) + { + super(name, Material.MONSTER_EGG, (byte)petType.getTypeId(), new String[] {}); + + _name = name; + _petType = petType; + CurrencyCostMap.put(GlobalCurrency.TREASURE_SHARD, cost); + _lore = lore; + + KnownPackage = false; + } public EntityType getPetType() { @@ -36,4 +49,9 @@ public class Pet extends SalesPackageBase { return _name; } + + public String getLore() + { + return _lore; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java index 1b88b0e93..66565261e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetFactory.java @@ -20,8 +20,8 @@ public class PetFactory public PetFactory(PetRepository repository) { _repository = repository; - _pets = new NautHashMap(); - _petExtras = new NautHashMap(); + _pets = new NautHashMap<>(); + _petExtras = new NautHashMap<>(); CreatePets(); CreatePetExtras(); @@ -41,6 +41,8 @@ public class PetFactory _pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000)); _pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -12)); _pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -13)); + _pets.put(EntityType.RABBIT, new Pet("Baby Zombie", EntityType.RABBIT, -9, "They're so cute - until a pack of them chases down your family and eats them.")); + _pets.put(EntityType.BLAZE, new Pet("Grim Reaper", EntityType.BLAZE, -8, "Aww isn't he so cute with his little wings and little scythe?")); } private void CreatePetExtras() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 5b5442191..028fee9fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -1,26 +1,37 @@ package mineplex.core.pet; -import java.util.Collection; -import java.util.Iterator; +import java.util.*; import java.util.Map.Entry; -import java.util.UUID; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import com.google.gson.Gson; +import mineplex.core.MiniClientPlugin; +import mineplex.core.account.CoreClientManager; +import mineplex.core.account.event.ClientWebResponseEvent; +import mineplex.core.blockrestore.BlockRestore; +import mineplex.core.common.Rank; +import mineplex.core.common.shape.ShapeWings; +import mineplex.core.common.util.*; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.disguise.DisguiseManager; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.disguise.disguises.DisguiseGuardian; +import mineplex.core.disguise.disguises.DisguiseWither; +import mineplex.core.disguise.disguises.DisguiseZombie; +import mineplex.core.donation.DonationManager; +import mineplex.core.events.AddConditionEvent; +import mineplex.core.inventory.InventoryManager; +import mineplex.core.pet.repository.PetRepository; +import mineplex.core.pet.repository.token.ClientPetTokenWrapper; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import net.minecraft.server.v1_8_R3.EntityCreature; +import net.minecraft.server.v1_8_R3.NavigationAbstract; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie; -import org.bukkit.entity.Ageable; -import org.bukkit.entity.Creature; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.PigZombie; -import org.bukkit.entity.Player; -import org.bukkit.entity.Skeleton; -import org.bukkit.entity.Villager; -import org.bukkit.entity.Zombie; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent; @@ -34,33 +45,6 @@ import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import com.google.gson.Gson; - -import mineplex.core.MiniClientPlugin; -import mineplex.core.account.CoreClientManager; -import mineplex.core.account.event.ClientWebResponseEvent; -import mineplex.core.blockrestore.BlockRestore; -import mineplex.core.common.Rank; -import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilParticle.ParticleType; -import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilServer; -import mineplex.core.disguise.DisguiseManager; -import mineplex.core.disguise.disguises.DisguiseGuardian; -import mineplex.core.disguise.disguises.DisguiseWither; -import mineplex.core.donation.DonationManager; -import mineplex.core.inventory.InventoryManager; -import mineplex.core.pet.repository.PetRepository; -import mineplex.core.pet.repository.token.ClientPetTokenWrapper; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_8_R3.EntityCreature; -import net.minecraft.server.v1_8_R3.NavigationAbstract; - public class PetManager extends MiniClientPlugin { private static Object _petOwnerSynch = new Object(); @@ -80,6 +64,11 @@ public class PetManager extends MiniClientPlugin private DonationManager _donationManager; private CoreClientManager _clientManager; private InventoryManager _inventoryManager; + + private Map _grimReaperMorphs = new HashMap<>(); + + private ShapeWings _wings = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); + private ShapeWings _wingsEdge = new ShapeWings(ParticleType.RED_DUST.particleName, new org.bukkit.util.Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN); public PetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager , InventoryManager inventoryManager, DisguiseManager disguiseManager, mineplex.core.creature.Creature creatureModule, BlockRestore restore, String webAddress) @@ -249,10 +238,49 @@ public class PetManager extends MiniClientPlugin if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) { disguise.setName(Get(player).getPets().get(entityType)); + disguise.setCustomNameVisible(true); } _disguiseManager.disguise(disguise); } + else if (pet instanceof Rabbit) + { + UtilEnt.silence(pet, true); + DisguiseChicken disguise = new DisguiseChicken(pet); + _disguiseManager.disguise(disguise); + + Zombie zombie = pet.getWorld().spawn(pet.getLocation(), Zombie.class); + zombie.setBaby(true); + zombie.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + zombie.setCustomName(Get(player).getPets().get(entityType)); + zombie.setCustomNameVisible(true); + } + disguise.getEntity().getBukkitEntity().setPassenger(zombie); + } + else if (pet instanceof Blaze) + { + + AddConditionEvent event = new AddConditionEvent("Pet", pet, pet, AddConditionEvent.CoreConditionType.SILENCE, 0, -1, true, Material.SNOW_BALL, (byte) 0, false, false); + Bukkit.getPluginManager().callEvent(event); + + DisguiseZombie disguiseZombie = new DisguiseZombie(pet); + disguiseZombie.setBaby(true); + disguiseZombie.setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.WITHER.ordinal())); + disguiseZombie.setChestplate(new ItemStack(Material.BANNER)); + disguiseZombie.setHeldItem(new ItemStack(Material.WOOD_HOE)); + + if (Get(player).getPets().get(entityType) != null && Get(player).getPets().get(entityType).length() > 0) + { + disguiseZombie.setName(Get(player).getPets().get(entityType)); + disguiseZombie.setCustomNameVisible(true); + } + + _disguiseManager.disguise(disguiseZombie); + GrimReaperPetManager grimReaperPetManager = new GrimReaperPetManager(player, (Blaze) pet); + _grimReaperMorphs.put((Blaze) pet, grimReaperPetManager); + } _activePetOwners.put(player.getName(), pet); _failedAttempts.put(player.getName(), 0); @@ -280,10 +308,14 @@ public class PetManager extends MiniClientPlugin //Wither Silverfish if (pet.getPassenger() != null) pet.getPassenger().remove(); - + + if (pet instanceof Blaze) + { + _grimReaperMorphs.remove(pet); + } + pet.remove(); - - + if (removeOwner) { _activePetOwners.remove(player.getName()); @@ -348,20 +380,25 @@ public class PetManager extends MiniClientPlugin @EventHandler public void onUpdate(UpdateEvent event) { - if (event.getType() == UpdateType.TICK) + for(Creature pet : _activePetOwners.values()) { - for(Creature pet : _activePetOwners.values()) + if(pet instanceof PigZombie && event.getType() == UpdateType.TICK) { - if(pet instanceof PigZombie) + UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL); + if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); + if(!((CraftPigZombie)pet).getHandle().isSilent()) { - UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL); - if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.03f, 0f); - if(!((CraftPigZombie)pet).getHandle().isSilent()) - { - ((CraftPigZombie)pet).getHandle().setSilent(true); - } + ((CraftPigZombie)pet).getHandle().setSilent(true); } } + if (pet instanceof Blaze && event.getType() == UpdateType.FAST) + { + Location loc = pet.getLocation().clone().add(0, .5, 0).add(pet.getLocation().getDirection().multiply(-0.2)); + + if (event.getType() == UpdateType.FAST) _wings.display(loc); + if (event.getType() == UpdateType.FAST) _wingsEdge.display(loc); + + } } if (event.getType() != UpdateType.FAST) @@ -445,6 +482,21 @@ public class PetManager extends MiniClientPlugin Get(event.getUniqueId()).load(token.DonorToken); } + + /** + * Makes the Grim Reaper pet fly around the player + * Copied from {@link mineplex.core.gadget.gadgets.particle.ParticleFairyData} + * @param event + */ + @EventHandler + public void grimReaperFly(UpdateEvent event) + { + for (Entry entry : _grimReaperMorphs.entrySet()) + { + GrimReaperPetManager grimReaperPetManager = entry.getValue(); + grimReaperPetManager.update(); + } + } @Override protected PetClient addPlayer(UUID uuid) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java index 0d7cc14d5..48fce2012 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardManager.java @@ -5,11 +5,16 @@ import java.util.EnumMap; import java.util.List; import java.util.Random; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.banner.CountryFlag; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween; import mineplex.core.gadget.gadgets.arrowtrail.candycane.ArrowTrailCandyCane; import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid; import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald; @@ -32,6 +37,7 @@ import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst; import mineplex.core.gadget.gadgets.death.shadow.DeathShadow; import mineplex.core.gadget.gadgets.death.vampire.DeathBlood; import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant; +import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween; import mineplex.core.gadget.gadgets.doublejump.candycane.DoubleJumpCandyCane; import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings; import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald; @@ -45,8 +51,31 @@ import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood; import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant; import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin; import mineplex.core.gadget.gadgets.hat.HatType; -import mineplex.core.gadget.gadgets.item.*; -import mineplex.core.gadget.gadgets.morph.*; +import mineplex.core.gadget.gadgets.item.ItemBatGun; +import mineplex.core.gadget.gadgets.item.ItemBow; +import mineplex.core.gadget.gadgets.item.ItemCoal; +import mineplex.core.gadget.gadgets.item.ItemEtherealPearl; +import mineplex.core.gadget.gadgets.item.ItemFirework; +import mineplex.core.gadget.gadgets.item.ItemFleshHook; +import mineplex.core.gadget.gadgets.item.ItemFreezeCannon; +import mineplex.core.gadget.gadgets.item.ItemLovePotion; +import mineplex.core.gadget.gadgets.item.ItemMelonLauncher; +import mineplex.core.gadget.gadgets.item.ItemPaintballGun; +import mineplex.core.gadget.gadgets.item.ItemPartyPopper; +import mineplex.core.gadget.gadgets.item.ItemSnowball; +import mineplex.core.gadget.gadgets.item.ItemTNT; +import mineplex.core.gadget.gadgets.morph.MorphBat; +import mineplex.core.gadget.gadgets.morph.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphBunny; +import mineplex.core.gadget.gadgets.morph.MorphChicken; +import mineplex.core.gadget.gadgets.morph.MorphCow; +import mineplex.core.gadget.gadgets.morph.MorphEnderman; +import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; +import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing; +import mineplex.core.gadget.gadgets.morph.MorphSlime; +import mineplex.core.gadget.gadgets.morph.MorphSnowman; +import mineplex.core.gadget.gadgets.morph.MorphUncleSam; +import mineplex.core.gadget.gadgets.morph.MorphVillager; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate; import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet; @@ -55,7 +84,14 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet; import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings; -import mineplex.core.gadget.gadgets.particle.*; +import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes; +import mineplex.core.gadget.gadgets.particle.ParticleFairy; +import mineplex.core.gadget.gadgets.particle.ParticleFireRings; +import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel; +import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons; +import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal; +import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie; +import mineplex.core.gadget.gadgets.particle.ParticleYinYang; import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane; import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart; import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald; @@ -67,22 +103,40 @@ import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime; import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot; import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood; import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant; -import mineplex.core.gadget.gadgets.wineffect.*; +import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken; +import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames; +import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween; +import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap; +import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike; +import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan; +import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian; +import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.HatGadget; import mineplex.core.gadget.types.ItemGadget; import mineplex.core.inventory.InventoryManager; import mineplex.core.mount.Mount; -import mineplex.core.mount.types.*; +import mineplex.core.mount.types.MountBabyReindeer; +import mineplex.core.mount.types.MountCart; +import mineplex.core.mount.types.MountFreedomHorse; +import mineplex.core.mount.types.MountFrost; +import mineplex.core.mount.types.MountMule; +import mineplex.core.mount.types.MountNightmareSteed; +import mineplex.core.mount.types.MountSlime; +import mineplex.core.mount.types.MountSpider; +import mineplex.core.mount.types.MountUndead; +import mineplex.core.mount.types.MountValentinesSheep; +import mineplex.core.mount.types.MountZombie; import mineplex.core.pet.Pet; import mineplex.core.pet.PetManager; import mineplex.core.reward.RewardPool.Type; -import mineplex.core.reward.rewards.*; +import mineplex.core.reward.rewards.InventoryReward; +import mineplex.core.reward.rewards.PetReward; +import mineplex.core.reward.rewards.RankReward; +import mineplex.core.reward.rewards.TreasureShardReward; +import mineplex.core.reward.rewards.UnknownPackageReward; import mineplex.core.stats.StatsManager; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; public class RewardManager { @@ -211,8 +265,8 @@ public class RewardManager // addInventoryReward(Type.VALENTINES_GIFT, getGadget(ItemFlowerGift.class), rarity, 100, 0, 1, 1); // WINTER Gadgets - addHat(Type.WINTER_HOLIDAY, HatType.Present, rarity, 5); - addHat(Type.WINTER_HOLIDAY, HatType.Snowman, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.PRESENT, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.SNOWMAN, rarity, 5); // Omega items addMusicReward(Type.OMEGA, "Block Disk", rarity, 25); @@ -226,8 +280,8 @@ public class RewardManager addMusicReward(Type.OMEGA, "Wait Disk", rarity, 25); addMusicReward(Type.OMEGA, "Ward Disk", rarity, 25); - addHat(Type.OMEGA, HatType.Present, rarity, 5); - addHat(Type.OMEGA, HatType.Snowman, rarity, 5); + addHat(Type.OMEGA, HatType.PRESENT, rarity, 5); + addHat(Type.OMEGA, HatType.SNOWMAN, rarity, 5); } @@ -305,10 +359,10 @@ public class RewardManager // VALENTINES //Hats - addHat(Type.VALENTINES_GIFT, HatType.Companion_Block, rarity, 100, 0); - addHat(Type.VALENTINES_GIFT, HatType.Lovestruck, rarity, 100, 0); - addHat(Type.VALENTINES_GIFT, HatType.Secret_Package, rarity, 100, 0); - addHat(Type.VALENTINES_GIFT, HatType.Teddy_Bear, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.COMPANION_BLOCK, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.LOVESTRUCK, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.SECRET_PACKAGE, rarity, 100, 0); + addHat(Type.VALENTINES_GIFT, HatType.TEDDY_BEAR, rarity, 100, 0); // WINTER @@ -319,7 +373,7 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleCandyCane.class), rarity, 5); // FREEDOM - addHat(Type.FREEDOM, HatType.Uncle_Sam, rarity, 100); + addHat(Type.FREEDOM, HatType.UNCLE_SAM, rarity, 100); addGadget(Type.FREEDOM, getGadget(DoubleJumpFreedom.class), rarity, 50); addGadget(Type.FREEDOM, getGadget(ArrowTrailFreedom.class), rarity, 10); addGadget(Type.FREEDOM, getGadget(DeathFreedom.class), rarity, 75); @@ -352,14 +406,14 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(ArrowTrailShadow.class), rarity, 15); addGadget(Type.OMEGA, getGadget(ArrowTrailCandyCane.class), rarity, 10); - addHat(Type.OMEGA, HatType.Uncle_Sam, rarity, 25); - addHat(Type.OMEGA, HatType.Companion_Block, rarity, 15); - addHat(Type.OMEGA, HatType.Lovestruck, rarity, 20); - addHat(Type.OMEGA, HatType.Secret_Package, rarity, 25); - addHat(Type.OMEGA, HatType.Teddy_Bear, rarity, 25); - addHat(Type.OMEGA, HatType.Santa, rarity, 25); - addHat(Type.OMEGA, HatType.Rudolph, rarity, 25); - addHat(Type.OMEGA, HatType.Coal, rarity, 25); + addHat(Type.OMEGA, HatType.UNCLE_SAM, rarity, 25); + addHat(Type.OMEGA, HatType.COMPANION_BLOCK, rarity, 15); + addHat(Type.OMEGA, HatType.LOVESTRUCK, rarity, 20); + addHat(Type.OMEGA, HatType.SECRET_PACKAGE, rarity, 25); + addHat(Type.OMEGA, HatType.TEDDY_BEAR, rarity, 25); + addHat(Type.OMEGA, HatType.SANTA, rarity, 25); + addHat(Type.OMEGA, HatType.RUDOLPH, rarity, 25); + addHat(Type.OMEGA, HatType.COAL, rarity, 25); addGadget(Type.OMEGA, getGadget(MorphChicken.class), rarity, 50); addGadget(Type.OMEGA, getGadget(MorphCow.class), rarity, 167); @@ -384,6 +438,11 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(OutfitSpaceSuitHelmet.class), rarity, 50); addGadget(Type.OMEGA, getGadget(ParticleCandyCane.class), rarity, 25); + + // HAUNTED CHEST + addGadget(Type.HAUNTED, getGadget(DoubleJumpHalloween.class), rarity, 10); + addHat(Type.HAUNTED, HatType.PUMPKIN, rarity, 10); + addGadget(Type.HAUNTED, getGadget(ArrowTrailHalloween.class), rarity, 100); } public void addLegendary() @@ -451,7 +510,7 @@ public class RewardManager addGadget(Type.WINTER_HOLIDAY, getGadget(DeathFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(DoubleJumpFrostLord.class), rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(ParticleFrostLord.class), rarity, 5); - addHat(Type.WINTER_HOLIDAY, HatType.Grinch, rarity, 5); + addHat(Type.WINTER_HOLIDAY, HatType.GRINCH, rarity, 5); addGadget(Type.WINTER_HOLIDAY, getGadget(MorphSnowman.class), rarity, 5); addMount(Type.WINTER_HOLIDAY, getMount(MountBabyReindeer.class), rarity, 5); @@ -529,8 +588,13 @@ public class RewardManager addGadget(Type.OMEGA, getGadget(ArrowTrailFrostLord.class), rarity, 20); addGadget(Type.OMEGA, getGadget(ArrowTrailCupid.class), rarity, 15); - addHat(Type.OMEGA, HatType.Grinch, rarity, 25); - + addHat(Type.OMEGA, HatType.GRINCH, rarity, 25); + + // HAUNTED + addPetReward(Type.HAUNTED, EntityType.RABBIT, rarity, 100); + addGadget(Type.HAUNTED, getGadget(MorphGrimReaper.class), rarity, 25); + addGadget(Type.HAUNTED, getGadget(WinEffectHalloween.class), rarity, 50); + addMount(Type.HAUNTED, getMount(MountNightmareSteed.class), rarity, 60); } public UnknownPackageReward addMount(Type type, Mount mount, RewardRarity rarity, int weight) @@ -740,7 +804,8 @@ public class RewardManager public Reward[] getRewards(Player player, RewardPool.Type pool, RewardType type) { int amount = 4; - if(type == RewardType.IlluminatedChest || type == RewardType.FreedomChest || type == RewardType.OmegaChest) amount = 1; + if(type == RewardType.ILLUMINATED_CHEST || type == RewardType.FREEDOM_CHEST || type == RewardType.OMEGA_CHEST + || type == RewardType.HAUNTED_CHEST) amount = 1; int currentReward = 0; Reward[] rewards = new Reward[amount]; @@ -820,7 +885,7 @@ public class RewardManager //Dont give Rank Upgrade if already has Titan if (rarity == RewardRarity.MYTHICAL) { - if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) + if (canGiveMythical && type == RewardType.MYTHICAL_CHEST && !_clientManager.Get(player).GetRank().has(Rank.TITAN)) { return new RankReward(_clientManager, 0, 0, rarity); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java index 89c4ea9dc..2ccd852ab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardPool.java @@ -56,6 +56,7 @@ public class RewardPool ILLUMINATED(false), FREEDOM(false), OMEGA(false), + HAUNTED(false), CARL_SPINNER(true); private boolean _useDuplicates; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java index 0fd48d5a3..ecd9ab3a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/RewardType.java @@ -5,19 +5,20 @@ import java.util.ArrayList; public enum RewardType { //% Chances Mythic Legend Rare Uncommon - GameLoot( 0.000001, 0.00001, 0.0001, 3), + GAME_LOOT( 0.000001, 0.00001, 0.0001, 3), - OldChest( 0, 0.06, 0.8, 16), - AncientChest( 0, 2, 8, 32), - MythicalChest( 0.1, 4, 16, 72), - WinterChest( 0, 5, 18, 32), - IlluminatedChest( 0, 2, 16, 72), - FreedomChest( 0, 5, 18, 0), - OmegaChest( 0, 2, 16, 32), - ValentinesGift( 0, 7, 20, 20), + OLD_CHEST( 0, 0.06, 0.8, 16), + ANCIENT_CHEST( 0, 2, 8, 32), + MYTHICAL_CHEST( 0.1, 4, 16, 72), + WINTER_CHEST( 0, 5, 18, 32), + ILLUMINATED_CHEST( 0, 2, 16, 72), + FREEDOM_CHEST( 0, 5, 18, 0), + HAUNTED_CHEST( 0, 5, 18, 0), + OMEGA_CHEST( 0, 2, 16, 32), + VALENTINES_GIFT( 0, 7, 20, 20), - SpinnerFiller( 0.1, 1, 4, 20), - SpinnerReal( 0.000001, 0.05, 0.4, 5); + SPINNER_FILLER( 0.1, 1, 4, 20), + SPINNER_REAL( 0.000001, 0.05, 0.4, 5); private double _mythicalChance; private double _legendaryChance; @@ -50,7 +51,7 @@ public enum RewardType { int maxCount = Integer.MAX_VALUE; int openCount = 0; - RewardType type = RewardType.MythicalChest; + RewardType type = RewardType.MYTHICAL_CHEST; ArrayList data = new ArrayList(); for (RewardRarity rarity : RewardRarity.values()) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java index ac08ef75a..9dcb1f070 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/reward/rewards/RankReward.java @@ -34,9 +34,9 @@ public class RankReward extends Reward if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA; else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO; else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND; - else if (rewardType == RewardType.MythicalChest && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; + else if (rewardType == RewardType.MYTHICAL_CHEST && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN; - if (rewardType == RewardType.MythicalChest && _random.nextDouble() < 0.01) // 1 Percent + if (rewardType == RewardType.MYTHICAL_CHEST && _random.nextDouble() < 0.01) // 1 Percent rank = Rank.TITAN; if (rank == null) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java index bf7dacdce..9290244de 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/SalesPackageBase.java @@ -31,12 +31,12 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack public SalesPackageBase(String name, Material material, byte displayData, String[] description) { - this(name, material, (byte)0, description, 0); + this(name, material, displayData, description, 0); } public SalesPackageBase(String name, Material material, byte displayData, String[] description, int coins) { - this(name, material, (byte)0, description, coins, 1); + this(name, material, displayData, description, coins, 1); } public SalesPackageBase(String name, Material material, byte displayData, String[] description, int coins, int quantity) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java index 9bce0f192..b9155e39f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java @@ -1,10 +1,10 @@ package mineplex.core.slack; +import javax.net.ssl.HttpsURLConnection; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStream; import java.io.InputStreamReader; -import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; @@ -62,12 +62,12 @@ public class SlackAPI */ private String runWebCall(SlackTeam team, JsonObject call) { - HttpURLConnection connection = null; + HttpsURLConnection connection = null; try { // Create connection. URL url = new URL(team.getURL()); - connection = (HttpURLConnection) url.openConnection(); + connection = (HttpsURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setConnectTimeout(5000); connection.setUseCaches(false); @@ -83,6 +83,8 @@ public class SlackAPI dos.flush(); dos.close(); + int responseCode = connection.getResponseCode(); + // Receive response. InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java index ad0ce7de4..22bb1f2c2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java @@ -1,5 +1,7 @@ package mineplex.core.slack; +import java.net.URL; + import com.google.gson.JsonObject; /** @@ -9,6 +11,7 @@ public class SlackMessage { private String _username; private String _icon; + private URL _iconURL; private String _content; @@ -50,6 +53,20 @@ public class SlackMessage _content = content; } + /** + * Class constructor. + * + * @param username The username of the message. + * @param iconURL The icon url of the message. + * @param content The content of the message. + */ + public SlackMessage(String username, URL iconURL, String content) + { + _username = username; + _iconURL = iconURL; + _content = content; + } + /** * Converts the message to JSON format. * @@ -64,7 +81,11 @@ public class SlackMessage msg.addProperty("username", _username); } - if (_icon != null) + if (_iconURL != null) + { + msg.addProperty("icon_url", _iconURL.toString()); + } + else if (_icon != null) { msg.addProperty("icon_emoji", _icon); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java index 965346791..b1d913d5a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java @@ -6,7 +6,7 @@ package mineplex.core.slack; public enum SlackTeam { // Dev team - mineplex.slack.com - DEVELOPER("Mineplex Dev", "T045RUM7F", "B0VK6GFKN", "6GxwJsDfEpbVnQl8pYuEyq5T"), + DEVELOPER("Mineplex Dev", "T045RUM7F", "B2ED9B9Q9", "STwdq9LFar2Qt4H3JWyDK3Ow"), // QA team - mineplexqa.slack.com QA("Mineplex QA", "todo", "todo", "todo"), // TODO: new details diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index eee0c5fbe..7fb03ccb2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -1,8 +1,6 @@ package mineplex.core.treasure; -import java.awt.*; import java.util.*; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; import mineplex.core.blockrestore.BlockRestore; @@ -19,6 +17,7 @@ import mineplex.core.treasure.animation.*; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; import org.bukkit.Bukkit; +import org.bukkit.Color; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; @@ -176,6 +175,15 @@ public class Treasure block.getLocation().add(.5 + rX, .7, .5 + rX)); coloredParticle.display(); } + else if (_treasureType == TreasureType.HAUNTED) + { + int r = (int) (Math.random() * 2); + double rX = Math.random() * 2 - 1, rZ = Math.random() * 2 - 1; + ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.ORANGE : Color.BLACK), + block.getLocation().add(.5 + rX, .7, .5 + rZ)); + coloredParticle.display(); + } else { UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index bfacf8bb0..40f68c2ee 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -95,7 +95,7 @@ public class TreasureLocation implements Listener return; } - TreasureStartEvent event = new TreasureStartEvent(player); + TreasureStartEvent event = new TreasureStartEvent(player, treasureType); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) @@ -125,7 +125,8 @@ public class TreasureLocation implements Listener return; } - if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA) + if(treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.FREEDOM || treasureType == TreasureType.OMEGA + || treasureType == TreasureType.HAUNTED) { if(!_treasureManager.hasItemsToGivePlayer(treasureType.getRewardPool(), player)) { @@ -155,7 +156,8 @@ public class TreasureLocation implements Listener String pron = "a "; if (treasureType == TreasureType.ANCIENT || treasureType == TreasureType.ILLUMINATED || treasureType == TreasureType.OMEGA) pron = "an "; - Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + treasureType.getName())); + String name = treasureType.getName().replace("Chest", "Treasure"); + Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening " + pron + name)); } Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java index 54fdeaea6..81c1af8d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureStyle.java @@ -55,6 +55,13 @@ public enum TreasureStyle ParticleType.CRIT, Sound.FIRE, Sound.FIREWORK_TWINKLE + ), + HALLOWEEN( + ParticleType.RED_DUST, + ParticleType.RED_DUST, + ParticleType.RED_DUST, + Sound.IRONGOLEM_HIT, + Sound.IRONGOLEM_THROW ); private ParticleType _secondaryParticle; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java index 46751e601..2c66054f5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureType.java @@ -8,19 +8,21 @@ import mineplex.core.reward.RewardType; public enum TreasureType { - OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OldChest, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000), + OLD(C.cYellow + "Old Treasure", "Old Chest", "Old", RewardType.OLD_CHEST, Material.CHEST, TreasureStyle.OLD, RewardPool.Type.NORMAL, true, 1000), - ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.AncientChest, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000), + ANCIENT(C.cGold + "Ancient Treasure", "Ancient Chest", "Ancient", RewardType.ANCIENT_CHEST, Material.TRAPPED_CHEST, TreasureStyle.ANCIENT, RewardPool.Type.NORMAL, true, 5000), - MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MythicalChest, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000), + MYTHICAL(C.cRed + "Mythical Treasure", "Mythical Chest", "Mythical", RewardType.MYTHICAL_CHEST, Material.ENDER_CHEST, TreasureStyle.MYTHICAL, RewardPool.Type.NORMAL, true, 10000), - CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WinterChest, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), + CHRISTMAS(C.cDGreen + "Winter Holiday Treasure", "Winter Chest", "Christmas", RewardType.WINTER_CHEST, Material.CHEST, TreasureStyle.CHRISTMAS, RewardPool.Type.WINTER_HOLIDAY, false, 15000), - ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.IlluminatedChest, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000), + ILLUMINATED(C.cAqua + "Illuminated Treasure", "Illuminated Chest", "Illuminated", RewardType.ILLUMINATED_CHEST, Material.CHEST, TreasureStyle.ILLUMINATED, RewardPool.Type.ILLUMINATED, true, 20000), - FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FreedomChest, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000), + FREEDOM(C.cRed + "Freedom " + C.cBlue + "Treasure", "Freedom Treasure", "Freedom", RewardType.FREEDOM_CHEST, Material.CHEST, TreasureStyle.FREEDOM, RewardPool.Type.FREEDOM, true, 35000), - OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OmegaChest, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000); + OMEGA(C.cAqua + "Omega Chest", "Omega Chest", "Omega", RewardType.OMEGA_CHEST, Material.ENDER_CHEST, TreasureStyle.OMEGA, RewardPool.Type.OMEGA, false, 50000), + + HAUNTED(C.cGold + "Haunted Chest", "Haunted Chest", "Haunted", RewardType.HAUNTED_CHEST, Material.CHEST, TreasureStyle.HALLOWEEN, RewardPool.Type.HAUNTED, false, 100000); private final String _name; private final RewardType _rewardType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 64c41c636..182f7f136 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -75,6 +75,11 @@ public class BlockChangeAnimation extends Animation mat = Material.ENDER_STONE; data = 0; } + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + { + mat = Material.WOOL; + data = 1; + } else continue; @@ -107,6 +112,11 @@ public class BlockChangeAnimation extends Animation mat = Material.ENDER_STONE; data = 0; } + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + { + mat = Material.WOOL; + data = 15; + } else continue; @@ -139,15 +149,15 @@ public class BlockChangeAnimation extends Animation } } } - else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) { for(Block c : _chests) { if(c.equals(b)) { _blockInfoList.add(new BlockInfo(b)); - b.setType(Material.ENDER_PORTAL_FRAME); - b.setData((byte) 0); + b.setType(Material.PUMPKIN); + b.setData(getDirection(c)); } } } @@ -164,4 +174,26 @@ public class BlockChangeAnimation extends Animation { } + + private byte getDirection(Block block) + { + byte direction; + int relX = getTreasure().getCenterBlock().getX() - block.getX(); + int relZ = getTreasure().getCenterBlock().getZ() - block.getZ(); + if (Math.abs(relX) > Math.abs(relZ)) + { + if (relX > 0) + direction = (byte) 3; + else + direction = (byte) 1; + } + else + { + if (relZ > 0) + direction = (byte) 0; + else + direction = (byte) 2; + } + return direction; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java index 217059f36..eff9e7d70 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/ChestSpawnAnimation.java @@ -1,6 +1,5 @@ package mineplex.core.treasure.animation; -import java.awt.*; import java.util.List; import mineplex.core.common.util.*; @@ -14,6 +13,7 @@ import mineplex.core.treasure.Treasure; import mineplex.core.treasure.TreasureType; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.MathHelper; +import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; @@ -42,6 +42,7 @@ public class ChestSpawnAnimation extends Animation private int _babyFireworks = 0; private int _circleAmount = 0; + private int _currentHauntedColor = 0; public ChestSpawnAnimation(Treasure treasure, Block block, List chestBlockInfo, Block openingCenter, double radialOffset, JavaPlugin javaPlugin) { @@ -175,6 +176,27 @@ public class ChestSpawnAnimation extends Animation _circleAmount++; } + else if (getTreasure().getTreasureType() == TreasureType.HAUNTED) + { + float x = (float) (Math.sin(getTicks()/4D)); + float z = (float) (Math.cos(getTicks()/4D)); + + Location newLoc = _particleLocation.clone(); + newLoc.add(UtilAlg.getLeft(_particleDirection).multiply(x * scale)); + newLoc.add(UtilAlg.getUp(_particleDirection).multiply(z * scale)); + + Color color = (_currentHauntedColor == 0) ? Color.ORANGE : Color.BLACK; + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, new DustSpellColor(color), newLoc); + coloredParticle.display(); + if (_currentHauntedColor == 0) + { + _currentHauntedColor = 1; + } + else + { + _currentHauntedColor = 0; + } + } //Spawn Chest if (getTicks() >= ANIMATION_DURATION) @@ -201,12 +223,12 @@ public class ChestSpawnAnimation extends Animation if (particleType != null) { - if (getTreasure().getTreasureType() != TreasureType.FREEDOM) + if (getTreasure().getTreasureType() != TreasureType.FREEDOM && getTreasure().getTreasureType() != TreasureType.HAUNTED) { UtilParticle.PlayParticle(particleType, _centerLocation, 0.2f, 0.2f, 0.2f, 0, 50, ViewDist.NORMAL, UtilServer.getPlayers()); } - else + else if (getTreasure().getTreasureType() == TreasureType.FREEDOM) { int r = (int) (Math.random() * 3); ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, @@ -214,6 +236,14 @@ public class ChestSpawnAnimation extends Animation _centerLocation.clone().add(.5, .5, .5)); coloredParticle.display(); } + else + { + int r = (int) (Math.random() * 2); + ColoredParticle coloredParticle = new ColoredParticle(ParticleType.RED_DUST, + new DustSpellColor((r == 0) ? Color.ORANGE : Color.BLACK), + _centerLocation.clone().add(.5, .5, .5)); + coloredParticle.display(); + } } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java index 528344c75..0c541f079 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/event/TreasureStartEvent.java @@ -1,5 +1,6 @@ package mineplex.core.treasure.event; +import mineplex.core.treasure.TreasureType; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; @@ -13,11 +14,13 @@ public class TreasureStartEvent extends Event implements Cancellable private static final HandlerList handlers = new HandlerList(); private Player _player; + private TreasureType _treasureType; private boolean _cancelled = false; - public TreasureStartEvent(Player player) + public TreasureStartEvent(Player player, TreasureType treasureType) { _player = player; + _treasureType = treasureType; } public Player getPlayer() @@ -25,6 +28,11 @@ public class TreasureStartEvent extends Event implements Cancellable return _player; } + public TreasureType getTreasureType() + { + return _treasureType; + } + @Override public boolean isCancelled() { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java index 1815e7b15..9256bc7a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/BuyChestButton.java @@ -60,7 +60,8 @@ public class BuyChestButton implements IButton } } if (!_page.getPlugin().hasItemsToGivePlayer(_chestType.getRewardPool(), player) - && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA)) + && (_chestType == TreasureType.ILLUMINATED || _chestType == TreasureType.OMEGA + || _chestType == TreasureType.HAUNTED)) { player.sendMessage(F.main("Treasure", "You seem to have all treasures for this chest unlocked already!")); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java index 8d23c05d5..0b1aef8e6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/gui/TreasurePage.java @@ -25,7 +25,6 @@ import mineplex.core.treasure.TreasureLocation; import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureType; import org.bukkit.ChatColor; -import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -59,6 +58,7 @@ public class TreasurePage extends ShopPageBase int illuminatedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ILLUMINATED.getItemName()); int freedomCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.FREEDOM.getItemName()); int omegaCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OMEGA.getItemName()); + int hauntedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.HAUNTED.getItemName()); List shardLore = new ArrayList<>(); shardLore.add(" "); @@ -192,6 +192,19 @@ public class TreasurePage extends ShopPageBase } + List hauntedLore = new ArrayList<>(); + hauntedLore.add(" "); + hauntedLore.add(F.value("Haunted Chests Owned", "" + hauntedCount)); + hauntedLore.add(" "); + hauntedLore.add(C.cGray + "The Haunted Chest can only be found"); + hauntedLore.add(C.cGray + "during the month of October when the"); + hauntedLore.add(C.cGray + "veil between this world and the shadow is thin..."); + hauntedLore.add(" "); + if (hauntedCount > 0) + { + hauntedLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); + } + ShopItem shards = new ShopItem(Material.PRISMARINE_SHARD, C.cAqua + C.Bold + treasureShards + " Treasure Shards", shardLore.toArray(new String[0]), 0, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Treasure", basicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Treasure", heroicLore.toArray(new String[0]), 0, false, false); @@ -199,39 +212,23 @@ public class TreasurePage extends ShopPageBase ItemStack christmas = SkinData.PRESENT.getSkull(C.cDGreen + C.Bold + "Winter Holiday Treasure", christmasLore); ItemStack illuminated = new ShopItem(Material.SEA_LANTERN, C.cDAqua + C.Bold + "Illuminated Treasure", illuminatedLore.toArray(new String[0]), 0, false, false); ItemStack freedom = SkinData.FREEDOM_CHEST.getSkull(C.cRedB + "Freedom " + C.cBlueB + "Treasure", freedomLore); - //ShopItem omega = new ShopItem(Material.NETHER_STAR, C.cAquaB + "Omega Treasure", omegaLore.toArray(new String[0]), 0, false, false); ItemStack omega = SkinData.OMEGA_CHEST.getSkull(C.cAquaB + "Omega Treasure", omegaLore); + ItemStack haunted = SkinData.HAUNTED_CHEST.getSkull(C.cGoldB + "Haunted Treasure", hauntedLore); - addItem(40, shards); + addItem(49, shards); - addChest(11, christmas, TreasureType.CHRISTMAS, christmasCount); - if (!hasAllFreedomItems(getPlayer()) && freedomCount >= 1) - addChest(13, freedom, TreasureType.FREEDOM, freedomCount); - else - { - freedom = new ShopItem(Material.INK_SACK, DyeColor.SILVER.getData(), C.cRed + C.Bold + "Freedom " + C.cBlue + C.Bold + "Treasure", freedomLore.toArray(new String[0]), 0, true, false); - addChest(13, freedom, TreasureType.FREEDOM, freedomCount); - } - addChest(15, illuminated, TreasureType.ILLUMINATED, illuminatedCount); - addChest(20, basic, TreasureType.OLD, basicCount); - addChest(22, heroic, TreasureType.ANCIENT, heroicCount); - addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount); - addChest(4, omega, TreasureType.OMEGA, omegaCount); + addChest(10, christmas, TreasureType.CHRISTMAS, christmasCount); + addChest(12, freedom, TreasureType.FREEDOM, freedomCount); + addChest(14, haunted, TreasureType.HAUNTED, hauntedCount); + addChest(16, omega, TreasureType.OMEGA, omegaCount); + addChest(28, basic, TreasureType.OLD, basicCount); + addChest(30, heroic, TreasureType.ANCIENT, heroicCount); + addChest(32, legendary, TreasureType.MYTHICAL, legendaryCount); + addChest(34, illuminated, TreasureType.ILLUMINATED, illuminatedCount); } private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned) { - //boolean testServer = getPlugin().getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"); - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - //testServer = false; - // COIN TEST PURPOSES, WHEN RELEASED, COMMENT THIS LINE! - - /*if(testServer) - { - addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); - return; - }*/ - if (owned > 0) { addButton(slot, item, new OpenTreasureButton(getPlayer(), _treasureLocation, treasureType)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java index 82ef1ef9d..042c141a0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/valentines/ValentinesGiftManager.java @@ -85,14 +85,14 @@ public class ValentinesGiftManager extends MiniPlugin { if (data) { - _rewardManager.nextReward(to, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, to, new Callback() + _rewardManager.nextReward(to, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.VALENTINES_GIFT, false).giveReward(RewardType.VALENTINES_GIFT, to, new Callback() { @Override public void run(RewardData toData) { String toGift = ChatColor.stripColor(toData.getFriendlyName()); - _rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.ValentinesGift, false).giveReward(RewardType.ValentinesGift, from, new Callback() + _rewardManager.nextReward(from, RewardPool.Type.VALENTINES_GIFT, null, false, RewardType.VALENTINES_GIFT, false).giveReward(RewardType.VALENTINES_GIFT, from, new Callback() { @Override public void run(RewardData fromData) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 18235a673..b7f9cc73b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -112,7 +112,7 @@ import java.util.*; public class HubManager extends MiniClientPlugin implements IChatMessageFormatter { // ☃❅ Snowman! - public HubType Type = HubType.Normal; + public HubType Type = HubType.Halloween; private BlockRestore _blockRestore; private CoreClientManager _clientManager; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java index 6fa903565..3ce5c8664 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/HolidayGiftManager.java @@ -80,7 +80,7 @@ public class HolidayGiftManager extends MiniPlugin { Reward reward = _rewards.generateRandom(); - reward.giveReward(RewardType.GameLoot, event.getPlayer(), rewardData -> { + reward.giveReward(RewardType.GAME_LOOT, event.getPlayer(), rewardData -> { UtilPlayer.message(event.getPlayer(), F.main("Gift", F.elem(colorLess) + " searches for your gift...")); UtilPlayer.message(event.getPlayer(), F.main("Gift", "You received " + rewardData.getFriendlyName() + C.mBody + "!")); }); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java index 106e9a9c8..9e6730cb8 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java @@ -1,5 +1,16 @@ package mineplex.hub.modules; +import java.util.HashSet; + +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + import mineplex.core.MiniPlugin; import mineplex.core.common.Rank; import mineplex.core.common.util.UtilAction; @@ -16,16 +27,6 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; -import org.bukkit.Effect; -import org.bukkit.GameMode; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.util.Vector; - -import java.util.HashSet; public class JumpManager extends MiniPlugin { @@ -47,6 +48,9 @@ public class JumpManager extends MiniPlugin if (player.getGameMode() == GameMode.CREATIVE) return; + if (player.isFlying()) + return; + Rank rank = Manager.GetClients().Get(player).GetRank(); if (Manager.getPreferences().get(player).isActive(Preference.INVISIBILITY) && (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 760bb8eba..c6b639b22 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -1,25 +1,7 @@ package mineplex.hub.modules; -import mineplex.core.Managers; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.event.StackerEvent; -import mineplex.core.gadget.gadgets.item.ItemBatGun; -import mineplex.core.gadget.gadgets.morph.MorphBlock; -import mineplex.core.gadget.types.GadgetType; -import mineplex.core.pet.PetManager; -import mineplex.core.projectile.IThrown; -import mineplex.core.projectile.ProjectileManager; -import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.hub.HubManager; +import java.util.HashSet; + import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; @@ -42,7 +24,27 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; -import java.util.HashSet; +import mineplex.core.Managers; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.event.StackerEvent; +import mineplex.core.gadget.gadgets.item.ItemBatGun; +import mineplex.core.gadget.gadgets.morph.MorphBlock; +import mineplex.core.gadget.gadgets.morph.MorphGrimReaper; +import mineplex.core.gadget.types.GadgetType; +import mineplex.core.pet.PetManager; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileManager; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.hub.HubManager; public class StackerManager extends MiniPlugin implements IThrown { @@ -133,6 +135,14 @@ public class StackerManager extends MiniPlugin implements IThrown return; } + if (Manager.GetGadget().getActive(stacker, GadgetType.MORPH) instanceof MorphGrimReaper) + { + if (stacker.getItemInHand().getType() == Material.WOOD_HOE) + { + return; + } + } + if (Manager.GetTreasure().isOpening(stacker)) return; @@ -314,8 +324,6 @@ public class StackerManager extends MiniPlugin implements IThrown if (!Manager.hasPlayerStackingEnabled(target)) return; - System.out.println("Stacker collide."); - //Velocity UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.getThrown(), target), 1, true, 0.8, 0, 10, true); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java index 8109e3ef2..de8724fa6 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/Condition.java @@ -1,12 +1,12 @@ package mineplex.minecraft.game.core.condition; -import org.bukkit.Bukkit; +import mineplex.core.events.AddConditionEvent; +import net.minecraft.server.v1_8_R3.MobEffect; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.entity.LivingEntity; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; -import net.minecraft.server.v1_8_R3.MobEffect; public class Condition { @@ -47,7 +47,8 @@ public class Condition SPEED, WATER_BREATHING, WEAKNESS, - WITHER + WITHER; + } protected ConditionManager Manager; @@ -133,6 +134,14 @@ public class Condition _live = !add; } + public Condition(ConditionManager manager, AddConditionEvent event) + { + + this(manager, event.getReason(), event.getEnt(), event.getSource(), ConditionType.valueOf(event.getType().name()), + event.getMult(), event.getTicks(), event.isAdd(), event.getIndicatorType(), event.getIndicatorData(), + event.isShowIndicator(), event.isAmbient(), event.isCancelPotion()); + } + public boolean Tick() { if (_live && _ticks > 0) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index d18740a49..cef1030bf 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Locale; import java.util.UUID; +import mineplex.core.Managers; import mineplex.core.powerplayclub.PowerPlayData; import org.bukkit.GameMode; import org.bukkit.entity.Player; @@ -36,8 +37,21 @@ import mineplex.core.donation.Donor; import mineplex.core.donation.repository.token.CoinTransactionToken; import mineplex.core.donation.repository.token.TransactionToken; import mineplex.core.powerplayclub.PowerPlayClubRepository; +import mineplex.core.stats.PlayerStats; +import mineplex.core.stats.StatsManager; import mineplex.serverdata.database.ResultSetCallable; import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.GameMode; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.FoodLevelChangeEvent; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.java.JavaPlugin; public class CustomerSupport extends MiniPlugin implements ResultSetCallable { @@ -146,6 +160,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int runeAmplifier20 = 0; int runeAmplifier60 = 0; int omegaChestsReceived = 0; + int hauntedChestsReceived = 0; + int hauntedChestsOpened = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -234,6 +250,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable omegaChestsReceived += 1; } + } + if (transaction.SalesPackageName.startsWith("Haunted Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + omegaChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + omegaChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { @@ -278,6 +305,22 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable } } + StatsManager statsManager = Managers.get(StatsManager.class); + if (statsManager != null) + { + try + { + PlayerStats playerStats = statsManager.getOfflinePlayerStats(playerName); + if (playerStats != null) + { + hauntedChestsOpened = (int) playerStats.getStat("Global.Treasure.Haunted"); + } + } catch (SQLException e) + { + e.printStackTrace(); + } + } + // Strutt20 asked me to remove some stuff from the menu caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived); caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived); @@ -285,6 +328,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived); caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived); caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived); + caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived); + caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20); caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 0a2e61f8d..897af4562 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -1,5 +1,6 @@ package mineplex.staffServer.salespackage; +import mineplex.staffServer.salespackage.salespackages.*; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -13,24 +14,6 @@ import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.stats.StatsManager; import mineplex.staffServer.salespackage.command.DisplayPackageCommand; import mineplex.staffServer.salespackage.command.Sales; -import mineplex.staffServer.salespackage.salespackages.AncientChest; -import mineplex.staffServer.salespackage.salespackages.ApplyKits; -import mineplex.staffServer.salespackage.salespackages.ClanBannerEditor; -import mineplex.staffServer.salespackage.salespackages.ClanBannerUsage; -import mineplex.staffServer.salespackage.salespackages.Coins; -import mineplex.staffServer.salespackage.salespackages.DefaultRank; -import mineplex.staffServer.salespackage.salespackages.FreedomChest; -import mineplex.staffServer.salespackage.salespackages.IlluminatedChest; -import mineplex.staffServer.salespackage.salespackages.LifetimeHero; -import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; -import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; -import mineplex.staffServer.salespackage.salespackages.LifetimeUltra; -import mineplex.staffServer.salespackage.salespackages.MythicalChest; -import mineplex.staffServer.salespackage.salespackages.OldChest; -import mineplex.staffServer.salespackage.salespackages.OmegaChest; -import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; -import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; -import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; public class SalesPackageManager extends MiniPlugin { @@ -81,6 +64,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new PowerPlayClub(this, false)); AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new OmegaChest(this)); + AddSalesPackage(new HauntedChest(this)); } private void AddSalesPackage(SalesPackageBase salesPackage) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java new file mode 100644 index 000000000..acc9e802e --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/HauntedChest.java @@ -0,0 +1,19 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class HauntedChest extends SalesPackageBase +{ + public HauntedChest(SalesPackageManager manager) + { + super(manager, "1 Haunted Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Haunted Chest", "Give 1 Haunted Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 0b5f9ad30..58c49294b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -1,5 +1,40 @@ package nautilus.game.arcade; +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; + +import net.minecraft.server.v1_8_R3.EntityLiving; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.OfflinePlayer; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockBurnEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.LeavesDecayEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.server.ServerListPingEvent; +import org.bukkit.potion.PotionEffect; +import org.bukkit.scoreboard.Team; +import org.bukkit.util.Vector; + import mineplex.core.Managers; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClient; @@ -30,6 +65,8 @@ import mineplex.core.donation.DonationManager; import mineplex.core.elo.EloManager; import mineplex.core.energy.Energy; import mineplex.core.event.JoinMessageBroadcastEvent; +import mineplex.core.events.AddConditionEvent; +import mineplex.core.events.EnableArcadeSpawnEvent; import mineplex.core.explosion.Explosion; import mineplex.core.explosion.ExplosionEvent; import mineplex.core.facebook.FacebookManager; @@ -77,10 +114,12 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.core.IRelation; +import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; import mineplex.serverdata.Region; + import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.TeamArmorAddon; import nautilus.game.arcade.addons.compass.CompassAddon; @@ -115,6 +154,7 @@ import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTestingManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; +import nautilus.game.arcade.managers.HolidayManager; import nautilus.game.arcade.managers.IdleManager; import nautilus.game.arcade.managers.MiscManager; import nautilus.game.arcade.managers.NextBestGameManager; @@ -126,39 +166,6 @@ import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager; import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager; import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.shop.ArcadeShop; -import net.minecraft.server.v1_8_R3.EntityLiving; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.block.BlockBurnEvent; -import org.bukkit.event.block.BlockFadeEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.block.LeavesDecayEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerLoginEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.server.ServerListPingEvent; -import org.bukkit.potion.PotionEffect; -import org.bukkit.scoreboard.Team; -import org.bukkit.util.Vector; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; public class ArcadeManager extends MiniPlugin implements IRelation { @@ -337,7 +344,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _hologramManager = hologramManager; _idleManager = new IdleManager(this); TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager); - // new HolidayManager(this, titanGiveaway); + new HolidayManager(this, titanGiveaway); new ValentinesGiftManager(plugin, clientManager, _bonusManager.getRewardManager(), inventoryManager, _cosmeticManager.getGadgetManager(), statsManager); new GameTestingManager(this); require(PlayerDisguiseManager.class); @@ -1977,6 +1984,29 @@ public class ArcadeManager extends MiniPlugin implements IRelation } } + /** + * Allows mob spawning from core + * @param event + */ + @EventHandler + public void onEnableArcadeSpawn(EnableArcadeSpawnEvent event) + { + if (_game != null) + { + _game.CreatureAllowOverride = event.canEnable(); + } + } + + /** + * Allows adding a condition from another modules + * @param event + */ + @EventHandler + public void onAddCondition(AddConditionEvent event) + { + _conditionManager.AddCondition(new Condition(_conditionManager, event)); + } + public ProgressingKitManager getProgressionKitManager() { return _progressionKitManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java index 91d05aef2..51df05364 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/typewars/Minion.java @@ -290,7 +290,7 @@ public class Minion if(disguise instanceof DisguiseZombie && i > 0) { DisguiseZombie zombie = (DisguiseZombie) disguise; - zombie.SetBaby(true); + zombie.setBaby(true); } if(disguise instanceof DisguiseSlime) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index 9a782a159..48ddb346b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -158,8 +158,8 @@ public class GameLootManager implements Listener return false; } - final Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true); - reward.giveReward(RewardType.GameLoot, player, new Callback() + final Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GAME_LOOT, true); + reward.giveReward(RewardType.GAME_LOOT, player, new Callback() { @Override public void run(RewardData rewardData) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java index 2328f93dc..89e04c909 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/HolidayManager.java @@ -1,22 +1,20 @@ package nautilus.game.arcade.managers; +import java.util.EnumMap; import java.util.HashSet; import java.util.Iterator; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.*; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilParticle; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; -import mineplex.core.common.util.UtilTime; -import mineplex.core.common.util.UtilWorld; +import mineplex.core.gadget.gadgets.particle.unrelated.HalloweenSmashedEffect; +import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.titangiveaway.TitanGiveawayAnimation; +import mineplex.core.reward.RewardPool; +import mineplex.core.reward.RewardRarity; import mineplex.core.titangiveaway.TitanGiveawayManager; +import mineplex.core.treasure.TreasureType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -25,27 +23,17 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game.GameState; import net.minecraft.server.v1_8_R3.BlockPosition; import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction; -import net.minecraft.server.v1_8_R3.TileEntity; -import net.minecraft.server.v1_8_R3.TileEntityEnderChest; - -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Sound; +import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; public class HolidayManager implements Listener @@ -83,8 +71,8 @@ public class HolidayManager implements Listener } } - private HolidayType type = HolidayType.Christmas; - private String _statName = "Christmas Presents 2015"; + private HolidayType type = HolidayType.Halloween; + private String _statName = "Halloween 2016"; ArcadeManager Manager; private TitanGiveawayManager _titanManager; @@ -96,13 +84,23 @@ public class HolidayManager implements Listener private HashSet _coins = new HashSet(); private HashSet _gems = new HashSet(); + private static final double CHEST_CHANCE = 0.001; + public long _lastSpawn = System.currentTimeMillis(); + private EnumMap _rewardPools; + public HolidayManager(ArcadeManager manager, TitanGiveawayManager titanManager) { Manager = manager; _titanManager = titanManager; + _rewardPools = new EnumMap<>(RewardPool.Type.class); + for (RewardPool.Type type : RewardPool.Type.values()) + { + _rewardPools.put(type, new RewardPool()); + } + Manager.getPluginManager().registerEvents(this, Manager.getPlugin()); } @@ -327,7 +325,7 @@ public class HolidayManager implements Listener for (int i=0 ; i < 4 + Math.random()*8 ; i++) { Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5), - ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin")); + ItemStackFactory.Instance.CreateStack(Material.PRISMARINE_SHARD, (byte)0, 1, UtilMath.r(999999) + "Coin")); Vector vel = new Vector( (Math.random() - 0.5) * 0.5, @@ -358,7 +356,7 @@ public class HolidayManager implements Listener _gems.add(gem); } - + /* // Titan Giveaway if (player != null) { @@ -371,6 +369,35 @@ public class HolidayManager implements Listener new TitanGiveawayAnimation(_titanManager, location, 3000L); } }); + }*/ + + if (player != null) + { + InventoryManager manager = Manager.getInventoryManager(); + double rand = UtilMath.random.nextDouble(); + if (rand < CHEST_CHANCE) + { + if (hasItemsToGivePlayer(TreasureType.HAUNTED.getRewardPool(), player)) + { + FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) + .withColor(Color.ORANGE).withColor(Color.BLACK).withFade(Color.ORANGE) + .withFade(Color.BLACK).flicker(true).build(); + manager.addItemToInventory(player, "Haunted Chest", 1); + HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() + .add(.5, .5, .5), fireworkEffect, Manager.getPlugin()); + halloweenSmashedEffect.start(); + } + else + { + FireworkEffect fireworkEffect = FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE) + .withColor(Color.AQUA).withColor(Color.BLACK).withFade(Color.AQUA) + .withFade(Color.BLACK).flicker(true).build(); + manager.addItemToInventory(player, "Omega Chest", 1); + HalloweenSmashedEffect halloweenSmashedEffect = new HalloweenSmashedEffect(block.getLocation() + .add(.5, .5, .5), fireworkEffect, Manager.getPlugin()); + halloweenSmashedEffect.start(); + } + } } //Effect @@ -462,4 +489,14 @@ public class HolidayManager implements Listener spawnSpecialBlock(event.getPlayer().getLocation().getBlock()); } } + + public boolean hasItemsToGivePlayer(RewardPool.Type pool, Player player) + { + for(RewardRarity rarity : new RewardRarity[]{ + RewardRarity.COMMON, RewardRarity.MYTHICAL, RewardRarity.LEGENDARY, RewardRarity.RARE, RewardRarity.UNCOMMON}) + { + if(_rewardPools.get(pool).hasItemsToGive(rarity, player)) return true; + } + return false; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java index 35362f78f..7827eb64f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/wineffect/WinEffectManager.java @@ -32,7 +32,7 @@ public class WinEffectManager public void playWinEffect(Location loc) { - prepareSetup(loc); + buildWinnerRoom(loc); UtilEnt.getAllInRadius(loc, 20).keySet().stream().filter(e-> !(e instanceof Player)).forEach(e->e.remove()); _game.CreatureAllowOverride = true; for(Player p : UtilServer.getPlayers()) @@ -43,14 +43,10 @@ public class WinEffectManager playEffect(); } - public void prepareSetup(Location loc) { - buildWinnerRoom(loc); - } - - protected void buildWinnerRoom(Location loc) + protected void buildWinnerRoom(Location loc) { - _game.WorldTimeSet = 12000; WinEffectGadget effect = getWinEffect(); + _game.WorldTimeSet = effect.getGameTime(); effect.setup(_winner, _team, _nonTeam, loc); effect.buildWinnerRoom(); } From e6bb0c2d7868a15df7f4cef1232b8c3cfc6e3504 Mon Sep 17 00:00:00 2001 From: Keir Nellyer Date: Wed, 5 Oct 2016 15:31:46 +0100 Subject: [PATCH 19/30] Improve handling of circumstances whereby a report exists but no corresponding chatsnap log on chatsnap site --- Plugins/Mineplex.ReportSite/view.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.ReportSite/view.php b/Plugins/Mineplex.ReportSite/view.php index 8e7d50d1a..846d901f1 100644 --- a/Plugins/Mineplex.ReportSite/view.php +++ b/Plugins/Mineplex.ReportSite/view.php @@ -356,12 +356,13 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id } $validId = isset($_GET['id']); - $idError = ""; + $errorMsg = ""; $id = null; $expanded = null; $report = null; $snapshot = null; + $messages = null; if ($validId) { @@ -372,11 +373,20 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id if ($report) { $snapshot = $report->getSnapshot(); + + if ($snapshot != null) + { + $messages = $snapshot->getMessages(); + } + else + { + $errorMsg = 'No associated snapshot found for report.'; + } } else { $validId = false; - $idError = "Invalid id."; + $errorMsg = "Invalid id."; } } ?> @@ -415,12 +425,15 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id - +

What did you do?!?!?

-

Error:

-
+ + +

Error:

+
+
@@ -440,9 +453,6 @@ WHERE snapshotMessageMap.snapshotId = snapshots.id
getMessages(); $messageCount = count($messages); $displayAmount = $expanded || $messageCount <= collapsedMessageCount ? $messageCount : collapsedMessageCount; From 49510e6f9f5cf1cc846d021e9b8bed4321896265 Mon Sep 17 00:00:00 2001 From: Lucas de Castro Queiroz Date: Wed, 5 Oct 2016 16:21:40 -0300 Subject: [PATCH 20/30] Fixed memory leak on ArrowTrailHalloween, thanks to Sam, again --- .../core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java index f9d03dd03..26723da8e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java @@ -50,7 +50,10 @@ public class ArrowTrailHalloween extends ArrowEffectGadget @Override public void doHitEffect(Arrow arrow) { - + if (_arrowColors.containsKey(arrow)) + { + _arrowColors.remove(arrow); + } } } From dae3c60247d6f64073163ae6c5d1fdd8c5cde3e9 Mon Sep 17 00:00:00 2001 From: Alexander Meech Date: Wed, 5 Oct 2016 17:13:32 -0400 Subject: [PATCH 21/30] Make support text for power play claims more accurate (#228) * Make support text for power play claims more... ...accurate * Reverse text --- .../mineplex/staffServer/customerSupport/CustomerSupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index cef1030bf..729aac91a 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -350,7 +350,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor")); caller.sendMessage(C.cDGreen + C.Strike + "============================================="); caller.sendMessage(C.cBlue + "Power Play Subscription (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlaySub ? C.cGreen + "Active" : C.cRed + "Inactive")); - caller.sendMessage(C.cBlue + "Power Play Monthly Reward (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlayClaim ? C.cGreen + "Claimed" : C.cRed + "Unclaimed")); + caller.sendMessage(C.cBlue + "Power Play Monthly Reward (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlayClaim ? C.cRed + "Unavailable" : C.cGreen + "Available")); _accountBonusLog.remove(client.getAccountId()); } From 876d35b482a7dcdf11d8a220c5d237862a730c9d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Oct 2016 18:16:25 -0300 Subject: [PATCH 22/30] Cosmetics Bug Fixes (#229) * Fixes for the Block Morph * Fixes for the Witch Morph * Fixed memory leak on ArrowTrailHalloween, thanks to Sam, again --- .../core/cosmetic/ui/page/GadgetPage.java | 6 ---- .../core/cosmetic/ui/page/MorphPage.java | 13 ++++---- .../arrowtrail/ArrowTrailHalloween.java | 5 ++- .../core/gadget/gadgets/morph/MorphWitch.java | 31 +++++++++++++------ .../core/treasure/TreasureManager.java | 20 +++++++++--- 5 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java index d39c1e64b..9a7030ed7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/GadgetPage.java @@ -18,7 +18,6 @@ import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetChangeEvent; -import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphWitch; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; @@ -76,11 +75,6 @@ public class GadgetPage extends ShopPageBase protected void addGadget(Gadget gadget, int slot) { - if (gadget instanceof MorphBlock) - { - if (getPlayer().getPassenger() != null) - return; - } List itemLore = new ArrayList(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java index 0d7daaafb..291921cd4 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/cosmetic/ui/page/MorphPage.java @@ -1,18 +1,18 @@ package mineplex.core.cosmetic.ui.page; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; - import mineplex.core.account.CoreClientManager; import mineplex.core.common.util.C; import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.donation.DonationManager; +import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; -import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.IButton; +import mineplex.core.shop.item.ShopItem; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; public class MorphPage extends GadgetPage { @@ -31,7 +31,8 @@ public class MorphPage extends GadgetPage addGadget(gadget, slot); if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget) - addGlow(slot); + if (!(gadget instanceof MorphBlock)) + addGlow(slot); slot++; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java index f9d03dd03..26723da8e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/arrowtrail/ArrowTrailHalloween.java @@ -50,7 +50,10 @@ public class ArrowTrailHalloween extends ArrowEffectGadget @Override public void doHitEffect(Arrow arrow) { - + if (_arrowColors.containsKey(arrow)) + { + _arrowColors.remove(arrow); + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java index 70f8e22ab..3b457ee01 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphWitch.java @@ -1,14 +1,5 @@ package mineplex.core.gadget.gadgets.morph; -import mineplex.core.common.skin.SkinData; -import mineplex.core.common.util.*; -import mineplex.core.disguise.disguises.DisguiseWitch; -import mineplex.core.gadget.GadgetManager; -import mineplex.core.gadget.event.GadgetSelectLocationEvent; -import mineplex.core.gadget.types.MorphGadget; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; @@ -17,6 +8,20 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguiseWitch; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; + public class MorphWitch extends MorphGadget { @@ -97,6 +102,14 @@ public class MorphWitch extends MorphGadget UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!")); return; } + for (Location blockLocation : Manager.getTreasureManager().getBlockLocations()) + { + if (blockLocation.distanceSquared(cauldronLocation) <= 25) + { + UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!")); + return; + } + } } // Checks if the player is close to a cactus diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java index a63dc4b6f..01c4b1e54 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureManager.java @@ -2,7 +2,14 @@ package mineplex.core.treasure; import java.util.List; +import org.bukkit.Location; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.plugin.java.JavaPlugin; + import com.google.common.collect.Lists; + import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; @@ -18,11 +25,6 @@ import mineplex.core.reward.RewardPool; import mineplex.core.reward.RewardType; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.HandlerList; -import org.bukkit.plugin.java.JavaPlugin; /** * Created by Shaun on 8/27/2014. @@ -36,6 +38,7 @@ public class TreasureManager extends MiniPlugin private HologramManager _hologramManager; private StatsManager _statsManager; private List _treasureLocations; + private List _blockLocations; public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, GadgetManager gadgetManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager, RewardManager rewardManager) { @@ -49,11 +52,13 @@ public class TreasureManager extends MiniPlugin _rewardManager = rewardManager; _treasureLocations = Lists.newArrayList(); + _blockLocations = Lists.newArrayList(); for(Location location : LocationConstants.CHEST_LOCATIONS) { Location resetLocation = LocationConstants.getResetLocation(location); Block[] blocks = setup(location.getBlock()); + _blockLocations.add(location); _treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, location.getBlock(), blocks, resetLocation, _hologramManager, gadgetManager, statusManager)); } @@ -151,4 +156,9 @@ public class TreasureManager extends MiniPlugin { return _treasureLocations; } + + public List getBlockLocations() + { + return _blockLocations; + } } From 5939c304a55ac06415f1f976538962b432b48a49 Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Oct 2016 20:13:30 -0300 Subject: [PATCH 23/30] Added option to run /unlockcosmetics and /lockcosmetics for other players --- .../gadget/commands/LockCosmeticsCommand.java | 33 ++++------------ .../commands/UnlockCosmeticsCommand.java | 39 +++++-------------- 2 files changed, 17 insertions(+), 55 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index c957b8da4..e726517a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -11,6 +11,8 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.pet.Pet; + +import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase @@ -32,36 +34,15 @@ public class LockCosmeticsCommand extends CommandBase { removeCosmetics(null, caller); } - // Adds specific type - else + else if (args.length == 1) { - String type = args[0]; - if (type.equalsIgnoreCase("all")) + Player player = Bukkit.getPlayer(args[0]); + if (player != null) { - removeCosmetics(null, caller); - } - else if (type.equalsIgnoreCase("pet")) - { - removePets(caller); - } - else if (type.equalsIgnoreCase("mount")) - { - removeMounts(caller); - } - else - { - GadgetType gadgetType = GadgetType.valueOf(type); - if (gadgetType == null) - { - UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); - } - else - { - removeCosmetics(gadgetType, caller); - } + removeCosmetics(null, player); + UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Removed all the cosmetics to " + F.name(player.getName()) + "!")); } } - } private void removeCosmetics(GadgetType gadgetType, Player caller) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index c24411ebd..f1867e009 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -11,6 +11,8 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.pet.Pet; + +import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class UnlockCosmeticsCommand extends CommandBase @@ -32,37 +34,16 @@ public class UnlockCosmeticsCommand extends CommandBase { addCosmetics(null, caller); } - // Adds specific type - else - { - String type = args[0]; - if (type.equalsIgnoreCase("all")) - { - addCosmetics(null, caller); - } - else if (type.equalsIgnoreCase("pet")) + else if (args.length == 1) + { + Player player = Bukkit.getPlayer(args[0]); + if (player != null) { - addPets(caller); + addCosmetics(null, player); + UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!")); } - else if (type.equalsIgnoreCase("mount")) - { - addMounts(caller); - } - else - { - GadgetType gadgetType = GadgetType.valueOf(type); - if (gadgetType == null) - { - UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); - } - else - { - addCosmetics(gadgetType, caller); - } - } - } - - } + } + } private void addCosmetics(GadgetType gadgetType, Player caller) { From a1ec102419ef1c6e1e6481e2c9d79e5801c4fd2d Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Oct 2016 21:54:17 -0300 Subject: [PATCH 24/30] Fixed Slimeball Soccer field location --- .../Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 69e4e3359..cdb17aa96 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -98,7 +98,7 @@ public class SoccerManager extends MiniPlugin _hubManager = hubManager; _cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), -13.5, 67, -65.5); - _cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 25.5, 100, -87.5); + _cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 25.5, 100, -86.5); _cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), -17.5, 67, -71.5); _cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 29.5, 100, -80.5); From 8793be56edc637a02de71198fbfea9966b4db696 Mon Sep 17 00:00:00 2001 From: cnr Date: Sat, 1 Oct 2016 10:38:08 -0700 Subject: [PATCH 25/30] Add 'come back on $DATE' message to carl for Power Play --- .../gui/buttons/PowerPlayClubButton.java | 17 ++++---- .../core/powerplayclub/PowerPlayData.java | 42 ++++++++++++++----- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index b96e421ff..c7aa97f79 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -2,10 +2,8 @@ package mineplex.core.bonuses.gui.buttons; import java.time.LocalDate; import java.time.YearMonth; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import java.time.format.TextStyle; +import java.util.*; import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; @@ -92,6 +90,7 @@ public class PowerPlayClubButton implements GuiItem PowerPlayData cached = _powerPlayClubRepository.getCachedData(_player); + Optional maybeNextClaimDate = cached.getNextClaimDate(); List unclaimed = cached.getUnclaimedMonths(); if (!unclaimed.isEmpty()) @@ -104,16 +103,16 @@ public class PowerPlayClubButton implements GuiItem lore.add(" "); lore.add(C.cGold + "Click to claim!"); - } else if (cached.isSubscribed()) + } else if (maybeNextClaimDate.isPresent()) // Player is still subscribed, and has claimed everything so far { - // Player is subscribed and has claimed all of his/her rewards + LocalDate nextClaimDate = maybeNextClaimDate.get(); + material = Material.REDSTONE_BLOCK; itemName = C.cRedB + "Power Play Club"; lore = new ArrayList<>(); - lore.add(C.cRed + "Already claimed!"); - - // TODO: 'come back later!' + lore.add(C.cWhite + "Come back on " + C.cGreen + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth()); + lore.add(C.cWhite + "for your next reward!"); } else { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java index 620dac03f..79d976146 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java @@ -9,14 +9,17 @@ import java.util.stream.Collectors; public class PowerPlayData { - private final boolean _subscribed; + // If this is set, the player's subscription is set up to recur next month + // In the case of a yearly subscription, this is just the next month's date. + // Corollary: If this isn't Optional.empty(), the player is subscribed. + private final Optional _nextClaimDate; private final List _unclaimedMonths; static PowerPlayData fromSubsAndClaims(List subscriptions, List claimedMonths) { if (subscriptions.isEmpty()) { - return new PowerPlayData(false, Collections.emptyList()); + return new PowerPlayData(Optional.empty(), Collections.emptyList()); } // Build the list of potential claim dates from subscriptions @@ -25,9 +28,23 @@ public class PowerPlayData .sorted() .collect(Collectors.toCollection(LinkedList::new)); - // Determine if player is subscribed - LocalDate latestSub = claimDates.get(claimDates.size() - 1); - final boolean subscribed = latestSub.plusMonths(1).isAfter(LocalDate.now()); + // Determine the player's next claim date (which will tell us whether + // they're subscribed as well + final Optional nextClaimDate; + + // In the case of a yearly subscription, they'll already have a claim date scheduled + Optional nextSubClaim = claimDates.stream().filter(date -> date.isAfter(LocalDate.now())).findFirst(); + if (nextSubClaim.isPresent()) + { + nextClaimDate = nextSubClaim; + + } else + { + // In the case of a monthly subscription, we need to extrapolate the next claim date + nextClaimDate = Optional.of(claimDates.get(claimDates.size() - 1)) + .map(date -> date.plusMonths(1)) + .filter(date -> date.isAfter(LocalDate.now())); // and make sure it's after today + } // Remove already-claimed months Optional latestClaimed = claimedMonths.stream().collect(Collectors.maxBy(YearMonth::compareTo)); @@ -54,7 +71,7 @@ public class PowerPlayData .distinct() .collect(Collectors.toList()); - return new PowerPlayData(subscribed, unclaimedMonths); + return new PowerPlayData(nextClaimDate, unclaimedMonths); } private static List buildMonths(Subscription subscription) @@ -92,12 +109,17 @@ public class PowerPlayData MONTH, YEAR } - private PowerPlayData(boolean subscribed, List unclaimedMonths) + private PowerPlayData(Optional nextClaimDate, List unclaimedMonths) { - _subscribed = subscribed; + _nextClaimDate = nextClaimDate; _unclaimedMonths = unclaimedMonths; } + public Optional getNextClaimDate() + { + return _nextClaimDate; + } + public List getUnclaimedMonths() { return _unclaimedMonths; @@ -105,12 +127,12 @@ public class PowerPlayData public boolean isSubscribed() { - return _subscribed; + return _nextClaimDate.isPresent(); } @Override public String toString() { - return Objects.toStringHelper(this).add("subscribed", _subscribed).add("unclaimed", _unclaimedMonths).toString(); + return Objects.toStringHelper(this).add("_nextClaimDate", _nextClaimDate).add("_unclaimedMonths", _unclaimedMonths).toString(); } } From 20c37bf3d61f9a050757ed0da8ffe192a129e1bc Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 5 Oct 2016 17:00:37 -0600 Subject: [PATCH 26/30] Unlock PPC cosmetics on the first of the month The relevant cosmetic will be revoked if the player's subscription lapses during that month --- .../mineplex/core/bonuses/BonusManager.java | 4 +- .../gui/buttons/PowerPlayClubButton.java | 6 +- .../PowerPlayClubRepository.java | 18 ++++- .../powerplayclub/PowerPlayClubRewards.java | 4 +- .../core/powerplayclub/PowerPlayData.java | 76 ++++++++++++++----- 5 files changed, 82 insertions(+), 26 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java index 5c2769fe0..9c692c7d1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/BonusManager.java @@ -161,7 +161,7 @@ public class BonusManager extends MiniClientPlugin implements I _repository = new BonusRepository(plugin, this, donationManager); _clientManager = clientManager; _donationManager = donationManager; - _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager); System.out.print("VOTIFIER: "); System.out.print("DONATION MANAGER - > " + _donationManager.toString()); @@ -202,7 +202,7 @@ public class BonusManager extends MiniClientPlugin implements I _playWireManager = playWireManager; - _powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager, _donationManager); _voteList = new ArrayList<>(); _voteList.add("http://vote1.mineplex.com"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index c7aa97f79..6116e80da 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -91,7 +91,7 @@ public class PowerPlayClubButton implements GuiItem PowerPlayData cached = _powerPlayClubRepository.getCachedData(_player); Optional maybeNextClaimDate = cached.getNextClaimDate(); - List unclaimed = cached.getUnclaimedMonths(); + Set unclaimed = cached.getUnclaimedMonths(); if (!unclaimed.isEmpty()) { @@ -120,7 +120,7 @@ public class PowerPlayClubButton implements GuiItem material = Material.REDSTONE_BLOCK; itemName = C.cRedB + "Power Play Club"; - lore = buildLore(Collections.singletonList(YearMonth.now())); + lore = buildLore(Collections.singleton(YearMonth.now())); lore.add(" "); lore.add(C.cRed + "Get Power Play Club months at"); lore.add(C.cAqua + "mineplex.com/shop"); @@ -129,7 +129,7 @@ public class PowerPlayClubButton implements GuiItem _item = new ShopItem(material, (byte)0, itemName, lore.toArray(new String[lore.size()]), 1, false, false); } - private List buildLore(List unclaimed) + private List buildLore(Set unclaimed) { List lore = new ArrayList<>(); lore.add(C.cYellow + "Rewards"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java index de013f635..195856061 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRepository.java @@ -2,11 +2,13 @@ package mineplex.core.powerplayclub; import mineplex.core.account.CoreClientManager; import mineplex.core.account.ILoginProcessor; +import mineplex.core.donation.DonationManager; import mineplex.serverdata.database.DBPool; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -28,9 +30,11 @@ public class PowerPlayClubRepository implements Listener { private final Map _cachedPlayerData = new HashMap<>(); private final CoreClientManager _clientManager; + private final DonationManager _donationManager; - public PowerPlayClubRepository(JavaPlugin plugin, CoreClientManager clientManager) { + public PowerPlayClubRepository(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) { _clientManager = clientManager; + _donationManager = donationManager; Bukkit.getPluginManager().registerEvents(this, plugin); @@ -83,6 +87,18 @@ public class PowerPlayClubRepository implements Listener { }); } + // Add usable cosmetics to player on join + @EventHandler + public void onJoin(PlayerJoinEvent event) + { + Player player = event.getPlayer(); + + PowerPlayData cached = getCachedData(player); + PowerPlayClubRewards.rewardsForMonths(cached.getUsableCosmeticMonths()).stream() + .map(PowerPlayClubRewards.PowerPlayClubItem::getPrize) + .forEach(_donationManager.Get(player)::AddUnknownSalesPackagesOwned); + } + @EventHandler public void onQuit(PlayerQuitEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 96e028df1..07336ca69 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -51,9 +51,9 @@ public class PowerPlayClubRewards } } - public static List rewardsForMonths(List months) + public static List rewardsForMonths(Set months) { - return months.stream().map(rewards::get).collect(Collectors.toList()); + return months.stream().sorted().map(rewards::get).collect(Collectors.toList()); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java index 79d976146..21fea021f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java @@ -9,30 +9,46 @@ import java.util.stream.Collectors; public class PowerPlayData { - // If this is set, the player's subscription is set up to recur next month - // In the case of a yearly subscription, this is just the next month's date. - // Corollary: If this isn't Optional.empty(), the player is subscribed. + /* If this is set, the player's subscription is planned to recur. + * + * In the case of a yearly subscription, this will be the first day of + * the next month, or the exact end-of-subscription date if it's his/her + * last month. + * + * Corollary: If this isn't Optional.empty(), the player is actively subscribed. + */ private final Optional _nextClaimDate; - private final List _unclaimedMonths; + + // The months where the player hasn't claimed chests/amplifiers + private final Set _unclaimedMonths; + + /* The months of PPC cosmetics the player owns / can use. + * In the case of, e.g., a monthly subscription, this will include + * the current month's cosmetic until _nextClaimDate passes (the + * subscription expires), unless the player's subscription recurs. + */ + private final Set _cosmeticMonths; static PowerPlayData fromSubsAndClaims(List subscriptions, List claimedMonths) { if (subscriptions.isEmpty()) { - return new PowerPlayData(Optional.empty(), Collections.emptyList()); + return new PowerPlayData(Optional.empty(), Collections.emptySet(), Collections.emptySet()); } // Build the list of potential claim dates from subscriptions + // Note that it's a LinkedList with dates in ascending order List claimDates = subscriptions.stream() .flatMap(sub -> buildMonths(sub).stream()) .sorted() .collect(Collectors.toCollection(LinkedList::new)); // Determine the player's next claim date (which will tell us whether - // they're subscribed as well + // they're subscribed as well) final Optional nextClaimDate; - // In the case of a yearly subscription, they'll already have a claim date scheduled + // In the case of a yearly subscription, they're likely to have a claim date scheduled + // (this is not the case for the last month) Optional nextSubClaim = claimDates.stream().filter(date -> date.isAfter(LocalDate.now())).findFirst(); if (nextSubClaim.isPresent()) { @@ -46,6 +62,12 @@ public class PowerPlayData .filter(date -> date.isAfter(LocalDate.now())); // and make sure it's after today } + // Determine the months whose cosmetics can be used by this player + Set cosmeticMonths = claimDates.stream() + .map(YearMonth::from) + .filter(yearMonth -> yearMonth.isBefore(YearMonth.now()) || yearMonth.equals(YearMonth.now())) + .collect(Collectors.toSet()); + // Remove already-claimed months Optional latestClaimed = claimedMonths.stream().collect(Collectors.maxBy(YearMonth::compareTo)); latestClaimed.ifPresent(latest -> @@ -65,13 +87,12 @@ public class PowerPlayData } }); - List unclaimedMonths = claimDates.stream() + Set unclaimedMonths = claimDates.stream() .filter(date -> date.isBefore(LocalDate.now()) || date.equals(LocalDate.now())) // Filter dates yet to come .map(YearMonth::from) - .distinct() - .collect(Collectors.toList()); + .collect(Collectors.toSet()); - return new PowerPlayData(nextClaimDate, unclaimedMonths); + return new PowerPlayData(nextClaimDate, unclaimedMonths, cosmeticMonths); } private static List buildMonths(Subscription subscription) @@ -83,9 +104,16 @@ public class PowerPlayData case YEAR: List months = new ArrayList<>(); - for (int i = 0; i < 12; i++) + + // The first and last months have the exact claim dates + // The latter is to prevent premature claiming + months.add(subscription._startDate); + months.add(subscription._startDate.plusMonths(11)); + + // The middle months can claim on the first day of the month + for (int i = 1; i < 11; i++) { - months.add(subscription._startDate.plusMonths(i)); + months.add(subscription._startDate.plusMonths(i).withDayOfMonth(1)); } return months; @@ -94,7 +122,8 @@ public class PowerPlayData } } - static class Subscription { + static class Subscription + { private final LocalDate _startDate; private final SubscriptionDuration _duration; @@ -105,14 +134,16 @@ public class PowerPlayData } } - enum SubscriptionDuration { + enum SubscriptionDuration + { MONTH, YEAR } - private PowerPlayData(Optional nextClaimDate, List unclaimedMonths) + private PowerPlayData(Optional nextClaimDate, Set unclaimedMonths, Set cosmeticMonths) { _nextClaimDate = nextClaimDate; _unclaimedMonths = unclaimedMonths; + _cosmeticMonths = cosmeticMonths; } public Optional getNextClaimDate() @@ -120,11 +151,16 @@ public class PowerPlayData return _nextClaimDate; } - public List getUnclaimedMonths() + public Set getUnclaimedMonths() { return _unclaimedMonths; } + public Set getUsableCosmeticMonths() + { + return _cosmeticMonths; + } + public boolean isSubscribed() { return _nextClaimDate.isPresent(); @@ -133,6 +169,10 @@ public class PowerPlayData @Override public String toString() { - return Objects.toStringHelper(this).add("_nextClaimDate", _nextClaimDate).add("_unclaimedMonths", _unclaimedMonths).toString(); + return Objects.toStringHelper(this) + .add("_nextClaimDate", _nextClaimDate) + .add("_unclaimedMonths", _unclaimedMonths) + .add("_cosmeticMonths", _cosmeticMonths) + .toString(); } } From bd90c465dd1d42c38c61be464aa3034e2b8f9914 Mon Sep 17 00:00:00 2001 From: cnr Date: Wed, 5 Oct 2016 17:59:07 -0600 Subject: [PATCH 27/30] Update PPC button to reflect new claiming style --- .../gui/buttons/PowerPlayClubButton.java | 58 +++++++++++++------ .../powerplayclub/PowerPlayClubRewards.java | 28 ++++----- .../core/powerplayclub/PowerPlayData.java | 1 + 3 files changed, 53 insertions(+), 34 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java index 6116e80da..c9eb2cd78 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/bonuses/gui/buttons/PowerPlayClubButton.java @@ -3,7 +3,13 @@ package mineplex.core.bonuses.gui.buttons; import java.time.LocalDate; import java.time.YearMonth; import java.time.format.TextStyle; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import mineplex.core.bonuses.BonusManager; import mineplex.core.common.util.C; @@ -60,7 +66,7 @@ public class PowerPlayClubButton implements GuiItem { _player.closeInventory(); _player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f); - PowerPlayClubRewards.giveAllItems(_player, _donationManager, _inventoryManager, _powerPlayClubRepository); + PowerPlayClubRewards.giveAllItems(_player, _inventoryManager, _powerPlayClubRepository); } else { @@ -86,21 +92,25 @@ public class PowerPlayClubButton implements GuiItem { final Material material; final String itemName; - final List lore; + final List lore = new ArrayList<>(); PowerPlayData cached = _powerPlayClubRepository.getCachedData(_player); Optional maybeNextClaimDate = cached.getNextClaimDate(); Set unclaimed = cached.getUnclaimedMonths(); + if (!cached.getUsableCosmeticMonths().isEmpty()) + { + lore.addAll(buildCosmeticsLore(cached.getUsableCosmeticMonths())); + } + if (!unclaimed.isEmpty()) { // Player has unclaimed rewards, even if s/he's not currently subscribed material = Material.GOLD_INGOT; itemName = C.cGreenB + "Power Play Club"; - lore = buildLore(unclaimed); - lore.add(" "); + lore.addAll(buildOtherRewardsLore(unclaimed.size())); lore.add(C.cGold + "Click to claim!"); } else if (maybeNextClaimDate.isPresent()) // Player is still subscribed, and has claimed everything so far @@ -110,9 +120,9 @@ public class PowerPlayClubButton implements GuiItem material = Material.REDSTONE_BLOCK; itemName = C.cRedB + "Power Play Club"; - lore = new ArrayList<>(); - lore.add(C.cWhite + "Come back on " + C.cGreen + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth()); - lore.add(C.cWhite + "for your next reward!"); + lore.add(C.cYellow + "Come back " + C.cGreen + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth()); + lore.add(C.cWhite + " " + PowerPlayClubRewards.AMPLIFIERS_PER_MONTH + " Game Amplifier"); + lore.add(C.cWhite + " " + PowerPlayClubRewards.CHESTS_PER_MONTH + " Omega Chest"); } else { @@ -120,8 +130,10 @@ public class PowerPlayClubButton implements GuiItem material = Material.REDSTONE_BLOCK; itemName = C.cRedB + "Power Play Club"; - lore = buildLore(Collections.singleton(YearMonth.now())); + lore.add(C.cYellow + YearMonth.now().getMonth().getDisplayName(TextStyle.FULL, Locale.US) + "'s Cosmetic"); + lore.add(C.cWhite + " " + PowerPlayClubRewards.rewards().get(YearMonth.now()).getPrize()); lore.add(" "); + lore.addAll(buildOtherRewardsLore(1)); lore.add(C.cRed + "Get Power Play Club months at"); lore.add(C.cAqua + "mineplex.com/shop"); } @@ -129,17 +141,29 @@ public class PowerPlayClubButton implements GuiItem _item = new ShopItem(material, (byte)0, itemName, lore.toArray(new String[lore.size()]), 1, false, false); } - private List buildLore(Set unclaimed) + private List buildCosmeticsLore(Set cosmeticsMonths) { List lore = new ArrayList<>(); - lore.add(C.cYellow + "Rewards"); - lore.add(" " + C.cWhite + (PowerPlayClubRewards.AMPLIFIERS_PER_MONTH * unclaimed.size()) + " Game Amplifier"); - lore.add(" " + C.cWhite + (PowerPlayClubRewards.CHESTS_PER_MONTH * unclaimed.size()) + " Omega Chest"); + lore.add(C.cYellow + "Unlocked cosmetics"); + PowerPlayClubRewards.rewards().entrySet().stream() + .filter(entry -> cosmeticsMonths.contains(entry.getKey())) + .sorted(Comparator.comparing(Map.Entry::getKey)) + .forEach(entry -> + { + YearMonth yearMonth = entry.getKey(); + lore.add(C.cWhite + " " + entry.getValue().getPrize() + " " + C.cGold + yearMonth.getMonth().getDisplayName(TextStyle.SHORT, Locale.US) + " " + yearMonth.getYear()); + }); + lore.add(" "); + return lore; + } - PowerPlayClubRewards.rewardsForMonths(unclaimed).forEach(prize -> - { - lore.add(" " + C.cWhite + prize.getPrize()); - }); + private List buildOtherRewardsLore(int unclaimed) + { + List lore = new ArrayList<>(); + lore.add(C.cYellow + "Other Rewards"); + lore.add(" " + C.cWhite + (PowerPlayClubRewards.AMPLIFIERS_PER_MONTH * unclaimed) + " Game Amplifier"); + lore.add(" " + C.cWhite + (PowerPlayClubRewards.CHESTS_PER_MONTH * unclaimed) + " Omega Chest"); + lore.add(" "); return lore; } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java index 07336ca69..66a2d3d5c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayClubRewards.java @@ -56,8 +56,13 @@ public class PowerPlayClubRewards return months.stream().sorted().map(rewards::get).collect(Collectors.toList()); } + public static Map rewards() + { + return rewards; + } - public static void giveAllItems(Player player, DonationManager donationManager, InventoryManager inventoryManager, PowerPlayClubRepository repo) + + public static void giveAllItems(Player player, InventoryManager inventoryManager, PowerPlayClubRepository repo) { UtilPlayer.message(player, F.main("Power Play Club", "Verifying subscription..")); @@ -70,18 +75,7 @@ public class PowerPlayClubRewards } PowerPlayData cached = repo.getCachedData(player); - List items = rewardsForMonths(cached.getUnclaimedMonths()); - - - // Give normal power play items - items.forEach(item -> - { - donationManager.PurchaseUnknownSalesPackage(null, player.getName(), - donationManager.getClientManager().Get(player).getAccountId(), item.getPrize(), - GlobalCurrency.TREASURE_SHARD, 0, true); - UtilPlayer.message(player, F.main("Power Play Club", "You received the " + - F.elem(item.getPrize()) + ".")); - }); + int unclaimed = cached.getUnclaimedMonths().size(); // Give amplifiers and chests Item gameAmplifier = inventoryManager.getItem("Game Booster"); @@ -91,8 +85,8 @@ public class PowerPlayClubRewards } else { - inventoryManager.addItemToInventory(player, gameAmplifier.Name, AMPLIFIERS_PER_MONTH * items.size()); - UtilPlayer.message(player, F.main("Power Play Club", "You received " + (AMPLIFIERS_PER_MONTH * items.size()) + "x " + F.elem("Game Amplifier") + ".")); + inventoryManager.addItemToInventory(player, gameAmplifier.Name, AMPLIFIERS_PER_MONTH * unclaimed); + UtilPlayer.message(player, F.main("Power Play Club", "You received " + (AMPLIFIERS_PER_MONTH * unclaimed) + "x " + F.elem("Game Amplifier") + ".")); } Item omegaChest = inventoryManager.getItem("Omega Chest"); if (omegaChest == null) @@ -101,8 +95,8 @@ public class PowerPlayClubRewards } else { - inventoryManager.addItemToInventory(player, omegaChest.Name, CHESTS_PER_MONTH * items.size()); - UtilPlayer.message(player, F.main("Power Play Club", "You received " + (CHESTS_PER_MONTH * items.size()) + "x " + F.elem("Omega Chest") + ".")); + inventoryManager.addItemToInventory(player, omegaChest.Name, CHESTS_PER_MONTH * unclaimed); + UtilPlayer.message(player, F.main("Power Play Club", "You received " + (CHESTS_PER_MONTH * unclaimed) + "x " + F.elem("Omega Chest") + ".")); } // Refresh Power Play data on the server diff --git a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java index 21fea021f..09b4b30f2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/powerplayclub/PowerPlayData.java @@ -60,6 +60,7 @@ public class PowerPlayData nextClaimDate = Optional.of(claimDates.get(claimDates.size() - 1)) .map(date -> date.plusMonths(1)) .filter(date -> date.isAfter(LocalDate.now())); // and make sure it's after today + nextClaimDate.ifPresent(claimDates::add); } // Determine the months whose cosmetics can be used by this player From c0754a23c844f69fee304dcf8ddd6f4e1ea1a76b Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 5 Oct 2016 23:08:27 -0300 Subject: [PATCH 28/30] Fix Slime Soccer, Add /unlockcosmetics and /lockcosmetics for other players (#232) * Added option to run /unlockcosmetics and /lockcosmetics for other players * Fixed Slimeball Soccer field location --- .../gadget/commands/LockCosmeticsCommand.java | 33 ++++------------ .../commands/UnlockCosmeticsCommand.java | 39 +++++-------------- .../mineplex/hub/modules/SoccerManager.java | 2 +- 3 files changed, 18 insertions(+), 56 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java index c957b8da4..e726517a2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/LockCosmeticsCommand.java @@ -11,6 +11,8 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.pet.Pet; + +import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class LockCosmeticsCommand extends CommandBase @@ -32,36 +34,15 @@ public class LockCosmeticsCommand extends CommandBase { removeCosmetics(null, caller); } - // Adds specific type - else + else if (args.length == 1) { - String type = args[0]; - if (type.equalsIgnoreCase("all")) + Player player = Bukkit.getPlayer(args[0]); + if (player != null) { - removeCosmetics(null, caller); - } - else if (type.equalsIgnoreCase("pet")) - { - removePets(caller); - } - else if (type.equalsIgnoreCase("mount")) - { - removeMounts(caller); - } - else - { - GadgetType gadgetType = GadgetType.valueOf(type); - if (gadgetType == null) - { - UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); - } - else - { - removeCosmetics(gadgetType, caller); - } + removeCosmetics(null, player); + UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Removed all the cosmetics to " + F.name(player.getName()) + "!")); } } - } private void removeCosmetics(GadgetType gadgetType, Player caller) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java index c24411ebd..f1867e009 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/commands/UnlockCosmeticsCommand.java @@ -11,6 +11,8 @@ import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.GadgetType; import mineplex.core.mount.Mount; import mineplex.core.pet.Pet; + +import org.bukkit.Bukkit; import org.bukkit.entity.Player; public class UnlockCosmeticsCommand extends CommandBase @@ -32,37 +34,16 @@ public class UnlockCosmeticsCommand extends CommandBase { addCosmetics(null, caller); } - // Adds specific type - else - { - String type = args[0]; - if (type.equalsIgnoreCase("all")) - { - addCosmetics(null, caller); - } - else if (type.equalsIgnoreCase("pet")) + else if (args.length == 1) + { + Player player = Bukkit.getPlayer(args[0]); + if (player != null) { - addPets(caller); + addCosmetics(null, player); + UtilPlayer.message(caller, F.main("Unlock Cosmetics", "Added all the cosmetics to " + F.name(player.getName()) + "!")); } - else if (type.equalsIgnoreCase("mount")) - { - addMounts(caller); - } - else - { - GadgetType gadgetType = GadgetType.valueOf(type); - if (gadgetType == null) - { - UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!")); - } - else - { - addCosmetics(gadgetType, caller); - } - } - } - - } + } + } private void addCosmetics(GadgetType gadgetType, Player caller) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java index 69e4e3359..cdb17aa96 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/SoccerManager.java @@ -98,7 +98,7 @@ public class SoccerManager extends MiniPlugin _hubManager = hubManager; _cornerFieldPlayerA = new Location(hubManager.GetSpawn().getWorld(), -13.5, 67, -65.5); - _cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 25.5, 100, -87.5); + _cornerFieldPlayerB = new Location(hubManager.GetSpawn().getWorld(), 25.5, 100, -86.5); _cornerGoalPlayerA = new Location(hubManager.GetSpawn().getWorld(), -17.5, 67, -71.5); _cornerGoalPlayerB = new Location(hubManager.GetSpawn().getWorld(), 29.5, 100, -80.5); From a6727bf104a5725ed33e3f4f803f52b96626b7db Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Wed, 5 Oct 2016 22:57:44 -0400 Subject: [PATCH 29/30] Halloween Fixes/Prep --- .../mineplex/core/gadget/GadgetManager.java | 2 + .../OutfitWindUpSuitBoosterManager.java | 7 +- .../mineplex/core/noteblock/MusicManager.java | 106 ++++++++++++++++++ .../mineplex/core/noteblock/NotePlayer.java | 13 ++- .../animation/BlockChangeAnimation.java | 2 +- .../src/mineplex/enjinTranslator/Enjin.java | 2 +- .../src/mineplex/hub/HubManager.java | 77 +------------ .../src/mineplex/hub/modules/NewsManager.java | 57 +--------- .../src/mineplex/staffServer/StaffServer.java | 2 +- .../game/games/valentines/Valentines.java | 9 +- 10 files changed, 126 insertions(+), 151 deletions(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/noteblock/MusicManager.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index a3695d0c5..1958205ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -123,6 +123,7 @@ import mineplex.core.gadget.gadgets.morph.MorphSquid; import mineplex.core.gadget.gadgets.morph.MorphTitan; import mineplex.core.gadget.gadgets.morph.MorphUncleSam; import mineplex.core.gadget.gadgets.morph.MorphVillager; +import mineplex.core.gadget.gadgets.morph.MorphWitch; import mineplex.core.gadget.gadgets.morph.MorphWither; import mineplex.core.gadget.gadgets.morph.managers.SoulManager; import mineplex.core.gadget.gadgets.morph.managers.SwimManager; @@ -362,6 +363,7 @@ public class GadgetManager extends MiniPlugin addGadget(new MorphSnowman(this)); addGadget(new MorphUncleSam(this)); addGadget(new MorphSquid(this)); + addGadget(new MorphWitch(this)); addGadget(new MorphGrimReaper(this)); // Not being added in this update! //addGadget(new MorphMetalMan(this)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java index bbbe726ce..265cc7d3d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/outfit/windupsuit/OutfitWindUpSuitBoosterManager.java @@ -110,12 +110,7 @@ public class OutfitWindUpSuitBoosterManager NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(songFile)), songFile.getName().replace("_", " ").replace(".nbs", "")); if (song != null) { - NotePlayer notePlayer = new NotePlayer(_gadget.getPlugin(), song, new INoteVerifier() { - @Override - public boolean shouldPlay(Player toPlay) { - return true; - } - }, 0.5F, true, player); + NotePlayer notePlayer = new NotePlayer(_gadget.getPlugin(), song, p -> true, 0.5F, true, player); _notePlayers.put(player, notePlayer); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/MusicManager.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/MusicManager.java new file mode 100644 index 000000000..fc02b0f38 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/MusicManager.java @@ -0,0 +1,106 @@ +package mineplex.core.noteblock; + +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Random; +import java.util.function.Predicate; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.noteblock.event.SongFinishEvent; + +/** + * Very basic Manager to play music across the entire server. Specifically used for Lobby Music + * + * Created by shaun on 2016-10-05. + */ +public class MusicManager extends MiniPlugin +{ + private Random _random = new Random(); + private final ArrayList _songs = new ArrayList<>(); + private int _lastSong = 0; + + private final Predicate _shouldPlay; + + public MusicManager(Predicate shouldPlay, String folderName) + { + super("Music Manager"); + + _shouldPlay = shouldPlay; + + addSongs(folderName); + playNextSong(); + } + + private void playNextSong() + { + if (_songs.isEmpty()) + return; + + int index = (_lastSong + _random.nextInt(_songs.size() - 1) + 1) % _songs.size(); + NoteSong song = _songs.get(index); + if (song != null) + { + UtilServer.getPlayersCollection().stream() + .filter(_shouldPlay) + .forEach(player -> displaySongInfo(song, player)); + + new NotePlayer(_plugin, song, _shouldPlay, 0.5F, false); + + _lastSong = index; + } + } + + private void addSongs(String folderName) + { + try + { + File songsFolder = new File(folderName); + if (songsFolder.exists()) + { + File[] files = songsFolder.listFiles(); + if (files == null) return; + + for (File file : files) + { + if (file.getName().endsWith(".nbs")) + { + System.out.println("Loading Song " + file.getPath()); + NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)), file.getName().replace("_", " ").replace(".nbs", "")); + if (song != null) + { + _songs.add(song); + } + } + } + } + } + catch (FileNotFoundException e) + { + e.printStackTrace(); + System.out.println("FAILED TO LOAD SONG!!"); + } + } + + private void displaySongInfo(NoteSong song, Player player) + { + UtilTextBottom.display(C.cWhite + "Now Playing " + C.cYellow + song.getName(), player); + } + + @EventHandler + public void onSongFinish(SongFinishEvent event) + { + if (_lastSong < _songs.size() && event.getSong().equals(_songs.get(_lastSong))) + { + playNextSong(); + } + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java index dfe6bf995..3a0bb4059 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/noteblock/NotePlayer.java @@ -2,6 +2,7 @@ package mineplex.core.noteblock; import java.util.ArrayList; import java.util.List; +import java.util.function.Predicate; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -14,7 +15,7 @@ public class NotePlayer { private final JavaPlugin _plugin; private final NoteSong _song; - private final INoteVerifier _verifier; + private final Predicate _shouldPlay; private final long _sleepMs; private volatile float _volumeMult; private volatile boolean _loop; @@ -22,17 +23,17 @@ public class NotePlayer private volatile boolean _finished; private volatile Player[] _players = null; - public NotePlayer(JavaPlugin plugin, NoteSong song, INoteVerifier verifier, float volumeMult, boolean loop, Player... players) + public NotePlayer(JavaPlugin plugin, NoteSong song, Predicate shouldPlay, float volumeMult, boolean loop, Player... players) { - this(plugin, song, verifier, volumeMult, loop); + this(plugin, song, shouldPlay, volumeMult, loop); _players = players; } - public NotePlayer(JavaPlugin plugin, NoteSong song, INoteVerifier verifier, float volumeMult, boolean loop) + public NotePlayer(JavaPlugin plugin, NoteSong song, Predicate shouldPlay, float volumeMult, boolean loop) { _plugin = plugin; _song = song; - _verifier = verifier; + _shouldPlay = shouldPlay; _sleepMs = (long) (1000 / (song.getTempo() / 100D)); _loop = loop; _tick = 0; @@ -103,7 +104,7 @@ public class NotePlayer List players = new ArrayList<>(playerArray.length); for (Player player : playerArray) { - if (_verifier.shouldPlay(player)) + if (_shouldPlay != null && _shouldPlay.test(player)) players.add(player); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java index 182f7f136..c058974b2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/animation/BlockChangeAnimation.java @@ -156,7 +156,7 @@ public class BlockChangeAnimation extends Animation if(c.equals(b)) { _blockInfoList.add(new BlockInfo(b)); - b.setType(Material.PUMPKIN); + b.setType(Material.JACK_O_LANTERN); b.setData(getDirection(c)); } } diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index 56103deda..4b57ada5d 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -57,7 +57,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor _punish = new Punish(plugin, plugin.GetWebServerAddress(), clientManager); _purchaseManager = new PurchaseManager(plugin); - _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager); + _powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager); plugin.getCommand("enjin_mineplex").setExecutor(this); plugin.getCommand("pull").setExecutor(this); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index b7f9cc73b..09120e45a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -36,6 +36,7 @@ import mineplex.core.menu.MenuManager; import mineplex.core.message.PrivateMessageEvent; import mineplex.core.mount.MountManager; import mineplex.core.noteblock.INoteVerifier; +import mineplex.core.noteblock.MusicManager; import mineplex.core.noteblock.NBSReader; import mineplex.core.noteblock.NotePlayer; import mineplex.core.noteblock.NoteSong; @@ -156,12 +157,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess private HashMap> _creativeAdmin = new HashMap>(); - // Christmas Songs - private Random _random = new Random(); - private int _lastSong = 0; - // private final String[] _songNames = {"JingleBells.nbs", "TheFirstNoel.nbs", "Hark.nbs", "DeckTheHalls.nbs", "Joy.nbs", "MerryChristmas.nbs"}; - private final ArrayList _songs; - public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, IncognitoManager incognito, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager, CustomDataManager customDataManager, ThankManager thankManager, BoosterManager boosterManager) { super("Hub Manager", plugin); @@ -237,6 +232,7 @@ public class HubManager extends MiniClientPlugin implements IChatMess ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; + new MusicManager((player) -> _preferences.get(player).isActive(Preference.HUB_MUSIC), "../../update/songs/lobbyMusic"); // _halloweenManager = new HalloweenSpookinessManager(this); // new HolidayGiftManager(plugin, clientManager, donationManager, inventoryManager, taskManager); @@ -249,44 +245,12 @@ public class HubManager extends MiniClientPlugin implements IChatMess _customDataManager = Managers.get(CustomDataManager.class); - _songs = new ArrayList(); - _punishManager = punish; _valentinesManager = new ValentinesManager(plugin, clientManager, donationManager); new NonPremiumManager(plugin, clientManager); - try - { - - File songsFolder = new File("../../update/songs/"); - if (songsFolder.exists()) - { - File[] files = songsFolder.listFiles(); - - for (File file : files) - { - if (file.getName().endsWith(".nbs")) - { - System.out.println("Loading Song " + file.getPath()); - NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)), file.getName().replace("_", " ").replace(".nbs", "")); - if (song != null) - { - _songs.add(song); - } - } - } - } - } - catch (FileNotFoundException e) - { - e.printStackTrace(); - System.out.println("FAILED TO LOAD SONG!!"); - } - - playNextSong(); - ScoreboardManager scoreboardManager = new ScoreboardManager(plugin) { @Override @@ -404,37 +368,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess Managers.put(scoreboardManager, ScoreboardManager.class); } - private void playNextSong() - { - if (Type != HubType.Christmas) - return; - - if (_songs.isEmpty()) - return; - - int index = (_lastSong + _random.nextInt(_songs.size() - 1)) % _songs.size(); - NoteSong song = _songs.get(index); - if (song != null) - { - for (Player player : UtilServer.getPlayers()) - { - if (_preferences.get(player).isActive(Preference.HUB_MUSIC)) - { - UtilTextBottom.display(C.cWhite + "Now Playing " + C.cYellow + song.getName(), player); - } - } - - new NotePlayer(_plugin, song, new INoteVerifier() - { - @Override - public boolean shouldPlay(Player player) - { - return _preferences.get(player).isActive(Preference.HUB_MUSIC); - } - }, 0.5F, false); - } - } - @Override public void addCommands() { @@ -1053,12 +986,6 @@ public class HubManager extends MiniClientPlugin implements IChatMess ; } - @EventHandler - public void onSongFinish(SongFinishEvent event) - { - playNextSong(); - } - @EventHandler public void trackPortalDelayPlayers(UpdateEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index 403d168db..2667a203b 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -300,7 +300,7 @@ public class NewsManager extends MiniPlugin * Myst's sexy ass animation :> */ - _animationIndex = (_animationIndex + 1) % 147; + _animationIndex = (_animationIndex + 1) % 67; if (_animationIndex == 0) text = C.cGoldB + " "; if (_animationIndex == 1) text = C.cGoldB + " H"; @@ -328,9 +328,9 @@ public class NewsManager extends MiniPlugin if (_animationIndex > 22 && _animationIndex <= 42) { - if (_animationIndex % 3 == 0) text = C.cWhiteB + "2015" + C.cGoldB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015"; - else if (_animationIndex % 3 == 1) text = C.cWhiteB + "2015" + C.cRedB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015"; - else text = C.cWhiteB + "2015" + C.cYellowB + " HAPPY HALLOWEEN " + C.cWhiteB + "2015"; + if (_animationIndex % 3 == 0) text = C.cWhiteB + "2016" + C.cGoldB + " HAPPY HALLOWEEN " + C.cWhiteB + "2016"; + else if (_animationIndex % 3 == 1) text = C.cWhiteB + "2016" + C.cRedB + " HAPPY HALLOWEEN " + C.cWhiteB + "2016"; + else text = C.cWhiteB + "2016" + C.cYellowB + " HAPPY HALLOWEEN " + C.cWhiteB + "2016"; } if (_animationIndex == 43 || _animationIndex == 44) text = C.cGoldB + " HAPPY HALLOWEEN "; @@ -356,55 +356,6 @@ public class NewsManager extends MiniPlugin if (_animationIndex == 64) text = C.cGoldB + "EN "; if (_animationIndex == 65) text = C.cGoldB + "N "; if (_animationIndex == 66) text = C.cGoldB + " "; - - if (_animationIndex == 66) text = C.cGoldB + " S"; - if (_animationIndex == 67) text = C.cGoldB + " SP"; - if (_animationIndex == 68) text = C.cGoldB + " SPO"; - if (_animationIndex == 69) text = C.cGoldB + " SPOO"; - if (_animationIndex == 70) text = C.cGoldB + " SPOOK"; - if (_animationIndex == 71) text = C.cGoldB + " SPOOKY"; - if (_animationIndex == 72) text = C.cGoldB + " SPOOKY "; - if (_animationIndex == 73) text = C.cGoldB + " SPOOKY S"; - if (_animationIndex == 74) text = C.cGoldB + " SPOOKY SA"; - if (_animationIndex == 75) text = C.cGoldB + " SPOOKY SAL"; - if (_animationIndex == 76) text = C.cGoldB + " SPOOKY SALE"; - if (_animationIndex == 77) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 78) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 79) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 80) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 81) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 82) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 83) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 84 || _animationIndex == 85) text = C.cGoldB + " SPOOKY SALE "; - - if (_animationIndex > 84 && _animationIndex <= 124) - { - if (_animationIndex % 2 == 0) text = C.cWhiteB + "50% OFF" + C.cGoldB + " SPOOKY SALE " + C.cWhiteB + "50% OFF"; - else if (_animationIndex % 2 == 1) text = C.cWhiteB + "50% OFF" + C.cRedB + " SPOOKY SALE " + C.cWhiteB + "50% OFF"; - else text = C.cWhiteB + "50% OFF" + C.cYellowB + " SPOOKY SALE " + C.cWhiteB + "50% OFF"; - } - - if (_animationIndex == 125 || _animationIndex == 126) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 127) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 128) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 129) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 130) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 131) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 132) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 133) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 134) text = C.cGoldB + " SPOOKY SALE "; - if (_animationIndex == 135) text = C.cGoldB + "SPOOKY SALE "; - if (_animationIndex == 136) text = C.cGoldB + "POOKY SALE "; - if (_animationIndex == 137) text = C.cGoldB + "OOKY SALE "; - if (_animationIndex == 138) text = C.cGoldB + "OKY SALE "; - if (_animationIndex == 139) text = C.cGoldB + "KY SALE "; - if (_animationIndex == 140) text = C.cGoldB + "Y SALE "; - if (_animationIndex == 141) text = C.cGoldB + " SALE "; - if (_animationIndex == 142) text = C.cGoldB + "SALE "; - if (_animationIndex == 143) text = C.cGoldB + "ALE "; - if (_animationIndex == 144) text = C.cGoldB + "LE "; - if (_animationIndex == 145) text = C.cGoldB + "E "; - if (_animationIndex == 146) text = C.cGoldB + " "; } else { diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 6aa86f4aa..44251149e 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -73,7 +73,7 @@ public class StaffServer extends JavaPlugin require(PacketHandler.class); require(DisguiseManager.class); - PowerPlayClubRepository powerPlayRepo = new PowerPlayClubRepository(this, clientManager); + PowerPlayClubRepository powerPlayRepo = new PowerPlayClubRepository(this, clientManager, donationManager); new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), statsManager, powerPlayRepo), powerPlayRepo); //new Password(this, serverStatusManager.getCurrentServerName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java index b1f5f327e..26b6728e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/valentines/Valentines.java @@ -698,14 +698,7 @@ public class Valentines extends SoloGame } //Music! - _music = new NotePlayer(Manager.getPlugin(), noteSong, new INoteVerifier() - { - @Override - public boolean shouldPlay(Player player) - { - return Manager.getPreferences().get(player).isActive(Preference.HUB_MUSIC); - } - }, 0.7F, true); + _music = new NotePlayer(Manager.getPlugin(), noteSong, p -> Manager.getPreferences().get(p).isActive(Preference.HUB_MUSIC), 0.7F, true); } @Override From d6e9283cce538b350f0c406d535e2879d9d237fb Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Thu, 6 Oct 2016 05:26:58 -0300 Subject: [PATCH 30/30] Changed world time so its not too dark --- .../mineplex/hub/modules/WorldManager.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java index 0461c0078..1d8a19f78 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java @@ -1,19 +1,8 @@ package mineplex.hub.modules; -import mineplex.core.MiniPlugin; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilServer; -import mineplex.core.common.util.UtilWorld; -import mineplex.core.gadget.event.GadgetCollideEntityEvent; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.hub.HubManager; -import mineplex.hub.HubType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import java.util.HashSet; +import java.util.Iterator; + import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; @@ -50,8 +39,20 @@ import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.weather.WeatherChangeEvent; -import java.util.HashSet; -import java.util.Iterator; +import mineplex.core.MiniPlugin; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilWorld; +import mineplex.core.gadget.event.GadgetCollideEntityEvent; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.HubManager; +import mineplex.hub.HubType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class WorldManager extends MiniPlugin { @@ -75,7 +76,7 @@ public class WorldManager extends MiniPlugin if (Manager.Type == HubType.Halloween) { - world.setTime(16000); + world.setTime(13850); } else { world.setTime(6000);