Plugin Stuffs
Attributes
Metadata
- class mcdreforged.plugin.meta.metadata.Metadata(data: dict | None, *, plugin: AbstractPlugin | None = None)[source]
The metadata of a MCDR plugin
- id: str
The id of the plugin. Should match regexp
[a-z][a-z0-9_]{0,63}
Changed in version v2.11.0: Plugin id starts with non-alphabet character is no longer disallowed
- description: str | Dict[str, str] | None
The description of the plugin
It can be a regular str or a
Dict[str, str]
indicating a mapping from language to description
- dependencies: Dict[str, VersionRequirement]
A dict of dependencies the plugin relies on
- Key:
The id of the dependent plugin
- Value:
The version requirement of the dependent plugin
- get_description(lang: str | None = None) str | None [source]
Return a translated plugin description in str
- Parameters:
lang – Optional, the language to translate to. When not specified it will use the language of MCDR
- Returns:
Translated plugin description
- class mcdreforged.plugin.meta.version.Version(version_str: str, *, allow_wildcard: bool = True)[source]
A version container that stores semver like version string
Example:
"1.2.3"
"1.0.*"
"1.2.3-pre4+build.5"
Plugin Event
- class mcdreforged.plugin.plugin_event.PluginEvent(event_id: str)[source]
The abstract base class of plugin event
A plugin event has an
id
field as its identifier
- class mcdreforged.plugin.plugin_event.LiteralEvent(event_id: str)[source]
Bases:
PluginEvent
A simple and minimum implementation of
PluginEvent
All information you need to construct a
LiteralEvent
object is only the event id- __init__(event_id: str)[source]
Create a
LiteralEvent
- Parameters:
event_id – The id of the plugin event
- class mcdreforged.plugin.plugin_event.MCDREvent(event_id: str, default_method_name: str)[source]
Bases:
PluginEvent
Plugin event that used in MCDR
Generally, only MCDR is supposed to construct
MCDREvent
- class mcdreforged.plugin.plugin_event.MCDRPluginEvents[source]
A collection of all possible
MCDREvent
objects used in MCDR- GENERAL_INFO = MCDREvent(id='mcdr.general_info', default_method_name='on_info')
- USER_INFO = MCDREvent(id='mcdr.user_info', default_method_name='on_user_info')
- SERVER_START = MCDREvent(id='mcdr.server_start', default_method_name='on_server_start')
- SERVER_STARTUP = MCDREvent(id='mcdr.server_startup', default_method_name='on_server_startup')
- SERVER_STOP = MCDREvent(id='mcdr.server_stop', default_method_name='on_server_stop')
- MCDR_START = MCDREvent(id='mcdr.mcdr_start', default_method_name='on_mcdr_start')
- MCDR_STOP = MCDREvent(id='mcdr.mcdr_stop', default_method_name='on_mcdr_stop')
- PLAYER_JOINED = MCDREvent(id='mcdr.player_joined', default_method_name='on_player_joined')
- PLAYER_LEFT = MCDREvent(id='mcdr.player_left', default_method_name='on_player_left')
- PLUGIN_LOADED = MCDREvent(id='mcdr.plugin_loaded', default_method_name='on_load')
- PLUGIN_UNLOADED = MCDREvent(id='mcdr.plugin_unloaded', default_method_name='on_unload')