mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Remove /ozone and make it part of /zone with /zone map.
This commit is contained in:
parent
111618295a
commit
175e9c14e0
@ -148,7 +148,7 @@ namespace MCGalaxy.Commands
|
||||
if (osPerm == LevelPermission.Nobody)
|
||||
osPerm = GrpCommands.MinPerm(this);
|
||||
|
||||
ZoneAll(lvl, p.name);
|
||||
CmdZone.ZoneAll(lvl, p.name);
|
||||
Group grp = Group.findPerm(osPerm);
|
||||
if (grp != null) {
|
||||
Command.all.Find("perbuild").Use(null, lvl.name + " " + grp.name);
|
||||
@ -249,7 +249,7 @@ namespace MCGalaxy.Commands
|
||||
Player.Message(p, "You did not specify a name to allow building on your map."); return;
|
||||
}
|
||||
|
||||
ZoneAll(p.level, value);
|
||||
CmdZone.ZoneAll(p.level, value);
|
||||
Player.Message(p, "Added zone for &b" + value);
|
||||
Player.Message(p, value + " has been allowed building on your map.");
|
||||
} else if (cmd == "DEL") {
|
||||
@ -320,17 +320,6 @@ namespace MCGalaxy.Commands
|
||||
}
|
||||
}
|
||||
|
||||
static void ZoneAll(Level lvl, string owner) {
|
||||
Level.Zone zn = default(Level.Zone);
|
||||
zn.bigX = (ushort)(lvl.Width - 1);
|
||||
zn.bigY = (ushort)(lvl.Height - 1);
|
||||
zn.bigZ = (ushort)(lvl.Length - 1);
|
||||
zn.Owner = owner;
|
||||
|
||||
lvl.ZoneList.Add(zn);
|
||||
LevelDB.CreateZone(lvl.name, zn);
|
||||
}
|
||||
|
||||
static void EnsureFileExists(string path) {
|
||||
if (!Directory.Exists("levels/blacklists/"))
|
||||
Directory.CreateDirectory("levels/blacklists/");
|
||||
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
namespace MCGalaxy.Commands {
|
||||
public sealed class CmdOZone : Command {
|
||||
public override string name { get { return "ozone"; } }
|
||||
public override string shortcut { get { return "oz"; } }
|
||||
public override string type { get { return CommandTypes.Moderation; } }
|
||||
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
|
||||
public override bool museumUsable { get { return false; } }
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "/ozone <rank/player> - Zones the entire map to <rank/player>");
|
||||
Player.Message(p, "To delete a zone, just use /zone del anywhere on the map");
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
if (message == "") { Help(p); return; }
|
||||
|
||||
int x2 = p.level.Width - 1;
|
||||
int y2 = p.level.Height - 1;
|
||||
int z2 = p.level.Length - 1;
|
||||
Command zone = Command.all.Find("zone");
|
||||
Command click = Command.all.Find("click");
|
||||
zone.Use(p, "add " + message);
|
||||
click.Use(p, 0 + " " + 0 + " " + 0);
|
||||
click.Use(p, x2 + " " + y2 + " " + z2);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,6 +31,9 @@ namespace MCGalaxy.Commands {
|
||||
new CommandPerm(LevelPermission.Operator, "+ can create zones"),
|
||||
}; }
|
||||
}
|
||||
public override CommandAlias[] Aliases {
|
||||
get { return new[] { new CommandAlias("ozone", "map"), new CommandAlias("oz", "map") }; }
|
||||
}
|
||||
|
||||
public override void Use(Player p, string message) {
|
||||
string[] args = message.Split(' ');
|
||||
@ -38,16 +41,16 @@ namespace MCGalaxy.Commands {
|
||||
Player.Message(p, "Place a block where you would like to check for zones.");
|
||||
p.MakeSelection(1, null, CheckZone);
|
||||
} else if (args[0].CaselessEq("add")) {
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, "can create zones.", 3); return; }
|
||||
if (args.Length == 1) { Help(p); return; }
|
||||
|
||||
if (Group.Find(args[1]) != null)
|
||||
args[1] = "grp" + Group.Find(args[1]).name;
|
||||
if (!ValidName(p, args[1], "player or rank")) return;
|
||||
if (!CheckAdd(p, args)) return;
|
||||
|
||||
Player.Message(p, "Place two blocks to determine the edges.");
|
||||
Player.Message(p, "Zone for: &b" + args[1] + ".");
|
||||
p.MakeSelection(2, args[1], AddZone);
|
||||
} else if (args[0].CaselessEq("map")) {
|
||||
if (!CheckAdd(p, args)) return;
|
||||
|
||||
ZoneAll(p.level, args[1]);
|
||||
Player.Message(p, "Added zone for &b" + args[1]);
|
||||
} else if (args[0].CaselessEq("del") && args.Length > 1 && args[1].CaselessEq("all")) {
|
||||
if (!CheckExtraPerm(p, 2)) { MessageNeedExtra(p, "can delete all zones.", 2); return; }
|
||||
DeleteAll(p);
|
||||
@ -67,6 +70,17 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ZoneAll(Level lvl, string owner) {
|
||||
Level.Zone zn = default(Level.Zone);
|
||||
zn.bigX = (ushort)(lvl.Width - 1);
|
||||
zn.bigY = (ushort)(lvl.Height - 1);
|
||||
zn.bigZ = (ushort)(lvl.Length - 1);
|
||||
zn.Owner = owner;
|
||||
|
||||
lvl.ZoneList.Add(zn);
|
||||
LevelDB.CreateZone(lvl.name, zn);
|
||||
}
|
||||
|
||||
internal static void DeleteAll(Player p) {
|
||||
for (int i = 0; i < p.level.ZoneList.Count; i++) {
|
||||
Level.Zone Zn = p.level.ZoneList[i];
|
||||
@ -78,6 +92,16 @@ namespace MCGalaxy.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckAdd(Player p, string[] args) {
|
||||
if (!CheckExtraPerm(p, 3)) { MessageNeedExtra(p, "can create zones.", 3); return false; }
|
||||
if (args.Length == 1) { Help(p); return false; }
|
||||
|
||||
if (Group.Find(args[1]) != null)
|
||||
args[1] = "grp" + Group.Find(args[1]).name;
|
||||
if (!ValidName(p, args[1], "player or rank")) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) {
|
||||
Level lvl = p.level;
|
||||
Vec3S32 P = marks[0];
|
||||
@ -148,6 +172,7 @@ namespace MCGalaxy.Commands {
|
||||
public override void Help(Player p) {
|
||||
Player.Message(p, "%T/zone add [name] %H- Creates a zone only [name] can build in");
|
||||
Player.Message(p, "%T/zone add [rank] %H- Creates a zone only [rank]+ can build in");
|
||||
Player.Message(p, "%T/zone map [name/rank] %H- /zone add across the entire map");
|
||||
Player.Message(p, "%T/zone del %H- Deletes the zone clicked");
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +305,6 @@
|
||||
<Compile Include="Commands\Moderation\CmdMute.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdNotes.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdOhide.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdOZone.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdP2P.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdPass.cs" />
|
||||
<Compile Include="Commands\Moderation\CmdPatrol.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user