-
Notifications
You must be signed in to change notification settings - Fork 0
Options
Inspired by CedMod
Remote Admin Options allow developers to add custom functionality to the 4 Request Data
buttons by selecting a fake player:
- Request Data
- Request IP
- Request Auth
- External Lookup
Some options may act as a method to select players. See: Stack
Important
The External Lookup
button is disabled unless you have specified the lookup mode the remote admin config (config_remoteadmin.txt
).
Add the following to enable it:
external_player_lookup_mode: urlonly
external_player_lookup_url: ''
The remoteAdminOption
(raOption
or raOpt
) command allows you to customize which options are visible to you.
Command | Description |
---|---|
show <id> |
Makes the given option visible |
hide <id> |
Hides the given option |
list |
Shows all available options |
The plugin includes two RA options by default:
All buttons include a clickable copy icon.
-
Request Data
outputs the last command that was executed by the user -
Reqest IP
outputs the last exception thrown by a command executed by the user with IL offsets removed -
Reqest Auth
outputs the last exception thrown by a command executed by the user with IL offsets included
This option doesn't add button functionality. Selecting it and running a command from the RA GUI will select the topmost list from the player selection stack
Inherit the Axwabo.CommandSystem.RemoteAdminExtensions.RemoteAdminOptionBase
class and override the string HandleButtonClick(RequestDataButton, PlayerCommandSender)
method
The option's ID must be specified by an attribute, resolver or by overriding the property InitOnlyOptionId
Axwabo.CommandSystem.Attributes.RaExt.AutoGenerateIdAttribute
Axwabo.CommandSystem.Attributes.RaExt.RemoteAdminOptionIdentifierAttribute
Axwabo.CommandSystem.Attributes.RaExt.RemoteAdminOptionPropertiesAttribute
The ID must contain at least one non-numeric character and may not contain any of the following characters: $@()".<>
Example:
using Axwabo.CommandSystem.Attributes.RaExt;
using Axwabo.CommandSystem.RemoteAdminExtensions;
using RemoteAdmin;
[RemoteAdminOptionProperties("pong", "Pong")]
// or:
[RemoteAdminOptionIdentifier("pong")]
[StaticOptionText("Pong")]
public sealed class PongOption : RemoteAdminOptionBase
{
protected override string HandleButtonClick(RequestDataButton button, PlayerCommandSender sender)
{
return $"You pressed {button}";
}
}
Override the string GenerateDisplayText(CommandSender)
method to create dynamic text.
Important
Options are hidden by default to prevent cluttering the RA GUI. Add the Axwabo.CommandSystem.Attributes.RaExt.VisibleByDefaultAttribute
to the option class to make it visible.
The option ID is assigned in the constructor.
If the ID is auto-generated, it will have a negative numeric ID.
Otherwise, the user-specified ID will be prefixed as follows:
- The ID is prepended with
@
if the option can be used as a standalone selector, specified in one of the following ways:- Add the
Axwabo.CommandSystem.Attributes.RaExt.StandaloneSelectorAttribute
- Add the
Axwabo.CommandSystem.Attributes.RaExt.RemoteAdminOptionPropertiesAttribute
and set propertyCanBeUsedAsStandaloneSelector
to true - Implement the interface
Axwabo.CommandSystem.RemoteAdminExtensions.Interfaces.IStandaloneSelectorOption
and set propertyCanBeUsedAsStandaloneSelector
to true
- Add the
- Otherwise, the ID will start with
$
Adding permission attributes to the class or overriding the Permissions
property allows control over who can access the RA option.
An option itself may implement the IPermissionChecker
interface to override checking behavior.
When this interface is implemented, attribute-based permission checkers are not resolved.
See the permissions article for details.
Implement the Axwabo.CommandSystem.RemoteAdminExtensions.Interfaces.IOptionVisibilityController
to specify who can see the option.
This may be used to hide the option for a specific user when interaction is not possible at the moment.
Implement the method bool IsVisibleTo(CommandSender)
The AllowInteractionsWhenHidden
property specifies whether button clicks can be handled while the option is hidden but accessible
This class introduces a handler method for each option. Permissions may be specified by adding a permission attribute to the handler method.
Example:
using Axwabo.CommandSystem.Attributes.RaExt;
using Axwabo.CommandSystem.Permissions;
using Axwabo.CommandSystem.RemoteAdminExtensions;
using RemoteAdmin;
[AutoGenerateId]
[StaticOptionText("Button")]
[OptionIcon("B", ContentColor = "yellow", ShouldBlink = false, SurroundWithBrackets = true)]
public sealed class ButtonOption : ButtonBasedRemoteAdminOption
{
protected override string OnBasicInfoClicked(PlayerCommandSender sender)
=> "Basic Info";
[VanillaPermissions(PlayerPermissions.PlayerSensitiveDataAccess)]
protected override string OnRequestIPClicked(PlayerCommandSender sender)
=> "IP";
[StringPermissions("button.secret")]
protected override string OnRequestAuthClicked(PlayerCommandSender sender)
=> "Super Secret Information";
}
Icons (if specified) are shown before the generated text.
Specify one by setting the Icon
property, using a resolver or attribute:
Axwabo.CommandSystem.Attributes.RaExt.OptionIconAttribute
-
Axwabo.CommandSystem.Attributes.RaExt.RemoteAdminOptionPropertiesAttribute
(extendsOptionIconAttribute
)
If the ShouldBlink
property is true, the icon will only be visible every other second.
If the SurroundWithBrackets
property is true, the Content
will look like this: [Content]
Setting TrailingSpace
to true will add a space after the end bracket or content to add some room between the icon and generated text.
OverallColor
sets the color of the icon and brackets.