A CLIENT-MOD MUST BE INSTALLED TO USE CUSTOM KEYBINDS!
Introduction:
MythicKeysPlugin allows your server to setup and receive custom keypresses from a client with the MythicKeys mod installed.
You can specify what keybinds to allow and the possibilities are endless.
(Currently the only functionality is running commands and by using the Developer API, however, I am working on adding support for some external plugins.)
THE CLIENT MOD MUST BE INSTALLED TO USE THESE KEYBINDS!
YOU CAN READ MORE AND INSTALL THE MOD HERE.
(Joining your server will not
require the client mod, so people will never need to have the mod installed. However, it must be installed if they want to use the custom keypresses you've set up.)
Configuration:
Configuring the MythicKeysPlugin can be a little complicated at first, but is quite easy once you understand it. Take a look at the default config:
Code (YAML):
Keys:
example_key:
Id
:
"myserver:mycoolkey"
Name
:
"Example Key"
Category
:
"Example Category"
DefaultKey
: 74
RunCommand
:
"say %player%, you just pressed the example key!"
another_key:
Id
:
"examplekeytwo"
Name
:
"Another Key"
Category
:
"Example Category"
DefaultKey
: 77
RunCommand
:
"!msg %player% You pressed another example key. Nice."
First, let's go ahead and add a new key. Implement a new section in the `Keys` list.
In the default config example, we have two sections/keys added already:
`example_key` and `another_key`. The names of these sections are purely for organization and can be named anything.
Each key has four properties that we can change.
Id: The ID (Namespaced Key) of the pressed key which is passed to the event. Each key should have a unique ID. This ID can be used by other plugins to add unique cross-plugin functionality.
Name: The name of this keybinding as displayed in the settings. Pretty straight-forward.
Category: The category this key falls under in the settings. Should also be straight-forward. The key will be shown under the specified category, when changing your keybinds in the client mod.
DefaultKey: The default keybinding to use. This value is the numeral value of the
GLFW Keyboard Keys. For example, 77 is the M key and 74 is the J key.
RunCommand: A command to run on keypress. The commands support a simple %player% placeholder, as well as full PAPI support. If you wish to run a command from the console rather from the executing player, you simply need to add a exclamation mark to the start of the command.
You can leave this empty if you don't want the key to run a command.
Whenever a client (with the mod) joins the server, it will send out your desired keys and the mod will allow the player to use, see and customize (keybinding) them.
API:
There is currently no Maven repo, you will have to manually add the dependency.
Using the MythicKeyPlugin API is extremely easy. You simply need to listen for either the MythicKeyPressEvent or the MythicKeyReleaseEvent. The ID value of the event is the namespaced id corresponding to the specific keybind that has been added in config.yml.
An example:
If you specify a keybind in config.yml with the ID: "myserver:mycoolkey", then whenever that specific keybind is pressed, the MythicKeyPressEvent will fire and have an ID with the namespaced key "myserver:mycoolkey", etc.
When the key is released the MythicKeyReleaseEvent will be fired.
If you need more help, please ask on the MythicMobs discord or check the
GitHub page for the mod.
My Other Plugins
MythicMobs Discord