generated from AriasCreations/vsmodtemplate
Add homes list command
This commit is contained in:
parent
9522b6d941
commit
93a9a5e8bc
4 changed files with 28 additions and 3 deletions
|
@ -84,6 +84,7 @@ namespace AriasServerUtils
|
||||||
api.ChatCommands.Create("sethome").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Creates a home").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleSetHome);
|
api.ChatCommands.Create("sethome").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Creates a home").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleSetHome);
|
||||||
api.ChatCommands.Create("home").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Teleports you to home").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleGoHome);
|
api.ChatCommands.Create("home").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Teleports you to home").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleGoHome);
|
||||||
api.ChatCommands.Create("delhome").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Deletes a home entry").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleDelHome);
|
api.ChatCommands.Create("delhome").RequiresPlayer().WithArgs(parsers.OptionalWord("name")).WithDescription("Deletes a home entry").RequiresPrivilege(Privilege.chat).HandleWith(Events.HandleDelHome);
|
||||||
|
api.ChatCommands.Create("homes").RequiresPlayer().WithDescription("Lists your homes").RequiresPrivilege(Privilege.controlserver).HandleWith(Events.HandleListHomes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlayerDC(IServerPlayer byPlayer)
|
private void OnPlayerDC(IServerPlayer byPlayer)
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using Vintagestory.API.Common;
|
using Vintagestory.API.Common;
|
||||||
using Vintagestory.API.Config;
|
using Vintagestory.API.Config;
|
||||||
using Vintagestory.API.Server;
|
using Vintagestory.API.Server;
|
||||||
|
@ -68,6 +71,26 @@ namespace AriasServerUtils
|
||||||
return TextCommandResult.Success();
|
return TextCommandResult.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static TextCommandResult HandleListHomes(TextCommandCallingArgs args)
|
||||||
|
{
|
||||||
|
if (args.Caller.Player is IServerPlayer isp)
|
||||||
|
{
|
||||||
|
PlayerStorage data = ServerUtilities.GetPlayerData(isp);
|
||||||
|
|
||||||
|
List<string> lTmp = new List<string>();
|
||||||
|
foreach (var entry in data.Homes)
|
||||||
|
{
|
||||||
|
lTmp.Add(entry.Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-list", data.Homes.Count, string.Join(", ", lTmp)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return TextCommandResult.Success();
|
||||||
|
}
|
||||||
|
|
||||||
internal static TextCommandResult HandleReturnItems(TextCommandCallingArgs args)
|
internal static TextCommandResult HandleReturnItems(TextCommandCallingArgs args)
|
||||||
{
|
{
|
||||||
IPlayer player = args[0] as IPlayer;
|
IPlayer player = args[0] as IPlayer;
|
||||||
|
|
|
@ -15,5 +15,6 @@
|
||||||
"home-no": "No such home exists",
|
"home-no": "No such home exists",
|
||||||
"home-max": "You have reached your max number of homes",
|
"home-max": "You have reached your max number of homes",
|
||||||
"home-set": "Home saved",
|
"home-set": "Home saved",
|
||||||
"home-del": "Home deleted"
|
"home-del": "Home deleted",
|
||||||
|
"home-list": "You have [{0}] home(s)\n\n{1}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
"modid": "ariasserverutils",
|
"modid": "ariasserverutils",
|
||||||
"name": "Aria's Server Utilities",
|
"name": "Aria's Server Utilities",
|
||||||
"authors": ["zontreck"],
|
"authors": ["zontreck"],
|
||||||
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:17 PM",
|
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 02:22 PM",
|
||||||
"version": "1.0.0-dev.6",
|
"version": "1.0.0-dev.7",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue