mirror of
https://github.com/plexusorg/Website.git
synced 2025-07-01 07:36:42 +00:00
Upgrade dependencies and add more about modules
This commit is contained in:
@ -26,7 +26,7 @@ should set your version to that as well.
|
||||
|
||||
You should also look for this block of code in your `build.gradle.kts file`:
|
||||
|
||||
```kts title=build.gradle.kts
|
||||
```kotlin title="build.gradle.kts"
|
||||
tasks.getByName<Jar>("jar") {
|
||||
archiveBaseName.set("Module-ExampleModule")
|
||||
archiveVersion.set("")
|
||||
@ -48,7 +48,7 @@ Plex.
|
||||
|
||||
When you create a new command, you should register it in your main class as follows
|
||||
|
||||
```java
|
||||
```java title="/src/main/java/ExampleModule.java"
|
||||
registerCommand(new ExampleCommand());
|
||||
```
|
||||
|
||||
@ -66,14 +66,19 @@ the main command inside of the actual `execute()` block.
|
||||
|
||||
Listeners function just like they do in Bukkit, they listen for events. You'll want to do two things. Make sure your
|
||||
listener extends the `PlexListener` class rather than the Bukkit default `Listener` class. The `PlexListener` class is a
|
||||
wrapper for the `Listener` class and has the same functionality as the Bukkit one. You'll also want to ensure you register the listener in the main class as follows:
|
||||
```java
|
||||
wrapper for the `Listener` class and has the same functionality as the Bukkit one. You'll also want to ensure you
|
||||
register the listener in the main class as follows:
|
||||
|
||||
```java title="/src/main/java/ExampleModule.java"
|
||||
registerListener(new ExampleListener());
|
||||
```
|
||||
|
||||
Make sure you replace the `ExampleListener` class with your own class name.
|
||||
|
||||
You can listen for as many events as you like per class. An example to listen for an event when a player joins and send them a message is as follows:
|
||||
```java
|
||||
You can listen for as many events as you like per class. An example to listen for an event when a player joins and send
|
||||
them a message is as follows:
|
||||
|
||||
```java title="/src/main/java/ExampleModule.java"
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@ -81,3 +86,37 @@ public void onPlayerJoin(PlayerJoinEvent event)
|
||||
player.sendMessage(Component.text("This is a message from Plex's example module!").color(NamedTextColor.GOLD));
|
||||
}
|
||||
```
|
||||
|
||||
## Creating and using configuration files
|
||||
|
||||
To create a configuration file for your module, you should create a new folder in the `/src/main/resources` directory
|
||||
with the module name. An example for the example module would be `/src/main/resources/examplemodule`. Within the folder,
|
||||
you can create your `config.yml` file. In the main class, you should add a new `ModuleConfig` globally, and load it on
|
||||
the `load()` method.
|
||||
|
||||
```java title="/src/main/java/ExampleModule.java"
|
||||
public class ExampleModule extends PlexModule
|
||||
{
|
||||
@Getter
|
||||
private static ExampleModule module;
|
||||
|
||||
@Getter
|
||||
private ModuleConfig config;
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
module = this;
|
||||
config = new ModuleConfig(this, "examplemodule/config.yml", "config.yml");
|
||||
config.load();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `"tfmextras/config.yml"` part refers to where the configuration file is stored relative to `/src/main/resources`.
|
||||
The `"config.yml"` refers to where it should go inside the `/plugins/Plex/modules/Module-Example` folder.
|
||||
|
||||
You can then call values from the configuration with the following:
|
||||
```java
|
||||
ExampleModule.getModule().getConfig().getString("module.test-message");
|
||||
```
|
@ -12,7 +12,7 @@ this only in conjunction with ranks. If you are using permissions, there is not
|
||||
|
||||
The default `commands.yml` file is below.
|
||||
|
||||
```yaml title=/plugins/Plex/commands.yml
|
||||
```yaml title="/plugins/Plex/commands.yml"
|
||||
#
|
||||
# Command Blocker
|
||||
#
|
||||
|
@ -12,7 +12,7 @@ This page will show you how to modify the configuration file. The configuration
|
||||
|
||||
Below is the default `config.yml` file when Plex is loaded for the first time.
|
||||
|
||||
```yaml title=/plugins/Plex/config.yml
|
||||
```yaml title="/plugins/Plex/config.yml"
|
||||
# Plex Configuration File
|
||||
# For documentation, please visit: https://plex.us.org
|
||||
|
||||
|
@ -12,7 +12,7 @@ Almost all the messages inside of Plex are fully customizable. This page will do
|
||||
|
||||
The default `messages.yml` file is below.
|
||||
|
||||
```yaml title=/plugins/Plex/messages.yml
|
||||
```yaml title="/plugins/Plex/messages.yml"
|
||||
# Plex Messages File
|
||||
# This file uses the MiniMessage system.
|
||||
# Documentation available at https://docs.adventure.kyori.net/minimessage/format.html
|
||||
|
@ -15,7 +15,7 @@ bans.
|
||||
|
||||
## Default file
|
||||
|
||||
```yaml title=/plugins/Plex/indefbans.yml
|
||||
```yaml title="/plugins/Plex/indefbans.yml"
|
||||
# Plex Indefinite Bans File
|
||||
# Players with their UUID / IP / Usernames in here will be indefinitely banned until removed
|
||||
|
||||
|
@ -39,7 +39,7 @@ The password for Redis is set under the "Service Variables" tab. Please change i
|
||||
### Configuration
|
||||
Once the Redis server has been installed, go to the "File Manager" tab and open `redis.conf`. You will need to change the bind address.
|
||||
|
||||
```title=redis.conf
|
||||
```conf title="redis.conf"
|
||||
...
|
||||
################################## NETWORK #####################################
|
||||
|
||||
@ -73,7 +73,7 @@ Find this block in your Redis configuration file and ensure bind is set to `172.
|
||||
### Plex Configuration
|
||||
Redis should be successfully set up! Now all you have to do is enter your credentials into the Plex configuration file.
|
||||
|
||||
```yaml title=/plugins/Plex/config.yml
|
||||
```yaml title="/plugins/Plex/config.yml"
|
||||
side:
|
||||
enabled: true
|
||||
auth: true
|
||||
|
@ -14,7 +14,7 @@ generation support has been added to the official API.
|
||||
|
||||
| Plex Version | Minecraft Versions |
|
||||
|--------------|--------------------|
|
||||
| 1.5-SNAPSHOT | 1.20.6 - 1.21.3 |
|
||||
| 1.5-SNAPSHOT | 1.20.6 - 1.21.4 |
|
||||
| 1.4 | 1.20.4 |
|
||||
| 1.3 | 1.19.4 - 1.20.4 |
|
||||
| 1.2 | 1.18.2 - 1.19.2 |
|
||||
|
Reference in New Issue
Block a user