mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Warps/Waypoints don't have to be lowercase anymore.
This commit is contained in:
parent
96185e14ac
commit
e7077a0bdd
@ -140,9 +140,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
GetBool(cfg.Buildable), GetBool(cfg.Deletable));
|
GetBool(cfg.Buildable), GetBool(cfg.Deletable));
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetBool(bool value, bool console = false) {
|
static string GetBool(bool value) { return value ? "&aON" : "&cOFF"; }
|
||||||
return console ? (value ? "ON" : "OFF") : (value ? "&aON" : "&cOFF");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
Player.Message(p, "%T/Map [level] [option] <value> %H- Sets [option] on [level]");
|
Player.Message(p, "%T/Map [level] [option] <value> %H- Sets [option] on [level]");
|
||||||
|
@ -21,7 +21,7 @@ using System.Threading;
|
|||||||
namespace MCGalaxy.Commands.Misc {
|
namespace MCGalaxy.Commands.Misc {
|
||||||
public class CmdWarp : Command {
|
public class CmdWarp : Command {
|
||||||
public override string name { get { return "Warp"; } }
|
public override string name { get { return "Warp"; } }
|
||||||
public override string type { get { return CommandTypes.Other; } }
|
public override string type { get { return CommandTypes.World; } }
|
||||||
public override bool museumUsable { get { return false; } }
|
public override bool museumUsable { get { return false; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
|
||||||
public override bool SuperUseable { get { return false; } }
|
public override bool SuperUseable { get { return false; } }
|
||||||
@ -32,18 +32,18 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
new CommandPerm(LevelPermission.Operator, "+ can move/edit warps"),
|
new CommandPerm(LevelPermission.Operator, "+ can move/edit warps"),
|
||||||
}; }
|
}; }
|
||||||
}
|
}
|
||||||
protected virtual bool CheckExtraPerms { get { return true; } }
|
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
UseCore(p, message, WarpList.Global, "Warp");
|
UseCore(p, message, WarpList.Global, "Warp", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UseCore(Player p, string message, WarpList warps, string group) {
|
protected void UseCore(Player p, string message, WarpList warps,
|
||||||
string[] args = message.ToLower().SplitSpaces();
|
string group, bool checkExtraPerms) {
|
||||||
|
string[] args = message.SplitSpaces();
|
||||||
string cmd = args[0];
|
string cmd = args[0];
|
||||||
if (cmd.Length == 0) { Help(p); return; }
|
if (cmd.Length == 0) { Help(p); return; }
|
||||||
|
|
||||||
if (args.Length == 1 && (cmd == "list" || cmd == "view")) {
|
if (args.Length == 1 && cmd.CaselessEq("list")) {
|
||||||
Player.Message(p, "{0}s:", group);
|
Player.Message(p, "{0}s:", group);
|
||||||
foreach (Warp wr in warps.Items) {
|
foreach (Warp wr in warps.Items) {
|
||||||
if (LevelInfo.FindExact(wr.Level) != null)
|
if (LevelInfo.FindExact(wr.Level) != null)
|
||||||
@ -57,8 +57,8 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string name = args[1];
|
string name = args[1];
|
||||||
if (cmd == "create" || cmd == "add") {
|
if (cmd.CaselessEq("create") || cmd.CaselessEq("add")) {
|
||||||
if (CheckExtraPerms && !CheckExtraPerm(p, 1)) return;
|
if (checkExtraPerms && !CheckExtraPerm(p, 1)) return;
|
||||||
if (warps.Exists(name)) { Player.Message(p, "{0} already exists", group); return; }
|
if (warps.Exists(name)) { Player.Message(p, "{0} already exists", group); return; }
|
||||||
|
|
||||||
Player who = args.Length == 2 ? p : PlayerInfo.FindMatches(p, args[2]);
|
Player who = args.Length == 2 ? p : PlayerInfo.FindMatches(p, args[2]);
|
||||||
@ -66,15 +66,15 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
|
|
||||||
warps.Create(name, who);
|
warps.Create(name, who);
|
||||||
Player.Message(p, "{0} {1} created.", group, name);
|
Player.Message(p, "{0} {1} created.", group, name);
|
||||||
} else if (cmd == "delete" || cmd == "remove") {
|
} else if (cmd.CaselessEq("delete") || cmd.CaselessEq("remove")) {
|
||||||
if (CheckExtraPerms && !CheckExtraPerm(p, 2)) return;
|
if (checkExtraPerms && !CheckExtraPerm(p, 2)) return;
|
||||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
Warp warp = Matcher.FindWarps(p, warps, name);
|
||||||
if (warp == null) return;
|
if (warp == null) return;
|
||||||
|
|
||||||
warps.Remove(warp, p);
|
warps.Remove(warp, p);
|
||||||
Player.Message(p, "{0} {1} deleted.", group, warp.Name);
|
Player.Message(p, "{0} {1} deleted.", group, warp.Name);
|
||||||
} else if (cmd == "move" || cmd == "update") {
|
} else if (cmd.CaselessEq("move") || cmd.CaselessEq("update")) {
|
||||||
if (CheckExtraPerms && !CheckExtraPerm(p, 3)) return;
|
if (checkExtraPerms && !CheckExtraPerm(p, 3)) return;
|
||||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
Warp warp = Matcher.FindWarps(p, warps, name);
|
||||||
if (warp == null) return;
|
if (warp == null) return;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
|
|
||||||
warps.Update(warp, who);
|
warps.Update(warp, who);
|
||||||
Player.Message(p, "{0} {1} moved.", group, warp.Name);
|
Player.Message(p, "{0} {1} moved.", group, warp.Name);
|
||||||
} else if (cmd == "goto") {
|
} else if (cmd.CaselessEq("goto")) {
|
||||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
Warp warp = Matcher.FindWarps(p, warps, name);
|
||||||
if (warp != null) warps.Goto(warp, p);
|
if (warp != null) warps.Goto(warp, p);
|
||||||
} else {
|
} else {
|
@ -21,23 +21,19 @@ namespace MCGalaxy.Commands.Misc {
|
|||||||
public sealed class CmdWaypoint : CmdWarp {
|
public sealed class CmdWaypoint : CmdWarp {
|
||||||
public override string name { get { return "Waypoint"; } }
|
public override string name { get { return "Waypoint"; } }
|
||||||
public override string shortcut { get { return "wp"; } }
|
public override string shortcut { get { return "wp"; } }
|
||||||
public override string type { get { return CommandTypes.Other; } }
|
|
||||||
public override bool museumUsable { get { return true; } }
|
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||||
public override bool SuperUseable { get { return false; } }
|
|
||||||
public override CommandPerm[] ExtraPerms { get { return null; } }
|
public override CommandPerm[] ExtraPerms { get { return null; } }
|
||||||
protected override bool CheckExtraPerms { get { return false; } }
|
|
||||||
|
|
||||||
public override void Use(Player p, string message) {
|
public override void Use(Player p, string message) {
|
||||||
UseCore(p, message, p.Waypoints, "Waypoint");
|
UseCore(p, message, p.Waypoints, "Waypoint", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
||||||
|
Player.Message(p, "%HWaypoints are warps only usable by you.");
|
||||||
Player.Message(p, "%T/Waypoint create [name] %H- Create a new waypoint");
|
Player.Message(p, "%T/Waypoint create [name] %H- Create a new waypoint");
|
||||||
Player.Message(p, "%T/Waypoint update [name] %H- Update a waypoint");
|
Player.Message(p, "%T/Waypoint update [name] %H- Update a waypoint");
|
||||||
Player.Message(p, "%T/Waypoint remove [name] %H- Remove a waypoint");
|
Player.Message(p, "%T/Waypoint remove [name] %H- Remove a waypoint");
|
||||||
Player.Message(p, "%T/Waypoint list %H- Shows a list of waypoints");
|
Player.Message(p, "%T/Waypoint list %H- Shows a list of waypoints");
|
||||||
Player.Message(p, "%T/Waypoint goto [name] %H- Goto a waypoint");
|
|
||||||
Player.Message(p, "%T/Waypoint [name] %H- Goto a waypoint");
|
Player.Message(p, "%T/Waypoint [name] %H- Goto a waypoint");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -349,8 +349,6 @@
|
|||||||
<Compile Include="Commands\other\CmdTimer.cs" />
|
<Compile Include="Commands\other\CmdTimer.cs" />
|
||||||
<Compile Include="Commands\other\CmdTp.cs" />
|
<Compile Include="Commands\other\CmdTp.cs" />
|
||||||
<Compile Include="Commands\other\CmdTpA.cs" />
|
<Compile Include="Commands\other\CmdTpA.cs" />
|
||||||
<Compile Include="Commands\other\CmdWarp.cs" />
|
|
||||||
<Compile Include="Commands\other\CmdWaypoint.cs" />
|
|
||||||
<Compile Include="Commands\other\QuitCmds.cs" />
|
<Compile Include="Commands\other\QuitCmds.cs" />
|
||||||
<Compile Include="Commands\Scripting\CmdCmdCreate.cs" />
|
<Compile Include="Commands\Scripting\CmdCmdCreate.cs" />
|
||||||
<Compile Include="Commands\Scripting\CmdCmdLoad.cs" />
|
<Compile Include="Commands\Scripting\CmdCmdLoad.cs" />
|
||||||
@ -373,6 +371,8 @@
|
|||||||
<Compile Include="Commands\World\CmdOverseer.cs" />
|
<Compile Include="Commands\World\CmdOverseer.cs" />
|
||||||
<Compile Include="Commands\World\CmdOverseer.SubCommands.cs" />
|
<Compile Include="Commands\World\CmdOverseer.SubCommands.cs" />
|
||||||
<Compile Include="Commands\World\CmdPause.cs" />
|
<Compile Include="Commands\World\CmdPause.cs" />
|
||||||
|
<Compile Include="Commands\World\CmdWarp.cs" />
|
||||||
|
<Compile Include="Commands\World\CmdWaypoint.cs" />
|
||||||
<Compile Include="Commands\World\PermissionCmds.cs" />
|
<Compile Include="Commands\World\PermissionCmds.cs" />
|
||||||
<Compile Include="Commands\World\CmdPhysics.cs" />
|
<Compile Include="Commands\World\CmdPhysics.cs" />
|
||||||
<Compile Include="Commands\World\CmdRenameLvl.cs" />
|
<Compile Include="Commands\World\CmdRenameLvl.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user