Remove outdated GCMod stuff, also allow disabling drawops on certain maps.

This commit is contained in:
UnknownShadow200 2016-03-29 20:30:47 +11:00
parent ef8c7b57a1
commit 5951661748
19 changed files with 89 additions and 165 deletions

View File

@ -29,7 +29,9 @@ namespace MCGalaxy.Commands
//bla //bla
public override void Use(Player p, string message) 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)) { if (String.IsNullOrEmpty(message)) {
p.InGlobalChat = !p.InGlobalChat; p.InGlobalChat = !p.InGlobalChat;

View File

@ -36,6 +36,9 @@ namespace MCGalaxy.Commands {
Player.SendMessage(p, "Map authors: " + p.level.Authors); Player.SendMessage(p, "Map authors: " + p.level.Authors);
Player.SendMessage(p, "Pillaring allowed: " + p.level.Pillaring); Player.SendMessage(p, "Pillaring allowed: " + p.level.Pillaring);
Player.SendMessage(p, "Build type: " + p.level.BuildType); 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; return;
} }
@ -81,6 +84,13 @@ namespace MCGalaxy.Commands {
} }
p.level.MaxRoundTime = time; p.level.MaxRoundTime = time;
Player.SendMessage(p, "Set max round time to: " + time + " minutes"); 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 { } else {
Player.SendMessage(p, "Unrecognised property \"" + args[0] + "\"."); return; 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 build [normal/modifyonly/nomodify]");
Player.SendMessage(p, "%T/mapset minroundtime [minutes]"); Player.SendMessage(p, "%T/mapset minroundtime [minutes]");
Player.SendMessage(p, "%T/mapset maxroundtime [minutes]"); Player.SendMessage(p, "%T/mapset maxroundtime [minutes]");
Player.SendMessage(p, "%T/mapset drawingallowed [true/false]");
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -88,7 +88,6 @@ namespace MCGalaxy.Commands
if (pl.isDev) devSec.Append(pl, name); if (pl.isDev) devSec.Append(pl, name);
if (pl.isMod) modsSec.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); playerList.Find(grp => grp.group == pl.group).Append(pl, name);
} }
} }

View File

@ -15,10 +15,9 @@
or implied. See the Licenses for the specific language governing or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses. permissions and limitations under the Licenses.
*/ */
namespace MCGalaxy.Commands namespace MCGalaxy.Commands {
{
public sealed class CmdStaff : Command public sealed class CmdStaff : Command {
{
public override string name { get { return "staff"; } } public override string name { get { return "staff"; } }
public override string shortcut { get { return ""; } } public override string shortcut { get { return ""; } }
public override string type { get { return CommandTypes.Information; } } public override string type { get { return CommandTypes.Information; } }
@ -26,17 +25,52 @@ namespace MCGalaxy.Commands
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } } public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }
public CmdStaff() { } public CmdStaff() { }
public override void Use(Player p, string message) public override void Use(Player p, string message) {
{
if (message != "") { Help(p); return; } if (message != "") { Help(p); return; }
Command.all.Find("devs").Use(p, ""); Command.all.Find("devs").Use(p, "");
Command.all.Find("mods").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."); 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.");
}
}
} }

View File

