From 5951661748ed29c93e720ac2a9560c4734c436ec Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 29 Mar 2016 20:30:47 +1100 Subject: [PATCH] Remove outdated GCMod stuff, also allow disabling drawops on certain maps. --- Commands/Chat/CmdGlobal.cs | 4 +- Commands/Fun/CmdMapSet.cs | 11 ++++ Commands/Information/CmdDevs.cs | 38 -------------- Commands/Information/CmdGcmods.cs | 38 -------------- Commands/Information/CmdMods.cs | 38 -------------- Commands/Information/CmdPlayers.cs | 1 - Commands/Information/CmdStaff.cs | 80 +++++++++++++++++++++--------- Commands/Information/CmdWhois.cs | 1 - Commands/Information/CmdWhowas.cs | 1 - Drawing/DrawOps/DrawOp.cs | 4 ++ IRC/GlobalChatBot.cs | 2 - Levels/IO/LvlProperties.cs | 1 + Levels/Level.cs | 1 + MCGalaxy_.csproj | 3 -- Player/Player.Handlers.cs | 19 +++---- Player/Player.cs | 5 +- Server/Properties.cs | 2 +- Server/Server.Tasks.cs | 4 +- Server/Server.cs | 1 - 19 files changed, 89 insertions(+), 165 deletions(-) delete mode 100644 Commands/Information/CmdDevs.cs delete mode 100644 Commands/Information/CmdGcmods.cs delete mode 100644 Commands/Information/CmdMods.cs diff --git a/Commands/Chat/CmdGlobal.cs b/Commands/Chat/CmdGlobal.cs index 6c647bef1..85cbdba97 100644 --- a/Commands/Chat/CmdGlobal.cs +++ b/Commands/Chat/CmdGlobal.cs @@ -29,7 +29,9 @@ namespace MCGalaxy.Commands //bla public override void Use(Player p, string message) { - if (p != null && !p.verifiedName) { Player.SendMessage(p, "You can't use GC, because the server hasn't verify-names on"); return; } + if (p != null && !p.verifiedName) { + Player.SendMessage(p, "You cannot use global chat, because your name is not verified."); return; + } if (String.IsNullOrEmpty(message)) { p.InGlobalChat = !p.InGlobalChat; diff --git a/Commands/Fun/CmdMapSet.cs b/Commands/Fun/CmdMapSet.cs index 2072af352..53d5ac5f4 100644 --- a/Commands/Fun/CmdMapSet.cs +++ b/Commands/Fun/CmdMapSet.cs @@ -36,6 +36,9 @@ namespace MCGalaxy.Commands { Player.SendMessage(p, "Map authors: " + p.level.Authors); Player.SendMessage(p, "Pillaring allowed: " + p.level.Pillaring); Player.SendMessage(p, "Build type: " + p.level.BuildType); + Player.SendMessage(p, "Min round time: " + p.level.MinRoundTime + " minutes"); + Player.SendMessage(p, "Max round time: " + p.level.MaxRoundTime + " minutes"); + Player.SendMessage(p, "Drawing commands allowed: " + p.level.DrawingAllowed); return; } @@ -81,6 +84,13 @@ namespace MCGalaxy.Commands { } p.level.MaxRoundTime = time; Player.SendMessage(p, "Set max round time to: " + time + " minutes"); + } else if (args[0].CaselessEq("drawingallowed") || args[0].CaselessEq("drawingenabled")) { + bool value; + if (!bool.TryParse(args[1], out value)) { + Player.SendMessage(p, "Value must be 'true' or 'false'"); return; + } + p.level.DrawingAllowed = value; + Player.SendMessage(p, "Set drawing commands allowed to: " + value); } else { Player.SendMessage(p, "Unrecognised property \"" + args[0] + "\"."); return; } @@ -95,6 +105,7 @@ namespace MCGalaxy.Commands { Player.SendMessage(p, "%T/mapset build [normal/modifyonly/nomodify]"); Player.SendMessage(p, "%T/mapset minroundtime [minutes]"); Player.SendMessage(p, "%T/mapset maxroundtime [minutes]"); + Player.SendMessage(p, "%T/mapset drawingallowed [true/false]"); } } } diff --git a/Commands/Information/CmdDevs.cs b/Commands/Information/CmdDevs.cs deleted file mode 100644 index 686990bd4..000000000 --- a/Commands/Information/CmdDevs.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy) - - 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. -*/ -namespace MCGalaxy.Commands { - - public sealed class CmdDevs : Command { - - public override string name { get { return "devs"; } } - public override string shortcut { get { return "dev"; } } - public override string type { get { return CommandTypes.Information; } } - public override bool museumUsable { get { return true; } } - public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } - - public override void Use(Player p, string message) { - if ( message != "" ) { Help(p); return; } - string devlist = string.Join(", ", Server.Devs); - Player.SendMessage(p, "&9MCGalaxy Development Team: %S" + devlist + "&e."); - } - - public override void Help(Player p) { - Player.SendMessage(p, "/devs - Displays the list of MCGalaxy developers."); - } - } -} diff --git a/Commands/Information/CmdGcmods.cs b/Commands/Information/CmdGcmods.cs deleted file mode 100644 index b242cf827..000000000 --- a/Commands/Information/CmdGcmods.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy) - - 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. -*/ -namespace MCGalaxy.Commands { - - public sealed class CmdGcmods : Command { - - public override string name { get { return "gcmods"; } } - public override string shortcut { get { return "gcmod"; } } - public override string type { get { return CommandTypes.Information; } } - public override bool museumUsable { get { return true; } } - public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } - - public override void Use(Player p, string message) { - if (message != "") { Help(p); return; } - string gcmodlist = string.Join(", ", Server.GCmods); - Player.SendMessage(p, "&9MCGalaxy Global Chat Moderation Team: %S" + gcmodlist + "&e."); - } - - public override void Help(Player p) { - Player.SendMessage(p, "/gcmods - Displays the list of MCGalaxy global chat moderators."); - } - } -} diff --git a/Commands/Information/CmdMods.cs b/Commands/Information/CmdMods.cs deleted file mode 100644 index 57111e93b..000000000 --- a/Commands/Information/CmdMods.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy) - - 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. -*/ -namespace MCGalaxy.Commands { - - public sealed class CmdMods : Command { - - public override string name { get { return "mods"; } } - public override string shortcut { get { return "mod"; } } - public override string type { get { return CommandTypes.Information; } } - public override bool museumUsable { get { return true; } } - public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } - - public override void Use(Player p, string message) { - if (message != "") { Help(p); return; } - string modlist = string.Join(", ", Server.Mods); - Player.SendMessage(p, "&9MCGalaxy Moderation Team: %S" + modlist + "&e."); - } - - public override void Help(Player p) { - Player.SendMessage(p, "/mods - Displays the list of MCGalaxy moderators."); - } - } -} diff --git a/Commands/Information/CmdPlayers.cs b/Commands/Information/CmdPlayers.cs index 6b47002c8..9d1b400e9 100644 --- a/Commands/Information/CmdPlayers.cs +++ b/Commands/Information/CmdPlayers.cs @@ -88,7 +88,6 @@ namespace MCGalaxy.Commands if (pl.isDev) devSec.Append(pl, name); if (pl.isMod) modsSec.Append(pl, name); - if (pl.isGCMod) gcModsSec.Append(pl, name); playerList.Find(grp => grp.group == pl.group).Append(pl, name); } } diff --git a/Commands/Information/CmdStaff.cs b/Commands/Information/CmdStaff.cs index a97c257f1..038848708 100644 --- a/Commands/Information/CmdStaff.cs +++ b/Commands/Information/CmdStaff.cs @@ -1,24 +1,23 @@ /* - Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy) + Copyright 2010 MCLawl Team - Written by Valek (Modified for use with MCGalaxy) - 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. + 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. */ -namespace MCGalaxy.Commands -{ - public sealed class CmdStaff : Command - { +namespace MCGalaxy.Commands { + + public sealed class CmdStaff : Command { public override string name { get { return "staff"; } } public override string shortcut { get { return ""; } } public override string type { get { return CommandTypes.Information; } } @@ -26,17 +25,52 @@ namespace MCGalaxy.Commands public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } public CmdStaff() { } - public override void Use(Player p, string message) - { + public override void Use(Player p, string message) { if (message != "") { Help(p); return; } Command.all.Find("devs").Use(p, ""); Command.all.Find("mods").Use(p, ""); - //Command.all.Find("gcmods").Use(p, ""); } - public override void Help(Player p) - { + public override void Help(Player p) { Player.SendMessage(p, "/staff - Displays the MCGalaxy team."); } } + + public sealed class CmdMods : Command { + + public override string name { get { return "mods"; } } + public override string shortcut { get { return "mod"; } } + public override string type { get { return CommandTypes.Information; } } + public override bool museumUsable { get { return true; } } + public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } + + public override void Use(Player p, string message) { + if (message != "") { Help(p); return; } + string modlist = string.Join(", ", Server.Mods); + Player.SendMessage(p, "&9MCGalaxy Moderation Team: %S" + modlist + "&e."); + } + + public override void Help(Player p) { + Player.SendMessage(p, "/mods - Displays the list of MCGalaxy moderators."); + } + } + + public sealed class CmdDevs : Command { + + public override string name { get { return "devs"; } } + public override string shortcut { get { return "dev"; } } + public override string type { get { return CommandTypes.Information; } } + public override bool museumUsable { get { return true; } } + public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } + + public override void Use(Player p, string message) { + if (message != "") { Help(p); return; } + string devlist = string.Join(", ", Server.Devs); + Player.SendMessage(p, "&9MCGalaxy Development Team: %S" + devlist + "&e."); + } + + public override void Help(Player p) { + Player.SendMessage(p, "/devs - Displays the list of MCGalaxy developers."); + } + } } diff --git a/Commands/Information/CmdWhois.cs b/Commands/Information/CmdWhois.cs index 2705f188f..dee83369d 100644 --- a/Commands/Information/CmdWhois.cs +++ b/Commands/Information/CmdWhois.cs @@ -59,7 +59,6 @@ namespace MCGalaxy.Commands if (who.isDev) Player.SendMessage(p, "> > Player is a &9Developer"); else if (who.isMod) Player.SendMessage(p, "> > Player is a &9MCGalaxy Moderator"); - else if (who.isGCMod) Player.SendMessage(p, "> > Player is a &9Global Chat Moderator"); if (p == null || (int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) { string givenIP; diff --git a/Commands/Information/CmdWhowas.cs b/Commands/Information/CmdWhowas.cs index 883997287..aa41904eb 100644 --- a/Commands/Information/CmdWhowas.cs +++ b/Commands/Information/CmdWhowas.cs @@ -68,7 +68,6 @@ namespace MCGalaxy.Commands if (Server.Devs.ContainsInsensitive(message)) Player.SendMessage(p, "> > Player is a &9Developer"); else if (Server.Mods.ContainsInsensitive(message)) Player.SendMessage(p, "> > Player is a &9MCGalaxy Moderator"); - else if (Server.GCmods.ContainsInsensitive(message)) Player.SendMessage(p, "> > Player is a &9Global Chat Moderator"); if (p == null || (int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) { if (Server.bannedIP.Contains(target.ip)) diff --git a/Drawing/DrawOps/DrawOp.cs b/Drawing/DrawOps/DrawOp.cs index 4ee2ec248..7c6bdc8db 100644 --- a/Drawing/DrawOps/DrawOp.cs +++ b/Drawing/DrawOps/DrawOp.cs @@ -155,6 +155,10 @@ namespace MCGalaxy.Drawing.Ops { op.Max = Vec3U16.Max(op.Max, marks[i]); } op.Level = p.level; + if (!op.Level.DrawingAllowed) { + Player.SendMessage(p, "Drawing commands are turned off on this map."); + return false; + } long affected = 0; if (!op.CanDraw(marks, p, out affected)) diff --git a/IRC/GlobalChatBot.cs b/IRC/GlobalChatBot.cs index fd47a6570..048890298 100644 --- a/IRC/GlobalChatBot.cs +++ b/IRC/GlobalChatBot.cs @@ -320,8 +320,6 @@ namespace MCGalaxy message = "[Dev]" + message; else if(Server.Mods.ContainsInsensitive(message.Split(':')[0]) && !message.StartsWith("[Mod]") && !message.StartsWith("[Moderator]")) message = "[Mod]" + message; - else if (Server.GCmods.ContainsInsensitive(message.Split(':')[0]) && !message.StartsWith("[GCMod]")) - message = "[GCMod]" + message; /*try { if(GUI.GuiEvent != null) diff --git a/Levels/IO/LvlProperties.cs b/Levels/IO/LvlProperties.cs index a43d5e34c..39984cc70 100644 --- a/Levels/IO/LvlProperties.cs +++ b/Levels/IO/LvlProperties.cs @@ -86,6 +86,7 @@ namespace MCGalaxy.Levels.IO { writer.WriteLine("BuildType = " + level.BuildType); writer.WriteLine("MinRoundTime = " + level.MinRoundTime); writer.WriteLine("MaxRoundTime = " + level.MaxRoundTime); + writer.WriteLine("DrawingAllowed = " + level.DrawingAllowed); } static string GetName(LevelPermission perm) { diff --git a/Levels/Level.cs b/Levels/Level.cs index 68f05f897..5c49a2599 100644 --- a/Levels/Level.cs +++ b/Levels/Level.cs @@ -209,6 +209,7 @@ namespace MCGalaxy public bool CanPlace { get { return Buildable && BuildType != BuildType.NoModify; } } public bool CanDelete { get { return Deletable && BuildType != BuildType.NoModify; } } public int MinRoundTime = 4, MaxRoundTime = 7; + public bool DrawingAllowed = true; public Level(string n, ushort x, ushort y, ushort z, string type, int seed = 0, bool useSeed = false) { diff --git a/MCGalaxy_.csproj b/MCGalaxy_.csproj index 22c7866a3..56808e703 100644 --- a/MCGalaxy_.csproj +++ b/MCGalaxy_.csproj @@ -206,9 +206,7 @@ - - @@ -218,7 +216,6 @@ - diff --git a/Player/Player.Handlers.cs b/Player/Player.Handlers.cs index 27d70bf41..c218616b0 100644 --- a/Player/Player.Handlers.cs +++ b/Player/Player.Handlers.cs @@ -256,17 +256,16 @@ namespace MCGalaxy { } string verify = enc.GetString(message, 65, 32).Trim(); - if (Server.verify) - { - if (verify == "--" || verify != - BitConverter.ToString(md5.ComputeHash(enc.GetBytes(Server.salt + truename))) - .Replace("-", "").ToLower()) - { - if (!IPInPrivateRange(ip)) - { + verifiedName = false; + if (Server.verify) { + string hash = BitConverter.ToString(md5.ComputeHash(enc.GetBytes(Server.salt + truename))); + if (!verify.CaselessEq(hash.Replace("-", ""))) { + if (!IPInPrivateRange(ip)) { Kick("Login failed! Try signing in again.", true); return; } - } + } else { + verifiedName = true; + } } DisplayName = name; SkinName = name; @@ -275,8 +274,6 @@ namespace MCGalaxy { isDev = Server.Devs.ContainsInsensitive(name); isMod = Server.Mods.ContainsInsensitive(name); - isGCMod = Server.GCmods.ContainsInsensitive(name); - verifiedName = Server.verify; try { Server.TempBan tBan = Server.tempBans.Find(tB => tB.name.ToLower() == name.ToLower()); diff --git a/Player/Player.cs b/Player/Player.cs index aebc2dca6..a9c3793a5 100644 --- a/Player/Player.cs +++ b/Player/Player.cs @@ -310,7 +310,7 @@ namespace MCGalaxy { public bool InGlobalChat { get; set; } public Dictionary sounds = new Dictionary(); - public bool isDev, isMod, isGCMod; //is this player a dev/mod/gcmod? + public bool isDev, isMod; public bool isStaff; public bool verifiedName; @@ -330,8 +330,7 @@ namespace MCGalaxy { prefix = team != null ? "<" + team.Color + team.Name + color + "> " : ""; string viptitle = isDev ? string.Format("{1}[{0}Dev{1}] ", Colors.blue, color) : - isMod ? string.Format("{1}[{0}Mod{1}] ", Colors.lime, color) - : isGCMod ? string.Format("{1}[{0}GCMod{1}] ", Colors.gold, color) : ""; + isMod ? string.Format("{1}[{0}Mod{1}] ", Colors.lime, color) : ""; prefix = prefix + viptitle; prefix = (title == "") ? prefix : prefix + color + "[" + titlecolor + title + color + "] "; } diff --git a/Server/Properties.cs b/Server/Properties.cs index 58374f57f..7ac73a325 100644 --- a/Server/Properties.cs +++ b/Server/Properties.cs @@ -627,7 +627,7 @@ namespace MCGalaxy { public static void SaveProps(StreamWriter w) { w.WriteLine("# Edit the settings below to modify how your server operates. This is an explanation of what each setting does."); - w.WriteLine("# server-name\t\t\t\t= The name which displays on minecraft.net"); + w.WriteLine("# server-name\t\t\t\t= The name which displays on classicube.net"); w.WriteLine("# motd\t\t\t\t= The message which displays when a player connects"); w.WriteLine("# port\t\t\t\t= The port to operate from"); w.WriteLine("# console-only\t\t\t= Run without a GUI (useful for Linux servers with mono)"); diff --git a/Server/Server.Tasks.cs b/Server/Server.Tasks.cs index 5715ca263..50f727ee0 100644 --- a/Server/Server.Tasks.cs +++ b/Server/Server.Tasks.cs @@ -200,7 +200,6 @@ namespace MCGalaxy { void UpdateStaffList() { Devs.Clear(); Mods.Clear(); - GCmods.Clear(); ml.Queue(UpdateStaffListTask); } @@ -210,7 +209,7 @@ namespace MCGalaxy { string[] result = web.DownloadString(staffUrl).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); foreach (string line in result) { string type = line.Split(':')[0].ToLower(); - List staffList = type.Equals("devs") ? Devs : type.Equals("mods") ? Mods : type.Equals("gcmods") ? GCmods : null; + List staffList = type.Equals("devs") ? Devs : type.Equals("mods") ? Mods : null; foreach (string name in line.Split(':')[1].Split()) staffList.Add(name); } @@ -220,7 +219,6 @@ namespace MCGalaxy { s.Log("Failed to update MCGalaxy staff list."); Devs.Clear(); Mods.Clear(); - GCmods.Clear(); } } } diff --git a/Server/Server.cs b/Server/Server.cs index 287458ef0..d7640f320 100644 --- a/Server/Server.cs +++ b/Server/Server.cs @@ -107,7 +107,6 @@ namespace MCGalaxy public static readonly List Devs = new List(); public static readonly List Mods = new List(); - public static readonly List GCmods = new List(); internal static readonly List protectover = new List(new string[] { "moderate", "mute", "freeze", "lockdown", "ban", "banip", "kickban", "kick", "global", "xban", "xundo", "undo", "uban", "unban", "unbanip", "demote", "promote", "restart", "shutdown", "setrank", "warn", "tempban", "impersonate", "sendcmd", "possess", "joker", "jail", "ignore", "voice" }); public static List ProtectOver { get { return new List(protectover); } }