forked from Zamirathe/ZaupHomeCommand
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCommandHome.cs
34 lines (27 loc) · 1.06 KB
/
CommandHome.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections.Generic;
using Rocket.API;
using Rocket.Unturned.Player;
using UnityEngine;
namespace ZaupHomeCommand
{
public class CommandHome : IRocketCommand
{
public string Name => "home";
public string Help => "Teleports you to your bed if you have one.";
public string Syntax => "";
public List<string> Aliases => new List<string>();
//?????
public List<string> Permissions => new List<string>();
public AllowedCaller AllowedCaller => AllowedCaller.Player;
public void Execute(IRocketPlayer caller, string[] bed)
{
UnturnedPlayer playerId = (UnturnedPlayer)caller;
HomePlayer homePlayer = playerId.GetComponent<HomePlayer>();
object[] cont = ZaupHomeCommand.CheckConfig(playerId);
if (!(bool)cont[0]) return;
// A bed was found, so let's run a few checks.
HomePlayer.CurrentHomePlayers.Add(playerId, homePlayer);
homePlayer.GoHome((Vector3)cont[1], (byte)cont[2], playerId);
}
}
}