generated from AriasCreations/vsmodtemplate
Adds homes
This commit is contained in:
parent
3f1ce790d9
commit
d5dc0d5892
5 changed files with 184 additions and 4 deletions
|
@ -15,6 +15,59 @@ namespace AriasServerUtils
|
|||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:rmspawn"));
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleDelHome(TextCommandCallingArgs args)
|
||||
{
|
||||
string homeName = "default";
|
||||
if (args.ArgCount > 0)
|
||||
{
|
||||
homeName = args[0] as string;
|
||||
}
|
||||
|
||||
if (args.Caller.Player is IServerPlayer isp)
|
||||
{
|
||||
PlayerStorage data = ServerUtilities.GetPlayerData(isp);
|
||||
if (data.Homes.ContainsKey(homeName))
|
||||
{
|
||||
data.Homes.Remove(homeName);
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-del"));
|
||||
ServerUtilities.MarkDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-no"));
|
||||
}
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleGoHome(TextCommandCallingArgs args)
|
||||
{
|
||||
string homeName = "default";
|
||||
if (args.ArgCount > 0)
|
||||
{
|
||||
homeName = args[0] as string;
|
||||
}
|
||||
|
||||
if (args.Caller.Player is IServerPlayer isp)
|
||||
{
|
||||
PlayerStorage data = ServerUtilities.GetPlayerData(isp);
|
||||
if (data.Homes.ContainsKey(homeName))
|
||||
{
|
||||
data.Homes[homeName].Location.Merge(isp.Entity);
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-tp"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-no"));
|
||||
}
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleReturnItems(TextCommandCallingArgs args)
|
||||
{
|
||||
IPlayer player = args[0] as IPlayer;
|
||||
|
@ -38,6 +91,27 @@ namespace AriasServerUtils
|
|||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleSetHome(TextCommandCallingArgs args)
|
||||
{
|
||||
string homeName = "default";
|
||||
if (args.ArgCount > 0)
|
||||
{
|
||||
homeName = args[0] as string;
|
||||
}
|
||||
|
||||
if (args.Caller.Player is IServerPlayer isp)
|
||||
{
|
||||
|
||||
var data = ServerUtilities.GetPlayerData(isp);
|
||||
data.Homes[homeName] = Home.MakeHome(args.Caller.Player.Entity, homeName);
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:home-set"));
|
||||
ServerUtilities.MarkDirty();
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleSetSpawn(TextCommandCallingArgs args)
|
||||
{
|
||||
PlayerPosition pos = PlayerPosition.from(args.Caller.Entity);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue