|
1 | 1 | # SRegionProtector |
2 | | -SRegionProtector is a PowerNukkitX plugin that allows players to protect their regions. |
3 | | -## [Download](https://github.com/PowerNukkitX-Bundle/SRegionProtector/releases/tag/30.0) |
| 2 | + |
| 3 | +SRegionProtector is a flexible region-protection plugin for |
| 4 | +[PowerNukkitX](https://github.com/PowerNukkitX/PowerNukkitX). Players can claim |
| 5 | +areas, manage members and owners, configure protection flags, and work with |
| 6 | +regions through commands or a chest/form UI. |
| 7 | + |
| 8 | +> [!NOTE] |
| 9 | +> This repository is a port of the original Nukkit plugin to PowerNukkitX. |
| 10 | +> Because much of the code originates from the Nukkit version, it is not |
| 11 | +> intended as a reference project for learning the PowerNukkitX API. |
4 | 12 |
|
5 | 13 | ## Features |
6 | | -* Chest and form UI with custom page support |
7 | | -* API for another plugins |
8 | | -* Lots of flags |
9 | | -* Flexible settings |
10 | | -* High performance |
11 | 14 |
|
12 | | -</details> |
| 15 | +- Cuboid region creation with a selection wand or position commands |
| 16 | +- Region owners and members |
| 17 | +- Configurable protection flags |
| 18 | +- Chest and form-based user interfaces |
| 19 | +- YAML, SQLite, MySQL, and PostgreSQL storage |
| 20 | +- Optional region creation costs and region trading through LlamaEconomy |
| 21 | +- Region priorities, borders, teleportation, and data migration |
| 22 | +- English, Russian, and Korean translations |
| 23 | +- Asynchronous command execution, loading, and automatic saves |
| 24 | + |
| 25 | +## Requirements |
| 26 | + |
| 27 | +- A current PowerNukkitX server |
| 28 | +- Java 21 |
| 29 | +- [LlamaEconomy](https://powernukkitx.org/plugins/PowerNukkitX-Bundle.LlamaEconomy) |
| 30 | + (optional; required for economy features) |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +1. Download the latest JAR from the |
| 35 | + [GitHub releases page](https://github.com/PowerNukkitX-Bundle/SRegionProtector/releases). |
| 36 | +2. Copy the JAR into the server's `plugins` directory. |
| 37 | +3. Start the server once to generate the configuration files. |
| 38 | +4. Stop the server, adjust the files in `plugins/SRegionProtector/`, and start |
| 39 | + it again. |
| 40 | + |
| 41 | +The default configuration uses YAML storage, so no database setup is required |
| 42 | +for a basic installation. |
| 43 | + |
| 44 | +## Quick start |
| 45 | + |
| 46 | +All subcommands are available through `/region` or its alias `/rg`. |
| 47 | + |
| 48 | +1. Run `/rg wand` to receive the selection wand. |
| 49 | +2. Select two opposite corners of the area. Alternatively, use `/rg pos1` and |
| 50 | + `/rg pos2`. |
| 51 | +3. Check the selection with `/rg size` or `/rg showborder`. |
| 52 | +4. Create the region with `/rg create <name>`. |
| 53 | +5. Open its interface with `/rg gui <name>` or manage it through commands. |
| 54 | + |
| 55 | +Run `/rg help` in-game to see every command available to you. Commands can |
| 56 | +also be registered individually unless `hide-commands` is enabled. |
| 57 | + |
| 58 | +## Common commands |
| 59 | + |
| 60 | +| Command | Description | |
| 61 | +| --- | --- | |
| 62 | +| `/rg wand` | Gives the region selection wand | |
| 63 | +| `/rg pos1 [position]` | Sets the first selection point | |
| 64 | +| `/rg pos2 [position]` | Sets the second selection point | |
| 65 | +| `/rg create <region>` | Creates a region from the current selection | |
| 66 | +| `/rg info [region]` | Shows information about a region | |
| 67 | +| `/rg list <owner\|member\|creator>` | Lists matching regions | |
| 68 | +| `/rg gui [region]` | Opens the configured region UI | |
| 69 | +| `/rg flag <region> <flag> <allow\|deny>` | Changes a region flag | |
| 70 | +| `/rg addmember <region> <player>` | Adds a member | |
| 71 | +| `/rg removemember <region> <player>` | Removes a member | |
| 72 | +| `/rg addowner <region> <player>` | Adds an owner | |
| 73 | +| `/rg removeowner <region> <player>` | Removes an owner | |
| 74 | +| `/rg teleport <region>` | Teleports to a region | |
| 75 | +| `/rg select <region>` | Loads an existing region as the selection | |
| 76 | +| `/rg remove <region>` | Deletes a region | |
| 77 | + |
| 78 | +Permissions follow the pattern |
| 79 | +`sregionprotector.command.<subcommand>`. For example, `/rg create` requires |
| 80 | +`sregionprotector.command.create`. Most player commands are granted by |
| 81 | +default; administrative commands and sensitive flags default to operators. |
| 82 | +See [`plugin.yml`](src/main/resources/plugin.yml) for the complete permission |
| 83 | +tree and defaults. |
| 84 | + |
| 85 | +## Configuration |
| 86 | + |
| 87 | +The plugin creates its files under `plugins/SRegionProtector/`. |
| 88 | + |
| 89 | +| File or directory | Purpose | |
| 90 | +| --- | --- | |
| 91 | +| `config.yml` | General settings, storage provider, UI, performance, and limits | |
| 92 | +| `region-settings.yml` | Default flag values and region-specific settings | |
| 93 | +| `DB/` | SQLite, MySQL, and PostgreSQL connection settings | |
| 94 | +| `Lang/` | Language files | |
| 95 | +| `Regions/` and `Flags/` | Data used by the YAML provider | |
| 96 | + |
| 97 | +Important options in `config.yml` include: |
| 98 | + |
| 99 | +- `provider`: `yaml`, `sqlite`, `mysql`, or `postgresql` |
| 100 | +- `language`: `default`, `eng`, `rus`, or `kor` |
| 101 | +- `gui-type`: `chest` or `form` |
| 102 | +- `active-flags`: enables individual flag handlers; disabled flags do not |
| 103 | + enforce protection |
| 104 | +- `default-max-region-size` and `default-max-region-amount`: player limits |
| 105 | +- `region-creation-price` and `price-per-block`: economy-based creation costs |
| 106 | +- `priority-system`: enables priorities for overlapping regions |
| 107 | + |
| 108 | +> [!IMPORTANT] |
| 109 | +> Flags are selectively enabled in `active-flags`. If a flag appears to have |
| 110 | +> no effect, check that section before reporting a problem. |
| 111 | +
|
| 112 | +### Database storage |
| 113 | + |
| 114 | +Set `provider` in `config.yml`, then edit the corresponding file in `DB/`. |
| 115 | + |
| 116 | +```yaml |
| 117 | +# config.yml |
| 118 | +provider: mysql |
| 119 | +``` |
| 120 | +
|
| 121 | +For MySQL and PostgreSQL, configure `address`, `port`, `database`, `username`, |
| 122 | +and `password`. SQLite only requires its database file setting. Restart the |
| 123 | +server after changing providers. |
| 124 | + |
| 125 | +The administrative migration command can copy existing regions between |
| 126 | +providers: |
| 127 | + |
| 128 | +```text |
| 129 | +/rg migrate <source-provider> <target-provider> |
| 130 | +``` |
| 131 | + |
| 132 | +Back up the plugin directory and database before migrating production data. |
| 133 | + |
| 134 | +## Building from source |
| 135 | + |
| 136 | +The project uses Maven and targets Java 21. |
| 137 | + |
| 138 | +```bash |
| 139 | +git clone https://github.com/PowerNukkitX-Bundle/SRegionProtector.git |
| 140 | +cd SRegionProtector |
| 141 | +mvn clean package |
| 142 | +``` |
| 143 | + |
| 144 | +The shaded plugin JAR is written to `target/SRegionProtector.jar`. |
| 145 | +PowerNukkitX and LlamaEconomy are provided dependencies and are not bundled |
| 146 | +into the artifact. |
| 147 | + |
| 148 | +## Support and contributing |
| 149 | + |
| 150 | +- Report reproducible bugs through |
| 151 | + [GitHub Issues](https://github.com/PowerNukkitX-Bundle/SRegionProtector/issues). |
| 152 | +- Existing usage notes are available in the |
| 153 | + [project wiki](https://github.com/SergeyDertan/SRegionProtector/wiki). |
| 154 | +- Pull requests are welcome. Please describe the motivation and test the |
| 155 | + resulting JAR on PowerNukkitX. |
13 | 156 |
|
14 | | -## Commands and permissions can be found at [Wiki](https://github.com/SergeyDertan/SRegionProtector/wiki). |
| 157 | +When reporting an issue, include the PowerNukkitX version, Java version, |
| 158 | +SRegionProtector version, selected storage provider, relevant configuration, |
| 159 | +and the complete error log. |
15 | 160 |
|
16 | | -## !Warning! some flags may not work because they are disabled, pls check config.yml first |
| 161 | +## License |
17 | 162 |
|
18 | | -## This is a port of the nukkit plugin to PNX. Please do not use this as a reference when learning to code for PNX. |
| 163 | +SRegionProtector is distributed under the |
| 164 | +[GNU General Public License v3.0](LICENSE.MD). |
0 commit comments