From 6f06dff408cf052302bc369e87e2bea7db9a9ce8 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 25 Mar 2016 09:35:56 +1100 Subject: [PATCH] Cleanup /gcrules. --- Commands/Chat/CmdGcrules.cs | 59 +++++++++++++------------------------ Commands/Chat/CmdGlobal.cs | 13 ++++---- Player/Player.Handlers.cs | 2 +- Player/Player.cs | 2 -- 4 files changed, 28 insertions(+), 48 deletions(-) diff --git a/Commands/Chat/CmdGcrules.cs b/Commands/Chat/CmdGcrules.cs index 0743a7f29..c03fb1fed 100644 --- a/Commands/Chat/CmdGcrules.cs +++ b/Commands/Chat/CmdGcrules.cs @@ -1,19 +1,19 @@ /* - Copyright 2011 MCForge - - Dual-licensed under the Educational Community License, Version 2.0 and - the GNU General Public License, Version 3 (the "Licenses"); you may - not use this file except in compliance with the Licenses. You may - obtain a copy of the Licenses at - - http://www.opensource.org/licenses/ecl2.php - http://www.gnu.org/licenses/gpl-3.0.html - - Unless required by applicable law or agreed to in writing, - software distributed under the Licenses are distributed on an "AS IS" - BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - or implied. See the Licenses for the specific language governing - permissions and limitations under the Licenses. + Copyright 2011 MCForge + + Dual-licensed under the Educational Community License, Version 2.0 and + the GNU General Public License, Version 3 (the "Licenses"); you may + not use this file except in compliance with the Licenses. You may + obtain a copy of the Licenses at + + http://www.opensource.org/licenses/ecl2.php + http://www.gnu.org/licenses/gpl-3.0.html + + Unless required by applicable law or agreed to in writing, + software distributed under the Licenses are distributed on an "AS IS" + BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + or implied. See the Licenses for the specific language governing + permissions and limitations under the Licenses. */ using System; namespace MCGalaxy.Commands @@ -26,31 +26,12 @@ namespace MCGalaxy.Commands public override bool museumUsable { get { return true; } } public override LevelPermission defaultRank { get { return LevelPermission.Guest; } } public CmdGcrules() { } - //bla - public override void Use(Player p, string message) - { - RulesMethod(p); - p.Readgcrules = true; - p.Timereadgcrules = DateTime.Now; + + public override void Use(Player p, string message) { + CmdGlobal.ShowRules(p, false); } - public void RulesMethod(Player p) - { - Player.SendMessage(p, "&cBy using the Global Chat you agree to the following rules:"); - Player.SendMessage(p, "1. No Spamming"); - Player.SendMessage(p, "2. No Advertising (Trying to get people to come to your server)"); - Player.SendMessage(p, "3. No links"); - Player.SendMessage(p, "4. No Excessive Cursing (You are allowed to curse, but not pointed at anybody)"); - Player.SendMessage(p, "5. No use of $ Variables."); - Player.SendMessage(p, "6. English only. No exceptions."); - Player.SendMessage(p, "7. Be respectful"); - Player.SendMessage(p, "8. Do not ask for ranks"); - Player.SendMessage(p, "9. Do not ask for a server name"); - Player.SendMessage(p, "10. Use common sense."); - Player.SendMessage(p, "11. Don't say any server name"); - - } - public override void Help(Player p) - { + + public override void Help(Player p) { Player.SendMessage(p, "/gcrules - Shows global chat rules"); Player.SendMessage(p, "To chat in global chat, use /global"); } diff --git a/Commands/Chat/CmdGlobal.cs b/Commands/Chat/CmdGlobal.cs index 4355fefec..aba2864bd 100644 --- a/Commands/Chat/CmdGlobal.cs +++ b/Commands/Chat/CmdGlobal.cs @@ -43,14 +43,14 @@ namespace MCGalaxy.Commands if (p.muted) { Player.SendMessage(p, "You are muted."); return; } if (p.ignoreGlobalChat || p.ignoreAll) { Player.SendMessage(p, "You cannot use Global Chat while you have it muted."); return; } if (Server.chatmod && !p.voice) { Player.SendMessage(p, "You cannot use Global Chat while in Chat Moderation!"); return; } - if (!Server.gcaccepted.Contains(p.name.ToLower())) { RulesMethod(p); return; } + if (!Server.gcaccepted.Contains(p.name.ToLower())) { ShowRules(p, true); return; } } //Server.GlobalChat.Say((p != null ? p.name + ": " : "Console: ") + message, p); Server.GlobalChat.Say(p == null ? "Console: " + message : p.name + ": " + message, p); Player.GlobalMessage("%G<[Global] " + (p != null ? p.name + ": " : "Console: ") + "&f" + (Server.profanityFilter ? ProfanityFilter.Parse(message) : message), true); } - public void RulesMethod(Player p) - { + + public static void ShowRules(Player p, bool showAccept) { Player.SendMessage(p, "&cBy using the Global Chat you agree to the following rules:"); Player.SendMessage(p, "1. No Spamming"); Player.SendMessage(p, "2. No Advertising (Trying to get people to your server)"); @@ -63,10 +63,11 @@ namespace MCGalaxy.Commands Player.SendMessage(p, "9. Do not ask for a server name"); Player.SendMessage(p, "10. Use common sense."); Player.SendMessage(p, "11. Don't say any server name"); - Player.SendMessage(p, "&3Type /gcaccept to accept these rules"); + if (showAccept) + Player.SendMessage(p, "&3Type /gcaccept to accept these rules"); } - public override void Help(Player p) - { + + public override void Help(Player p) { Player.SendMessage(p, "/global [message] - Send a message to Global Chat."); } } diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index 8ad6e8648..e561cd748 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -264,7 +264,7 @@ namespace MCGalaxy { { if (!IPInPrivateRange(ip)) { - Kick("Login failed! Try again.", true); return; + Kick("Login failed! Try signing in again.", true); return; } } } diff --git a/Player/Player.cs b/Player/Player.cs index e6799266d..9100dd2ad 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -335,8 +335,6 @@ namespace MCGalaxy { prefix = (title == "") ? prefix : prefix + color + "[" + titlecolor + title + color + "] "; } - public bool Readgcrules = false; - public DateTime Timereadgcrules = DateTime.MinValue; public bool CheckIfInsideBlock() { ushort x = (ushort)(pos[0] / 32), y = (ushort)(pos[1] / 32), z = (ushort)(pos[2] / 32); byte head = level.GetTile(x, y, z);