forked from cartman-2000/TeleportUtil
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cc8d47
commit 0a198e3
Showing
7 changed files
with
135 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Rocket.API; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Commands; | ||
using Rocket.Unturned.Player; | ||
using Rocket.Unturned; | ||
|
||
|
||
namespace TeleportUtil | ||
{ | ||
public class CommandLocate : IRocketCommand | ||
{ | ||
public bool AllowFromConsole | ||
{ | ||
get { return true; } | ||
} | ||
|
||
public string Name | ||
{ | ||
get { return "locate"; } | ||
} | ||
|
||
public string Help | ||
{ | ||
get { return "Prints out the location of a player on the map for usage in the /tp command."; } | ||
} | ||
|
||
public string Syntax | ||
{ | ||
get { return "[\"name\"]"; } | ||
} | ||
|
||
public List<string> Aliases | ||
{ | ||
get { return new List<string>(); } | ||
} | ||
|
||
public void Execute(RocketPlayer caller, string[] command) | ||
public List<string> Permissions | ||
{ | ||
get { return new List<string>() { "TeleportUtil.locate" }; } | ||
} | ||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
if ((caller == null && command.Length < 1) || command.Length > 1) | ||
if ((caller is ConsolePlayer && command.Length < 1) || command.Length > 1) | ||
{ | ||
RocketChat.Say(caller, TeleportUtil.Instance.Translate("can't_locate_player", new object[] {})); | ||
UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("can't_locate_player")); | ||
return; | ||
} | ||
if (command.Length == 1) | ||
{ | ||
if (!caller.HasPermission("locate.other")) | ||
{ | ||
RocketChat.Say(caller, TeleportUtil.Instance.Translate("locate_other_not_allowed", new object[] { })); | ||
UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("locate_other_not_allowed")); | ||
return; | ||
} | ||
RocketPlayer target = RocketPlayer.FromName(command[0]); | ||
UnturnedPlayer target = command.GetUnturnedPlayerParameter(0); | ||
if (target == null) | ||
{ | ||
RocketChat.Say(caller, TeleportUtil.Instance.Translate("can't_locate_player", new object[] { })); | ||
UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("can't_locate_player")); | ||
return; | ||
} | ||
else | ||
{ | ||
RocketChat.Say(caller, TeleportUtil.Instance.Translate("location_on_map_other", new object[] { target.CharacterName.Truncate(14), Math.Round(target.Position.x, 2), Math.Round(target.Position.y, 2), Math.Round(target.Position.z, 2) })); | ||
UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("location_on_map_other", target.CharacterName.Truncate(14), Math.Round(target.Position.x, 2), Math.Round(target.Position.y, 2), Math.Round(target.Position.z, 2))); | ||
} | ||
} | ||
else | ||
{ | ||
RocketChat.Say(caller, TeleportUtil.Instance.Translate("location_on_map", new object[] { Math.Round(caller.Position.x, 2), Math.Round(caller.Position.y, 2), Math.Round(caller.Position.z, 2) })); | ||
UnturnedPlayer unturnedCaller = UnturnedPlayer.FromName(caller.Id); | ||
UnturnedChat.Say(caller, TeleportUtil.Instance.Translate("location_on_map", Math.Round(unturnedCaller.Position.x, 2), Math.Round(unturnedCaller.Position.y, 2), Math.Round(unturnedCaller.Position.z, 2))); | ||
} | ||
} | ||
|
||
public string Help | ||
{ | ||
get { return "Prints out the location of a player on the map for usage in the /tp command."; } | ||
} | ||
|
||
public string Name | ||
{ | ||
get { return "locate"; } | ||
} | ||
|
||
public bool RunFromConsole | ||
{ | ||
get { return true; } | ||
} | ||
|
||
public string Syntax | ||
{ | ||
get { return "[\"name\"]"; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.