diff --git a/Commands/Moderation/CmdZone.cs b/Commands/Moderation/CmdZone.cs index 6fe6a244e..5ac1d8fcd 100644 --- a/Commands/Moderation/CmdZone.cs +++ b/Commands/Moderation/CmdZone.cs @@ -103,27 +103,11 @@ namespace MCGalaxy.Commands { } bool CheckZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) { - Level lvl = p.level; Vec3S32 P = marks[0]; - string owners = ""; - - for (int i = 0; i < lvl.ZoneList.Count; i++) { - Level.Zone zn = lvl.ZoneList[i]; - if (P.X < zn.smallX || P.X > zn.bigX || P.Y < zn.smallY || P.Y > zn.bigY || P.Z < zn.smallZ || P.Z > zn.bigZ) - continue; - - if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) - owners += ", " + zn.Owner.Substring(3); - else if (zn.Owner != "") - owners += ", " + zn.Owner; - } - - if (owners.Length == 0) - Player.Message(p, "No zones affect this block."); - else - Player.Message(p, "This zone belongs to &b{0}.", owners.Remove(0, 2)); + string zoneMsg = p.level.FindZoneOwners((ushort)P.X, (ushort)P.Y, (ushort)P.Z); + Player.Message(p, zoneMsg); return true; - } + } bool DeleteZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) { Level lvl = p.level; diff --git a/Commands/World/CmdBlockDB.cs b/Commands/World/CmdBlockDB.cs index b5bb07710..d822d9fd8 100644 --- a/Commands/World/CmdBlockDB.cs +++ b/Commands/World/CmdBlockDB.cs @@ -49,7 +49,7 @@ namespace MCGalaxy.Commands.World { Player.Message(p, "Cleared &cALL %Sblock changes for &d" + lvl.name); } else if (args[0] == "disable") { lvl.UseBlockDB = false; - Player.Message(p, "&cDisabled %Srecording further block changesfor &d" + lvl.name); + Player.Message(p, "&cDisabled %Srecording further block changes for &d" + lvl.name); Level.SaveSettings(lvl); } else if (args[0] == "enable") { lvl.UseBlockDB = true; diff --git a/Levels/Level.Blocks.cs b/Levels/Level.Blocks.cs index a32bea1e6..364a6c3f4 100644 --- a/Levels/Level.Blocks.cs +++ b/Levels/Level.Blocks.cs @@ -175,23 +175,18 @@ namespace MCGalaxy { bool CheckZonePerms(Player p, ushort x, ushort y, ushort z, ref bool inZone) { if (p.Rank < LevelPermission.Admin) { - string owners = ""; - bool zoneAllow = FindZones(p, x, y, z, ref inZone, ref owners); + bool zoneAllow = FindZones(p, x, y, z, ref inZone); if (zoneAllow) return true; if (p.ZoneSpam > DateTime.UtcNow) return false; - if (owners != "") - Player.Message(p, "This zone belongs to &b" + owners.Remove(0, 2) + "."); - else - Player.Message(p, "This zone belongs to no one."); + Player.Message(p, FindZoneOwners(x, y, z)); p.ZoneSpam = DateTime.UtcNow.AddSeconds(2); return false; } return true; } - bool FindZones(Player p, ushort x, ushort y, ushort z, - ref bool inZone, ref string Owners) { + bool FindZones(Player p, ushort x, ushort y, ushort z, ref bool inZone) { if (ZoneList.Count == 0) return true; bool zoneAllow = true; @@ -204,16 +199,32 @@ namespace MCGalaxy { if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) { string grpName = zn.Owner.Substring(3); if (Group.Find(grpName).Permission <= p.Rank) return true; - Owners += ", " + grpName; } else { if (zn.Owner.CaselessEq(p.name)) return true; - Owners += ", " + zn.Owner; } zoneAllow = false; } return zoneAllow; } + internal string FindZoneOwners(ushort x, ushort y, ushort z) { + string owners = ""; + for (int i = 0; i < ZoneList.Count; i++) { + Zone zn = ZoneList[i]; + if (x < zn.smallX || x > zn.bigX || y < zn.smallY || y > zn.bigY || z < zn.smallZ || z > zn.bigZ) + continue; + + if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) { + owners += ", " + zn.Owner.Substring(3); + } else { + owners += ", " + zn.Owner; + } + } + + if (owners == "") return "No zones affect this block"; + return "This zone belongs to &b" + owners.Remove(0, 2) + "."; + } + bool CheckRank(Player p) { if (p.ZoneSpam <= DateTime.UtcNow) { BuildAccess.CheckDetailed(p, false); diff --git a/Server/Server.Fields.cs b/Server/Server.Fields.cs index b8ad329d0..960a1a840 100644 --- a/Server/Server.Fields.cs +++ b/Server/Server.Fields.cs @@ -292,18 +292,18 @@ namespace MCGalaxy { public static string MySQLPassword = "password"; [ConfigString("DatabaseName", "Database", null, "MCZallDB")] public static string MySQLDatabaseName = "MCZallDB"; - [ConfigBool("Pooling", "Database", null, true)] + [ConfigBool("Pooling", "Database", null, true)] public static bool DatabasePooling = true; [ConfigColor("defaultColor", "Colors", null, "&e")] public static string DefaultColor = "&e"; [ConfigColor("irc-color", "Colors", null, "&5")] public static string IRCColour = "&5"; - [ConfigColor("global-chat-color", "Colors", null, "&6")] + [ConfigColor("global-chat-color", "Colors", null, "&6")] public static string GlobalChatColor = "&6"; - [ConfigColor("help-syntax-color", "Colors", null, "&a")] + [ConfigColor("help-syntax-color", "Colors", null, "&a")] public static string HelpSyntaxColor = "&a"; - [ConfigColor("help-desc-color", "Colors", null, "&e")] + [ConfigColor("help-desc-color", "Colors", null, "&e")] public static string HelpDescriptionColor = "&e"; [ConfigBool("global-chat-enabled", "Other", null, true)] @@ -320,7 +320,7 @@ namespace MCGalaxy { [ConfigBool("dollar-before-dollar", "Other", null, true)] public static bool dollarNames = true; public static bool unsafe_plugin = true; - [ConfigBool("cheapmessage", "Other", null, true)] + [ConfigBool("cheapmessage", "Other", null, true)] public static bool cheapMessage = true; [ConfigString("cheap-message-given", "Messages", null, " is now being cheap and being immortal")]