@ -59,7 +59,6 @@ namespace MCGalaxy.Commands
if (who.isDev) Player.SendMessage(p, "> > Player is a &9Developer"); 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.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)) { if (p == null || (int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) {
string givenIP; string givenIP;

View File

@ -68,7 +68,6 @@ namespace MCGalaxy.Commands
if (Server.Devs.ContainsInsensitive(message)) Player.SendMessage(p, "> > Player is a &9Developer"); 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.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 (p == null || (int)p.group.Permission >= CommandOtherPerms.GetPerm(this)) {
if (Server.bannedIP.Contains(target.ip)) if (Server.bannedIP.Contains(target.ip))

View File

@ -155,6 +155,10 @@ namespace MCGalaxy.Drawing.Ops {
op.Max = Vec3U16.Max(op.Max, marks[i]); op.Max = Vec3U16.Max(op.Max, marks[i]);
} }
op.Level = p.level; op.Level = p.level;
if (!op.Level.DrawingAllowed) {
Player.SendMessage(p, "Drawing commands are turned off on this map.");
return false;
}
long affected = 0; long affected = 0;
if (!op.CanDraw(marks, p, out affected)) if (!op.CanDraw(marks, p, out affected))

View File

@ -320,8 +320,6 @@ namespace MCGalaxy
message = "[Dev]" + message; message = "[Dev]" + message;
else if(Server.Mods.ContainsInsensitive(message.Split(':')[0]) && !message.StartsWith("[Mod]") && !message.StartsWith("[Moderator]")) else if(Server.Mods.ContainsInsensitive(message.Split(':')[0]) && !message.StartsWith("[Mod]") && !message.StartsWith("[Moderator]"))
message = "[Mod]" + message; message = "[Mod]" + message;
else if (Server.GCmods.ContainsInsensitive(message.Split(':')[0]) && !message.StartsWith("[GCMod]"))
message = "[GCMod]" + message;
/*try { /*try {
if(GUI.GuiEvent != null) if(GUI.GuiEvent != null)

View File

@ -86,6 +86,7 @@ namespace MCGalaxy.Levels.IO {
writer.WriteLine("BuildType = " + level.BuildType); writer.WriteLine("BuildType = " + level.BuildType);
writer.WriteLine("MinRoundTime = " + level.MinRoundTime); writer.WriteLine("MinRoundTime = " + level.MinRoundTime);
writer.WriteLine("MaxRoundTime = " + level.MaxRoundTime); writer.WriteLine("MaxRoundTime = " + level.MaxRoundTime);
writer.WriteLine("DrawingAllowed = " + level.DrawingAllowed);
} }
static string GetName(LevelPermission perm) { static string GetName(LevelPermission perm) {

View File

@ -209,6 +209,7 @@ namespace MCGalaxy
public bool CanPlace { get { return Buildable && BuildType != BuildType.NoModify; } } public bool CanPlace { get { return Buildable && BuildType != BuildType.NoModify; } }
public bool CanDelete { get { return Deletable && BuildType != BuildType.NoModify; } } public bool CanDelete { get { return Deletable && BuildType != BuildType.NoModify; } }
public int MinRoundTime = 4, MaxRoundTime = 7; 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) public Level(string n, ushort x, ushort y, ushort z, string type, int seed = 0, bool useSeed = false)
{ {

View File

@ -206,9 +206,7 @@
<Compile Include="Commands\Information\CmdAfk.cs" /> <Compile Include="Commands\Information\CmdAfk.cs" />
<Compile Include="Commands\Information\CmdBlocks.cs" /> <Compile Include="Commands\Information\CmdBlocks.cs" />
<Compile Include="Commands\Information\CmdClones.cs" /> <Compile Include="Commands\Information\CmdClones.cs" />
<Compile Include="Commands\Information\CmdDevs.cs" />
<Compile Include="Commands\Information\CmdFaq.cs" /> <Compile Include="Commands\Information\CmdFaq.cs" />
<Compile Include="Commands\Information\CmdGcmods.cs" />
<Compile Include="Commands\Information\CmdHasirc.cs" /> <Compile Include="Commands\Information\CmdHasirc.cs" />
<Compile Include="Commands\Information\CmdHelp.cs" /> <Compile Include="Commands\Information\CmdHelp.cs" />
<Compile Include="Commands\Information\CmdHost.cs" /> <Compile Include="Commands\Information\CmdHost.cs" />
@ -218,7 +216,6 @@
<Compile Include="Commands\Information\CmdLevels.cs" /> <Compile Include="Commands\Information\CmdLevels.cs" />
<Compile Include="Commands\Information\CmdMapInfo.cs" /> <Compile Include="Commands\Information\CmdMapInfo.cs" />
<Compile Include="Commands\Information\CmdMeasure.cs" /> <Compile Include="Commands\Information\CmdMeasure.cs" />
<Compile Include="Commands\Information\CmdMods.cs" />
<Compile Include="Commands\Information\CmdNews.cs" /> <Compile Include="Commands\Information\CmdNews.cs" />
<Compile Include="Commands\Information\CmdOpRules.cs" /> <Compile Include="Commands\Information\CmdOpRules.cs" />
<Compile Include="Commands\Information\CmdOpStats.cs" /> <Compile Include="Commands\Information\CmdOpStats.cs" />

View File

@ -256,16 +256,15 @@ namespace MCGalaxy {
} }
string verify = enc.GetString(message, 65, 32).Trim(); string verify = enc.GetString(message, 65, 32).Trim();
if (Server.verify) verifiedName = false;
{ if (Server.verify) {
if (verify == "--" || verify != string hash = BitConverter.ToString(md5.ComputeHash(enc.GetBytes(Server.salt + truename)));
BitConverter.ToString(md5.ComputeHash(enc.GetBytes(Server.salt + truename))) if (!verify.CaselessEq(hash.Replace("-", ""))) {
.Replace("-", "").ToLower()) if (!IPInPrivateRange(ip)) {
{
if (!IPInPrivateRange(ip))
{
Kick("Login failed! Try signing in again.", true); return; Kick("Login failed! Try signing in again.", true); return;
} }
} else {
verifiedName = true;
} }
} }
DisplayName = name; DisplayName = name;
@ -275,8 +274,6 @@ namespace MCGalaxy {
isDev = Server.Devs.ContainsInsensitive(name); isDev = Server.Devs.ContainsInsensitive(name);
isMod = Server.Mods.ContainsInsensitive(name); isMod = Server.Mods.ContainsInsensitive(name);
isGCMod = Server.GCmods.ContainsInsensitive(name);
verifiedName = Server.verify;
try { try {
Server.TempBan tBan = Server.tempBans.Find(tB => tB.name.ToLower() == name.ToLower()); Server.TempBan tBan = Server.tempBans.Find(tB => tB.name.ToLower() == name.ToLower());

View File

@ -310,7 +310,7 @@ namespace MCGalaxy {
public bool InGlobalChat { get; set; } public bool InGlobalChat { get; set; }
public Dictionary<string, string> sounds = new Dictionary<string, string>(); public Dictionary<string, string> sounds = new Dictionary<string, string>();
public bool isDev, isMod, isGCMod; //is this player a dev/mod/gcmod? public bool isDev, isMod;
public bool isStaff; public bool isStaff;
public bool verifiedName; public bool verifiedName;
@ -330,8 +330,7 @@ namespace MCGalaxy {
prefix = team != null ? "<" + team.Color + team.Name + color + "> " : ""; prefix = team != null ? "<" + team.Color + team.Name + color + "> " : "";
string viptitle = isDev ? string.Format("{1}[{0}Dev{1}] ", Colors.blue, color) : string viptitle = isDev ? string.Format("{1}[{0}Dev{1}] ", Colors.blue, color) :
isMod ? string.Format("{1}[{0}Mod{1}] ", Colors.lime, color) isMod ? string.Format("{1}[{0}Mod{1}] ", Colors.lime, color) : "";
: isGCMod ? string.Format("{1}[{0}GCMod{1}] ", Colors.gold, color) : "";
prefix = prefix + viptitle; prefix = prefix + viptitle;
prefix = (title == "") ? prefix : prefix + color + "[" + titlecolor + title + color + "] "; prefix = (title == "") ? prefix : prefix + color + "[" + titlecolor + title + color + "] ";
} }

View File

@ -627,7 +627,7 @@ namespace MCGalaxy {
public static void SaveProps(StreamWriter w) { 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("# 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("# 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("# 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)"); w.WriteLine("# console-only\t\t\t= Run without a GUI (useful for Linux servers with mono)");

View File

@ -200,7 +200,6 @@ namespace MCGalaxy {
void UpdateStaffList() { void UpdateStaffList() {
Devs.Clear(); Devs.Clear();
Mods.Clear(); Mods.Clear();
GCmods.Clear();
ml.Queue(UpdateStaffListTask); ml.Queue(UpdateStaffListTask);
} }
@ -210,7 +209,7 @@ namespace MCGalaxy {
string[] result = web.DownloadString(staffUrl).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); string[] result = web.DownloadString(staffUrl).Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
foreach (string line in result) { foreach (string line in result) {
string type = line.Split(':')[0].ToLower(); string type = line.Split(':')[0].ToLower();
List<string> staffList = type.Equals("devs") ? Devs : type.Equals("mods") ? Mods : type.Equals("gcmods") ? GCmods : null; List<string> staffList = type.Equals("devs") ? Devs : type.Equals("mods") ? Mods : null;
foreach (string name in line.Split(':')[1].Split()) foreach (string name in line.Split(':')[1].Split())
staffList.Add(name); staffList.Add(name);
} }
@ -220,7 +219,6 @@ namespace MCGalaxy {
s.Log("Failed to update MCGalaxy staff list."); s.Log("Failed to update MCGalaxy staff list.");
Devs.Clear(); Devs.Clear();
Mods.Clear(); Mods.Clear();
GCmods.Clear();
} }
} }
} }

View File

@ -107,7 +107,6 @@ namespace MCGalaxy
public static readonly List<string> Devs = new List<string>(); public static readonly List<string> Devs = new List<string>();
public static readonly List<string> Mods = new List<string>(); public static readonly List<string> Mods = new List<string>();
public static readonly List<string> GCmods = new List<string>();
internal static readonly List<string> protectover = new List<string>(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" }); internal static readonly List<string> protectover = new List<string>(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<string> ProtectOver { get { return new List<string>(protectover); } } public static List<string> ProtectOver { get { return new List<string>(protectover); } }