Make panic mode alert appropriate slack teams/channels

This commit is contained in:
AlexTheCoder 2017-08-28 20:06:02 -04:00
parent d623b07187
commit 19988a8951
4 changed files with 33 additions and 4 deletions

View File

@ -11,6 +11,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"),
;
private String _title;

View File

@ -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!"));
}
}
}
}