From c856372f079fe81130cc38eed305b4631c970777 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sun, 4 Jun 2017 09:22:30 +1000 Subject: [PATCH] Secret commands now log who used them to server logs and can't be used when muted --- MCGalaxy/CorePlugin/ChatHandler.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/MCGalaxy/CorePlugin/ChatHandler.cs b/MCGalaxy/CorePlugin/ChatHandler.cs index a7cf73069..31891a765 100644 --- a/MCGalaxy/CorePlugin/ChatHandler.cs +++ b/MCGalaxy/CorePlugin/ChatHandler.cs @@ -17,6 +17,7 @@ */ using System; using MCGalaxy.Events; +using MCGalaxy.Commands.Chatting; namespace MCGalaxy.Core { @@ -27,23 +28,27 @@ namespace MCGalaxy.Core { //DO NOT REMOVE THE TWO COMMANDS BELOW, /PONY AND /RAINBOWDASHLIKESCOOLTHINGS. -EricKilla if (cmd == "pony") { + Plugin.CancelPlayerEvent(PlayerEvents.PlayerCommand, p); + if (!MessageCmd.CanSpeak(p, cmd)) return; + if (p.ponycount < 2) { Chat.MessageGlobal("{0} %Sjust so happens to be a proud brony! Everyone give {0} %Sa brohoof!", p.ColoredName); + Server.s.CommandUsed(p.name + " used /" + cmd); } else { Player.Message(p, "You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); } - p.ponycount++; - Plugin.CancelPlayerEvent(PlayerEvents.PlayerCommand, p); } else if (cmd == "rainbowdashlikescoolthings") { + Plugin.CancelPlayerEvent(PlayerEvents.PlayerCommand, p); + if (!MessageCmd.CanSpeak(p, cmd)) return; + if (p.rdcount < 2) { - Chat.MessageGlobal("&4T&6H&eI&aS&3 S&9E&1R&4V&6E&eR &aJ&3U&9S&1T &4G&6O&eT &a2&30 &9P&1E&4R&6C&eE&aN&3T &9C&1O&4O&6L&eE&aR&3!"); + Chat.MessageGlobal("&4T&6H&eI&aS&3 S&9E&1R&4V&6E&eR &aJ&3U&9S&1T &4G&6O&eT &a2&30 &9P&1E&4R&6C&eE&aN&3T &9C&1O&4O&6L&eE&aR&3!"); + Server.s.CommandUsed(p.name + " used /" + cmd); } else { Player.Message(p, "You have used this command 2 times. You cannot use it anymore! Sorry, Brony!"); - } - + } p.rdcount++; - Plugin.CancelPlayerEvent(PlayerEvents.PlayerCommand, p); } } }