generated from AriasCreations/vsmodtemplate
Adds in warps
This commit is contained in:
parent
e776a6bb9e
commit
737c51989b
5 changed files with 114 additions and 4 deletions
|
@ -12,7 +12,7 @@ namespace AriasServerUtils
|
|||
{
|
||||
internal static TextCommandResult HandleASU(TextCommandCallingArgs args)
|
||||
{
|
||||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:help", ServerUtilities.config.MaxHomes, ServerUtilities.config.AdminsBypassMaxHomes, string.Join(", ", new string[] { "setspawn", "spawn", "delspawn", "sethome", "home", "delhome", "homes", "restoreinv", "asu" })));
|
||||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:help", ServerUtilities.config.MaxHomes, ServerUtilities.config.AdminsBypassMaxHomes, string.Join(", ", new string[] { "setspawn", "spawn", "delspawn", "sethome", "home", "delhome", "homes", "restoreinv", "asu", "warp", "setwarp", "delwarp", "warps" })));
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleClearSpawn(TextCommandCallingArgs args)
|
||||
|
@ -221,5 +221,89 @@ namespace AriasServerUtils
|
|||
|
||||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig"));
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleWarp(TextCommandCallingArgs args)
|
||||
{
|
||||
string name = "default";
|
||||
if (args.ArgCount > 0) name = args[0] as string ?? "default";
|
||||
|
||||
if (args.Caller.Player is IServerPlayer isp)
|
||||
{
|
||||
if (ServerUtilities.serverWarps.warps.ContainsKey(name))
|
||||
{
|
||||
|
||||
ServerUtilities.serverWarps.warps[name].Location.Merge(isp.Entity);
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:warp-set", name));
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:warp-fail", name));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleWarpDelete(TextCommandCallingArgs args)
|
||||
{
|
||||
string name = "default";
|
||||
if (args.ArgCount > 0) name = args[0] as string ?? "default";
|
||||
|
||||
if (args.Caller.Player is IServerPlayer isp)
|
||||
{
|
||||
if (isp.HasPrivilege(Privilege.controlserver) || !ServerUtilities.config.onlyAdminsCreateWarps)
|
||||
{
|
||||
ServerUtilities.serverWarps.warps.Remove(name);
|
||||
ServerUtilities.MarkDirty();
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:warp-del"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:warp-no"));
|
||||
}
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleWarpList(TextCommandCallingArgs args)
|
||||
{
|
||||
List<string> warps = new List<string>();
|
||||
foreach (string id in ServerUtilities.serverWarps.warps.Keys)
|
||||
{
|
||||
warps.Add(id);
|
||||
}
|
||||
|
||||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:warp-list", warps.Count, string.Join(", ", warps)));
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleWarpUpdate(TextCommandCallingArgs args)
|
||||
{
|
||||
string name = "default";
|
||||
if (args.ArgCount > 0) name = args[0] as string ?? "default";
|
||||
|
||||
if (args.Caller.Player is IServerPlayer isp)
|
||||
{
|
||||
if (isp.HasPrivilege(Privilege.controlserver) || !ServerUtilities.config.onlyAdminsCreateWarps)
|
||||
{
|
||||
ServerUtilities.serverWarps.warps[name] = Warp.Create(isp);
|
||||
ServerUtilities.MarkDirty();
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:warp-set", name));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:warp-no"));
|
||||
}
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue