From 19988a8951a9ce4d71b33e1a9b7b18d8898efb74 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Mon, 28 Aug 2017 20:06:02 -0400 Subject: [PATCH] Make panic mode alert appropriate slack teams/channels --- .../src/mineplex/core/slack/SlackAPI.java | 2 +- .../src/mineplex/core/slack/SlackMessage.java | 2 +- .../src/mineplex/core/slack/SlackTeam.java | 6 ++++- .../clans/freeze/ClansFreezeManager.java | 27 ++++++++++++++++++- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java index b9155e39f..0e8a7d234 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java @@ -128,4 +128,4 @@ public class SlackAPI return _instance; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java index 22bb1f2c2..a2b2f918b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java @@ -157,4 +157,4 @@ public class SlackMessage { _content = content; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java index 4dd60c9fa..b25f1913f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java @@ -10,6 +10,10 @@ public enum SlackTeam // QA team - mineplexqa.slack.com QA("Mineplex QA", "todo", "todo", "todo"), // TODO: new details + + CLANS("Mineplex CM", "T2ADQ1G9L", "B6URH6CM9", "HoF2tRaspjMBaj63luJWnlJz"), + + SOCIAL_MEDIA("Mineplex SM", "T44BS70DB", "B6UCH5Y1X", "NciHvU15gbRMZ1PksCjXy3my"), ; @@ -76,4 +80,4 @@ public enum SlackTeam { return "https://hooks.slack.com/services/" + getId1() + "/" + getId2() + "/" + getToken(); } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/freeze/ClansFreezeManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/freeze/ClansFreezeManager.java index 05ded2fd7..33122ccd3 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/freeze/ClansFreezeManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/freeze/ClansFreezeManager.java @@ -36,6 +36,9 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.recharge.Recharge; +import mineplex.core.slack.SlackAPI; +import mineplex.core.slack.SlackMessage; +import mineplex.core.slack.SlackTeam; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; @@ -316,6 +319,12 @@ public class ClansFreezeManager extends MiniPlugin player.setFlying(false); player.setWalkSpeed(0); player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 999999, -10)); + { + SlackMessage message = new SlackMessage("Clans Panic System", "crossed_swords", player.getName() + " has entered panic mode on " + UtilServer.getServerName() + "!"); + SlackAPI.getInstance().sendMessage(SlackTeam.CLANS, "#urgent", message, true); + SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy", message, true); + SlackAPI.getInstance().sendMessage(SlackTeam.SOCIAL_MEDIA, "#streams-announcements", message, true); + } for (Player alert : UtilServer.GetPlayers()) { if (_clientManager.Get(alert).GetRank().has(null, Rank.ADMIN, new Rank[] {Rank.CMOD, Rank.CMA}, false)) @@ -343,7 +352,23 @@ public class ClansFreezeManager extends MiniPlugin player.setWalkSpeed(walkSpeed); player.removePotionEffect(PotionEffectType.JUMP); } - UtilPlayer.message(player, F.main(getName(), "You have exited panic mode!")); + { + SlackMessage message = new SlackMessage("Clans Panic System", "crossed_swords", player.getName() + " has exited panic mode on " + UtilServer.getServerName() + "!"); + SlackAPI.getInstance().sendMessage(SlackTeam.CLANS, "#urgent", message, true); + SlackAPI.getInstance().sendMessage(SlackTeam.DEVELOPER, "#clans-commandspy", message, true); + SlackAPI.getInstance().sendMessage(SlackTeam.SOCIAL_MEDIA, "#streams-announcements", message, true); + } + for (Player alert : UtilServer.GetPlayers()) + { + if (_clientManager.Get(alert).GetRank().has(null, Rank.ADMIN, new Rank[] {Rank.CMOD, Rank.CMA}, false)) + { + UtilPlayer.message(alert, F.main(getName(), F.elem(player.getName()) + " has exited panic mode!")); + } + if (alert.getName().equals(player.getName())) + { + UtilPlayer.message(alert, F.main(getName(), "You have exited panic mode!")); + } + } } }