The auto-mcs scripting API (amscript) is available to quickly create universal plugins for your auto-mcs servers. It functions primarily as an asynchronous wrapper which fires events from what happens in-game and uses standard Python 3.9 syntax. Because of this mechanic, a single script will work with every Vanilla, CraftBukkit (and derivatives), Forge, and Fabric server regardless of the game version. This functionality can be accessed via the amscript button in the Server Manager. Create a new script to open the built-in IDE and get started!
To see more examples of the library in action, visit our repository of amscripts to see how the objects and events work together!
Note: All of these scripts are available to download and edit directly inside the amscript manager
Note: All object attributes are read-only, but can be manipulated with their methods
Contains the server's running configuration from the server.properties
, to the list of connected players.
Accessed via the global variable server
Methods:
Immediately stops the server.
Immediately stops and restarts the server.
Sends a custom log event to the console. This output is displayed only while the server is running, and is not saved to latest.log
.
server.log_success()
,server.log_warning()
, andserver.log_error()
methods can also be used, and only require themessage
parameter.
Accepted parameters:
Parameter | Description |
---|---|
message* |
str of log content |
log_type |
str can be 'info' , 'success' , 'warning' or 'error' . Defaults to 'info' |
Executes any Minecraft command in the server console.
Note: Some commands are version dependent and you may need to implement a switch to execute different commands for different versions.
Accepted parameters:
Parameter | Description |
---|---|
command* |
str , any Minecraft command |
Compares server version to version
with the comparator
, returns bool
.
Accepted parameters:
Parameter | Description |
---|---|
comparator* |
str , can be '=' , '<' , '<=' , '>' , or '>=' |
version* |
str , any Minecraft version, i.e. '1.17.1' |
Returns PlayerScriptObject on match, else None
. Only returns the first match.
Accepted parameters:
Parameter | Description |
---|---|
selector* |
str of username, or a valid Minecraft selector that returns a single value (like @p, @s, @r). Only players will be matched |
reverse |
bool selects last match on True . Defaults to False |
Attributes:
Note: All attributes are read-only, and thus will not change the server data when modified
str
, server's current filename
str
, Minecraft version of the server, i.e.'1.16.3'
str
, Only applicable for Paper/Forge, contains build number. Else will beNone
str
, type of server, i.e.'craftbukkit'
or'vanilla'
- Can be
'vanilla'
,'craftbukkit'
,'spigot'
,'paper'
,'forge'
, or'fabric'
str
, filename oflevel-name
fromserver.properties
str
, full path of the directory in which the server is stored
dict
, contains the listening IP and port- Structured as
{'ip': ip address, 'port': port}
dict
, current keys in theserver.properties
file- A boolean value for example can be accessed with
server.properties['enable-command-block']
dict
, contains a key and a sub-dictionary for each connected player- The current format is
{'username': {'uuid': uuid, 'ip': ip address, 'date': datetime, 'logged-in': True}}
dict
, contains a dictionary for each player who has ever joined the server- The current format is
{'username': 'uuid'}
dict
, persistent variable storage for saving information between server restarts, or script reloads- Assigning or updating a key in the
server.persistent
dictionary will automatically save it, and can be accessed via the same key persistently until it is changed again, or deleted. Data will only be saved for the server referenced in the object.
Warning: persistent data is only saved properly when the server shuts down gracefully, if the computer crashes or the server process is terminated forcefully, the persistent data will likely revert to previous values
str
, contains the current amscript version to account for API changes
list
, contains a formatted list of dictionaries organizing the items visible in the auto-mcs console from oldest to newest (limit of 850)
Contains current player configuration from their username, UUID, to all their NBT data
Accessed by an applicable event, or by the server.get_player()
method
Methods:
Sets a custom permission for @player.on_alias events.
- The
player.check_permission()
method can also be used with only thepermission
argument to return abool
if the player has the specified permission. Note that the server console has all custom permissions.
Accepted parameters:
Parameter | Description |
---|---|
permission* |
str of username, or selector. Only players will be matched |
enabled |
bool to enable or disable the permission. Defaults to True |
Sends a private message to the chat of the player with formatting support. Useful for command feedback with a @player.on_alias event
player.log_success()
,player.log_warning()
, andplayer.log_error()
methods can also be used, and only require themessage
parameter.
Accepted parameters:
Parameter | Description |
---|---|
message* |
str of content to log to the player |
color |
str of Minecraft color ID, all values for /tellraw are accepted. List of IDs can be found here |
style |
str , can be 'normal' , 'italic' , 'bold' , 'strikethrough' , 'underlined' , and 'obfuscated' . Defaults to 'italic' |
Attributes:
Note: All attributes are read-only, and thus will not change playerdata when modified
Note: Versions prior to 1.13 load NBT from playerdata.dat, which is only updated every couple of minutes or so. Any version between 1.8-1.13, though, will have updated position data. 1.13 and later retrieves all of the most recent NBT data.
str
, player's current username
str
, player's Universally Unique IDentifier (None
pre-1.8)
str
, currently connected IP address
bool
, if current object was created from the console- This will be
True
if the console sends a command to a @player.on_alias event, for example
CoordinateObject
, player's current position in X, Y, and Z coordinates- When assigned to a variable or persistence, it will stay a
CoordinateObject
- Can be referenced in a string (such as a command) with
player.position
orplayer.position.x
,player.position.y
, andplayer.position.z
CoordinateObject
, player's current rotation in X, and Y values- When assigned to a variable or persistence, it will stay a
CoordinateObject
- Can be referenced in a string (such as a command) with
player.rotation
orplayer.rotation.x
andplayer.rotation.y
CoordinateObject
, player's current motion in X, Y, and Z values- When assigned to a variable or persistence, it will stay a
CoordinateObject
- Can be referenced in a string (such as a command) with
player.motion
orplayer.motion.x
,player.motion.y
, andplayer.motion.z
CoordinateObject
, player's spawn position in X, Y, and Z coordinates- When assigned to a variable or persistence, it will stay a
CoordinateObject
- Can be referenced in a string (such as a command) with
player.spawn_position
orplayer.spawn_position.x
,player.spawn_position.y
, andplayer.spawn_position.z
int
, player's current health- Value of
0-20
, but can be higher depending on attributes
int
, player's current hunger level- Value of
0-20
str
, player's current gamemode- Value of
'survival'
,'creative'
,'adventure'
, or'spectator'
float
, player's current xp level
bool
, isTrue
if player is on fire
bool
, isTrue
if player is flying
bool
, isTrue
if player is sleeping
bool
, isTrue
if player is drowning
int
, determines if player was hurt recently (in ticks)- Any value above
0
yields invincibilty until it reaches0
again
int
, how long since the player died (in ticks)
str
, the dimension that the player is currently in- Value of
'overworld'
,'the_nether'
, or'the_end'
dict
ofEffectObject
, player's current effects- Speed, for example can be accessed with
player.active_effects['speed'].duration
InventoryObject
, organized list of all items in the player's inventory- Attributes are
player.inventory.selected_item
,player.inventory.offhand
,player.inventory.hotbar
,player.inventory.armor
,player.inventory.inventory
- Each list is full of
ItemObject
, which can be accessed via lowercase NBT attributes like in game, and with Pythonic logic:player.inventory.selected_item.tag.display.name
orif "diamond_sword" in player.inventory
dict
, persistent variable storage for saving information between server restarts, or script reloads- Assigning or updating a key in the
player.persistent
dictionary will automatically save it, and can be accessed via the same key persistently until it is changed again, or deleted. Data will be saved only for the player referenced by the object, and only for the server. Data will not persist between different servers.
Warning: persistent data is only saved properly when the server shuts down gracefully, if the computer crashes or the server process is terminated forcefully, the persistent data will likely revert to previous values
Contains the server's back-up configuration and allows you to save, restore, or configure the UI settings.
Accessed via the global variable backup
Methods:
Immediately saves the state of the server to a back-up file.
Restores a back-up from a BackupObject
. Use the backup.latest
or backup.list
attribute to retrieve a BackupObject
.
- If the server is currently running, this function will do nothing. Schedule the restore in a @server.on_stop
Accepted parameters:
Parameter | Description |
---|---|
backup_obj* |
BackupObject , retrieve from backup.latest or backup.list |
Migrates all the back-up files from the previous directory to the specified new_directory
.
Accepted parameters:
Parameter | Description |
---|---|
new_directory* |
str of a folder on the filesystem, and will create it if it doesn't exist |
Configures the maximum amount of back-ups that can be saved to backup.directory
before overwriting.
Accepted parameters:
Parameter | Description |
---|---|
amount* |
int or 'unlimited' |
Enables or disables automatic server back-ups.
Accepted parameters:
Parameter | Description |
---|---|
enabled* |
bool to enable automatic back-ups. Defaults to True . |
Attributes:
Note: All attributes are read-only, and thus will not change the server data when modified
str
, default filesystem directory to save and restore back-ups from
int
or'unlimited'
, shows the maximum amount of back-ups allowed inbackup.directory
bool
, shows whether automatic server back-ups are enabled or not
int
, contains storage utilization in bytes of all back-ups inbackup.directory
BackupObject
, file details of the most recent back-up- Available attributes are
BackupObject.path
,BackupObject.size
, andBackupObject.date
list
ofBackupObject
, file details of all back-ups sorted from most recent in descending order atbackup.list[0]
- Available attributes are
BackupObject.path
,BackupObject.size
, andBackupObject.date
Contains the server's access control configuration and manages the whitelist, bans, and operators programmatically.
Accessed via the global variable acl
The AclManager
conceptualizes both users and IP addresses as AclRule
objects in their respective lists in the acl.rules
attribute. A majority of the methods include and modify the 'bans'
, 'ops'
, 'wl'
, and 'subnets'
keys in this attribute.
- An
AclRule
is structured in the following format:
class AclRule():
# ID/name of the rule
self.rule <str>
# 'player' or 'ip'
self.rule_type <str>
# 'local' or 'global'
self.rule_scope <str>
# 'ops', 'bans', 'wl', or 'subnets'
self.acl_group <str>
# Extra content (ban reason, IP geolocation, etc.)
self.extra_data <dict>
# To be added when rule is displayed from AclManager
self.display_data <dict>
Methods:
Kicks a player or list of players, optionally with a reason.
Accepted parameters:
Parameter | Description |
---|---|
rule_list* |
PlayerScriptObject, str of username, or a list of either |
reason |
str , reason for the kick displayed in the menu, and log |
Bans/pardons a player, IP, list of players, or list of IP's, optionally with a reason. A subnet range such as 192.168.0.0/24
is also acceptable. You can whitelist an IP or subnet with !w192.168.0.5
.
Accepted parameters:
Parameter | Description |
---|---|
rule_list* |
PlayerScriptObject, str of username/IP, or a list of either |
remove |
bool , removes rule from effect. Defaults to False |
reason |
str , reason for the ban displayed in the menu, and log |
Ops/de-ops a player or list of players.
Accepted parameters:
Parameter | Description |
---|---|
rule_list* |
PlayerScriptObject, str of username, or a list of either |
remove |
bool , removes rule from effect. Defaults to False |
Adds/removes a player or list of players to/from the whitelist.
Accepted parameters:
Parameter | Description |
---|---|
rule_list* |
PlayerScriptObject, str of username, or a list of either |
remove |
bool , removes rule from effect. Defaults to False |
Enables or disables the server whitelist.
Accepted parameters:
Parameter | Description |
---|---|
enabled* |
bool , to enable or disable the whitelist. Defaults to True |
Adds a player or list of players to a specified list type for every server.
Accepted parameters:
Parameter | Description |
---|---|
rule_list* |
PlayerScriptObject, str of username, or a list of either |
list_type* |
str , can be 'ops' , 'bans' , or 'wl' |
remove |
bool , removes rule from effect. Defaults to False |
Reloads the list type from the server .json
files and refreshes acl.rules
. If list_type
is unspecified, all data is reloaded.
Accepted parameters:
Parameter | Description |
---|---|
list_type |
str , can be 'ops' , 'bans' , or 'wl' |
Similar to the acl.*_player
methods, but only edits acl.rules
in memory without writing to disk.
Accepted parameters:
Parameter | Description |
---|---|
rule_list* |
PlayerScriptObject, str of username, or a list of either |
list_type* |
str , can be 'ops' , 'bans' , or 'wl' |
remove |
bool , removes rule from effect. Defaults to False |
Writes data from acl.rules
to disk in their respective format. Works pre-1.8 for .txt
files, and post-1.8 for .json
files.
Checks if a player or IP is in a specified list type. Returns bool
Accepted parameters:
Parameter | Description |
---|---|
rule* |
PlayerScriptObject or str of username or IP |
list_type* |
str , can be 'ops' , 'bans' , 'wl' , or 'subnets' |
Counts rules in the specified list type, or all rules if unspecified. Returns the total amount as int
.
Accepted parameters:
Parameter | Description |
---|---|
list_type |
str , can be 'ops' , 'bans' , or 'wl' |
Retrieves all the access control data associated with a rule. Returns a new AclRule
with additional data in the AclRule.extra_data
dictionary.
Accepted parameters:
Parameter | Description |
---|---|
rule_name* |
str of username, IP, or subnet |
Attributes:
Note: All attributes are read-only, and thus will not change the server data when modified
dict
, contains lists ofAclRule
objects with the following structure:
acl.rules = {
'ops': [AclRule, AclRule, ...],
'bans': [AclRule, AclRule, ...],
'wl': [AclRule, AclRule, ...],
'subnets': [AclRule, AclRule, ...]
}
list
, contains anAclRule
for every player who has joined the server in theusercache.json
, or who has player data in the world
dict
, structured similarly toacl.rules
, but contains an organized list of disabled and enabled items for each list type. Used for the UI
AclRule
, contains the rule returned from theacl.get_rule()
method
bool
, whether or not the server whitelist is enforced
Contains the server's add-on configuration. Manages both plugins and mods depending on the server distribution.
Accessed via the global variable addon
Note: Vanilla servers don't support addons, but the
AddonManager
is still included for compatibility with certain scripts. Because of this, the following methods and attributes will returnNone
, and emptylist
orFalse
with certain checks. Eventually, the emptyAddonManager
for Vanilla servers will be replaced with datapack functionality.
The AddonManager
conceptualizes add-ons in a few different formats:
- For all functionality relating to data stored locally, add-ons are abstracted as an
AddonFileObject
. The attributes are as follows:
class AddonFileObject():
self.addon_object_type = "file"
# The name defined in the '.jar' file
self.name <str>
# Type of add-on: 'forge', 'fabric', or 'bukkit'
self.type <str>
# The author defined in the '.jar' file
self.author <str>
# A short description defined in the '.jar' file
self.subtitle <str>
# A short, unique identifier of the add-on
self.id <str>
# The full file path of the '.jar' file
self.path <str>
# Add-on version defined in the '.jar' file
self.addon_version <str>
# Whether or not the add-on is enabled in auto-mcs
self.enabled <bool>
- For all functionality relating to data stored on the internet, add-ons are abstracted as an
AddonWebObject
. The attributes are as follows:
class AddonWebObject():
self.addon_object_type = "web"
# The name defined on the internet
self.name <str>
# Type of add-on: 'forge', 'fabric', or 'bukkit'
self.type <str>
# The author defined on the internet
self.author <str>
# A short description defined on the internet
self.subtitle <str>
# A short, unique identifier of the add-on (the URL slug)
self.id <str>
# The full URL of the website hosting the project
self.url <str>
# Add-on version defined on the download page
self.addon_version <str>
# Whether or not the add-on has a version available for your server
self.supported <bool>
# Constains all supported Minecraft versions
self.versions <str>
# A long-form description of the project defined on the internet
self.description <str>
# A direct download link to the appropriate version for the server
self.download_url <str>
# Download version of 'self.download_url'
self.download_version <str>
Methods:
Returns a list
of AddonWebObject
that match your query, sorted in descending order from index[0]
.
Accepted parameters:
Parameter | Description |
---|---|
query* |
str , partial search term or full add-on name |
Downloads an add-on from a string of the add-on name, ID, or an AddonWebObject
provided by addon.search_addons()
. The file is saved in addon.addon_path
.
Note: This method will automatically determine the most compatible version for your server.
Accepted parameters:
Parameter | Description |
---|---|
addon* |
str or AddonWebObject to download |
Imports a .jar
file to addon.addon_path
.
Accepted parameters:
Parameter | Description |
---|---|
addon_path* |
str , full system path to the .jar file |
Enables/disables an installed add-on. Retrieve an AddonFileObject
with addon.get_addon()
or from addon.installed_addons
.
Note: The server requires a restart for changes to take effect
Accepted parameters:
Parameter | Description |
---|---|
addon* |
AddonFileObject , from addon.get_addon() or addon.installed_addons |
enabled* |
bool , to enable or disable the add-on. Defaults to True |
Permanently deletes an installed add-on. Retrieve an AddonFileObject
with addon.get_addon()
or from addon.installed_addons
.
Note: The server requires a restart for changes to take effect
Accepted parameters:
Parameter | Description |
---|---|
addon* |
AddonFileObject , from addon.get_addon() or addon.installed_addons |
Retrieves an AddonFileObject
from the installed server add-ons, or AddonWebObject
from the online repository if online
is True
.
Accepted parameters:
Parameter | Description |
---|---|
addon_name* |
str , add-on name |
online |
bool , retrieves online data instead if True . Defaults to False |
Returns a single list
of both enabled and disabled AddonFileObject
from addon.installed_addons
.
Checks the AddonFileObject.addon_version
for all the installed add-ons against the internet to see if an update is available. Returns True
if one or more plugins require an update, and the value is stored in the addon.update_required
attribute.
Note: Currently, the only way to update add-ons is through the UI
Inspects installed add-ons to determine if Geyser and Floodgate are installed. Returns True
if they are available, and the value is stored in the addon.geyser_support
attribute.
Attributes:
Note: All attributes are read-only, and thus will not change the server data when modified
dict
, contains lists ofAddonFileObject
with the following structure:
addon.installed_addons = {
'enabled': [AddonFileObject, AddonFileObject, ...],
'disabled': [AddonFileObject, AddonFileObject, ...]
}
str
, full filesystem path to the server's add-ons directory
str
, full filesystem path to the server's disabled add-ons directory
bool
,True
if one or more add-ons can be updated
bool
,True
if Geyser and Floodgate are installed
Contains the server's amscript configuration.
Accessed via the global variable amscript
The ScriptManager
conceptualizes scripts in a few different formats:
- For all functionality relating to data stored locally, scripts are abstracted as an
AmsFileObject
. The attributes are as follows:
class AmsFileObject():
self.addon_object_type = "file"
# The title defined in the script
self.title <str>
# The author defined in the script
self.author <str>
# The description defined in the script
self.description <str>
# The file name of the script
self.file_name <str>
# The full file path of the script
self.path <str>
# Add-on version defined in the script
self.version <str>
# Whether or not the script is enabled in auto-mcs
self.enabled <bool>
- For all functionality relating to data stored on the internet, scripts are abstracted as an
AmsWebObject
. The attributes are as follows:
class AmsWebObject():
self.addon_object_type = "web"
# The title defined on the internet
self.title <str>
# The author defined on the internet
self.author <str>
# The description defined on the internet
self.description <str>
# The file name defined of the internet
self.file_name <str>
# The full URL of the project on the internet
self.url <str>
# A direct download link to the appropriate version for the server
self.download_url <str>
# The script version defined on the internet
self.version <str>
# Whether or not the script is installed
self.installed <bool>
# A direct download link to required dependencies, or None
self.libs <str>
Methods:
Returns a list
of AmsWebObject
that match your query, sorted in descending order from index[0]
.
Accepted parameters:
Parameter | Description |
---|---|
query* |
str , partial search term or full script name |
Downloads a script from a string of the script name, or an AddonWebObject
provided by addon.search_addons()
. The file is saved in amscript.script_path
.
Accepted parameters:
Parameter | Description |
---|---|
script* |
str or AmsWebObject to download |
Imports an .ams
file to amscript.script_path
.
Accepted parameters:
Parameter | Description |
---|---|
addon_path* |
str , full system path to the .ams file |
Enables/disables an installed script. Retrieve an AmsFileObject
with amscript.get_script()
or from amscript.installed_scripts
.
Note: The amscript engine requires a restart for changes to take effect
Accepted parameters:
Parameter | Description |
---|---|
script* |
AmsFileObject , from amscript.get_script() or amscript.installed_scripts |
enabled* |
bool , to enable or disable the script. Defaults to True |
Permanently deletes an installed script. Retrieve an AmsFileObject
with amscript.get_script()
or from amscript.installed_scripts
.
Note: The amscript engine requires a restart for changes to take effect
Accepted parameters:
Parameter | Description |
---|---|
script* |
AmsFileObject , from amscript.get_script() or amscript.installed_scripts |
Retrieves an AmsFileObject
from the installed server scripts, or AmsWebObject
from the online repository if online
is True
.
Accepted parameters:
Parameter | Description |
---|---|
script_name* |
str , script name |
online |
bool , retrieves online data instead if True . Defaults to False |
Returns a single list
of both enabled and disabled AmsFileObject
from amscript.installed_scripts
.
Attributes:
Note: All attributes are read-only, and thus will not change the server data when modified
dict
, contains lists ofAmsFileObject
with the following structure:
amscript.installed_scripts = {
'enabled': [AmsFileObject, AmsFileObject, ...],
'disabled': [AmsFileObject, AmsFileObject, ...]
}
str
, full filesystem path to the global auto-mcs script folder
str
, full filesystem path to the server's amscript.json
configuration file
Note: Every parameter with a * in the table is required for assignment, but doesn't need to be used
Note: If you're using delay, the
delay=<int>
keyword must be specified
Fired upon process execution by auto-mcs, not when a player can connect.
Accepted parameters:
Parameter | Description |
---|---|
data* |
dict of startup data, currently {'date': datetime} |
delay |
int or float , waits a specified amount of time in seconds before running |
@server.on_start(data, delay=0):
server.log("Server has started!")
Fired upon process termination by auto-mcs, not when /stop
or a crash is logged.
Accepted parameters:
Parameter | Description |
---|---|
data* |
dict of shutdown data, currently {'date': datetime, 'crash': str} |
delay |
int or float , waits a specified amount of time in seconds before running |
@server.on_stop(data, delay=0):
server.log("Server has stopped!")
Fired after every interval
. Loops until the server is closed, or manually cancelled with return
.
Accepted parameters:
Parameter | Description |
---|---|
interval |
int , defaults to 1 |
unit |
str , specifies interval scale, can be 'tick' , 'second' , 'minute' , or 'hour' . Defaults to 'second' |
@server.on_loop(interval=1, unit='minute'):
server.execute("/kill @e[type=item]")
server.log_success("Cleaned up items!")
Fired upon player successfully connecting to the server.
Accepted parameters:
Parameter | Description |
---|---|
player* |
PlayerScriptObject sent at execution |
data* |
dict of login data, currently {'uuid': uuid, 'ip': ip address, 'date': datetime, 'logged-in': True} |
delay |
int or float , waits a specified amount of time in seconds before running |
@player.on_join(player, data):
player.log(f'Welcome to the server {player.name}!')
Fired upon player disconnecting from the server.
Accepted parameters:
Parameter | Description |
---|---|
player* |
PlayerScriptObject sent at execution |
data* |
dict of logout data, currently {'uuid': uuid, 'ip': ip address, 'date': datetime, 'logged-in': False} |
delay |
int or float , waits a specified amount of time in seconds before running |
@player.on_leave(player, data):
server.execute(f'/say Goodbye, {player.name}!')
Fired upon player sending a message in the chat, excluding commands.
Accepted parameters:
Parameter | Description |
---|---|
player* |
PlayerScriptObject sent at execution |
message* |
str of the message |
delay |
int or float , waits a specified amount of time in seconds before running |
@player.on_message(player, message):
if "can i have op" in message.lower():
acl.ban_player(player)
Fired upon player dying to the environment or another player.
Accepted parameters:
Parameter | Description |
---|---|
player* |
PlayerScriptObject sent at execution of the victim |
enemy* |
PlayerScriptObject sent at execution of the attacker (None if player was killed by the environment) |
message* |
str of the message |
delay |
int or float , waits a specified amount of time in seconds before running |
@player.on_death(player, enemy, message):
if enemy:
enemy.log(f"/say Did you know: murder is a crime {enemy}?")
acl.ban_player(enemy)
else:
player.log(f"You should really be more careful {player}!")
Used for registering custom commands and augmenting existing ones.
Note: Commands will start with
!
therefore making them visible when executed by a player from the in-game chat, though the feedback is hidden when using theserver.log()
andplayer.log()
methods. They are completely hidden if executed from the server console.
Accepted parameters:
Parameter | Description |
---|---|
player* |
PlayerScriptObject sent at execution |
command* |
str to specify the command verb |
arguments |
dict specifying requirement for execution {'arg1': True} where True denotes a required argument. Only the last argument can be optional |
permission |
str , used to restrict execution to privileged users. Can be 'anyone' , 'op' , 'server' , or a custom player permission. Defaults to 'anyone' |
description |
str for !help menu. Command will be shown to users which meet the minimum permission level |
hidden |
bool , defaults to False . Hides command from all users (they can still be executed) and disables the wrapper functionality described below. Useful for augmenting existing commands |
@player.on_alias(player, command='test', arguments={'arg1': True, 'arg2': False}, permission='op'):
server.log(f'{player.name} executed {command} with the following arguments: {arguments}')
Note: Every alias automatically validates syntax and checks the player's permission level before execution
Following the above example when a player with the anyone
privilege executes !test foo bar
:
- amscript will determine that the player doesn't meet the minimum permission and will fail
- Permission tree is
server
>op
>anyone
Following the above example when a player with the op
or server
privilege executes !test foo bar
:
arguments
will be converted to{'arg1': 'foo', 'arg2': 'bar'}
after execution, and can be acccessed in the function as such- Calling
arguments['arg1']
will return the value of'foo'