-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MessageIconUrl and rich text support
- Loading branch information
1 parent
f2a542a
commit 52e2b7d
Showing
8 changed files
with
248 additions
and
158 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
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,55 +1,62 @@ | ||
using RestoreMonarchy.Teleportation.Utils; | ||
using Rocket.API; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using System.Collections.Generic; | ||
|
||
namespace RestoreMonarchy.Teleportation.Commands | ||
{ | ||
public class TPACommand : IRocketCommand | ||
{ | ||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "tpa"; | ||
|
||
public string Help => "Teleportation request command"; | ||
|
||
public string Syntax => "(player/accept/deny/cancel)"; | ||
|
||
public List<string> Aliases => new List<string>(); | ||
|
||
public List<string> Permissions => new List<string>(); | ||
private TeleportationPlugin pluginInstance => TeleportationPlugin.Instance; | ||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
if (command.Length < 1) | ||
{ | ||
UnturnedChat.Say(caller, TeleportationPlugin.Instance.Translate("TPAHelp"), TeleportationPlugin.Instance.MessageColor); | ||
pluginInstance.SendMessageToPlayer(caller, "TPAHelp"); | ||
return; | ||
} | ||
|
||
UnturnedPlayer player = (UnturnedPlayer)caller; | ||
|
||
string cmd = command[0].ToLower(); | ||
|
||
if (cmd == "accept" || cmd == "a") | ||
{ | ||
TeleportationPlugin.Instance.AcceptTPARequest((UnturnedPlayer)caller); | ||
} else if (cmd == "cancel" || cmd == "c") | ||
pluginInstance.AcceptTPARequest(player); | ||
} | ||
else if (cmd == "cancel" || cmd == "c") | ||
{ | ||
TeleportationPlugin.Instance.CancelTPARequest((UnturnedPlayer)caller); | ||
} else if (cmd == "deny" || cmd == "d") | ||
pluginInstance.CancelTPARequest(player); | ||
} | ||
else if (cmd == "deny" || cmd == "d") | ||
{ | ||
TeleportationPlugin.Instance.DenyTPARequest((UnturnedPlayer)caller); | ||
} else | ||
pluginInstance.DenyTPARequest(player); | ||
} | ||
else | ||
{ | ||
var target = UnturnedPlayer.FromName(cmd); | ||
UnturnedPlayer target = UnturnedPlayer.FromName(cmd); | ||
if (target != null) | ||
{ | ||
TeleportationPlugin.Instance.SendTPARequest((UnturnedPlayer)caller, target); | ||
} else | ||
pluginInstance.SendTPARequest(player, target); | ||
} | ||
else | ||
{ | ||
UnturnedChat.Say(caller, TeleportationPlugin.Instance.Translate("TargetNotFound"), TeleportationPlugin.Instance.MessageColor); | ||
pluginInstance.SendMessageToPlayer(caller, "TargetNotFound"); | ||
} | ||
} | ||
} | ||
|
||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "tpa"; | ||
|
||
public string Help => "Teleportation request command"; | ||
|
||
public string Syntax => "(player/accept/deny/cancel)"; | ||
|
||
public List<string> Aliases => new List<string>(); | ||
|
||
public List<string> Permissions => new List<string>(); | ||
} | ||
} |
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.