Add new economy actions, update API docs to use new repo, add metrics to Sponge (#398)

This commit is contained in:
William authored and GitHub committed 2023-05-09 19:24:24 +01:00
1 parent 8b609010ec
commit 40cb340b15
33 files changed
+437 -159

No files matched your search

+17 -12
View File
@@ -1,9 +1,9 @@
The HuskHomes API provides methods for getting, editing and updating user homes and warps, as well as functionality for building and executing (cross-server) teleports.
The API is distributed via [JitPack](https://jitpack.io/#net.william278/HuskHomes2), where you can also [view the JavaDocs](https://javadoc.jitpack.io/net/william278/HuskHomes2/latest/javadoc/).
The API is distributed on Maven through [repo.william278.net](https://repo.william278.net/#/releases/net/william278/huskhomes/) and can be included in any Maven, Gradle, etc. project. JavaDocs are [available here](https://repo.william278.net/javadoc/releases/net/william278/huskhomes/latest).
## Compatibility
![HuskHomes CI](https://jitpack.io/v/WiIIiam278/HuskHomes2.svg)
[![Maven](https://repo.william278.net/api/badge/latest/releases/net/william278/huskhomes?color=00fb9a&name=Maven&prefix=v)](https://repo.william278.net/#/releases/net/william278/huskhomes/)
The HuskHomes API shares version numbering with the plugin itself for consistency and convenience. Please note minor and patch plugin releases may make API additions and deprecations, but will not introduce breaking changes without notice.
@@ -14,6 +14,11 @@ The HuskHomes API shares version numbering with the plugin itself for consistenc
| v2.x | _v2.0—v2.11.2_ | ❌ |
| v1.x | _v1.5—v1.5.11_ | ❌ |
<details>
<summary>Targeting older versions</summary>
HuskHomes versions prior to `v4.3.1` are distributed on [JitPack](https://jitpack.io/#/net/william278/HuskHomes2), and you will need to use the `https://jitpack.io` repository instead.
</details>
## Table of contents
1. Adding the API to your project
@@ -25,21 +30,21 @@ The HuskHomes API shares version numbering with the plugin itself for consistenc
<details>
<summary>Maven setup information</summary>
Add the repository to your `pom.xml` as per below.
Add the repository to your `pom.xml` as per below. You can alternatively specify `/snapshots` for the repository containing the latest development builds (not recommended).
```xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
<id>william278.net</id>
<url>https://repo.william278.net/releases</url>
</repository>
</repositories>
```
Add the dependency to your `pom.xml` as per below. Replace `version` with the latest version of HuskHomes (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskHomes2?color=%23282828&label=%20&style=flat-square)
Add the dependency to your `pom.xml` as per below. Replace `VERSION` with the latest version of HuskHomes (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskHomes2?color=%23282828&label=%20&style=flat-square)
```xml
<dependency>
<groupId>net.william278</groupId>
<artifactId>HuskHomes2</artifactId>
<version>version</version>
<artifactId>huskhomes</artifactId>
<version>VERSION</version>
<scope>provided</scope>
</dependency>
```
@@ -49,19 +54,19 @@ Add the dependency to your `pom.xml` as per below. Replace `version` with the la
<details>
<summary>Gradle setup information</summary>
Add the dependency like so to your `build.gradle`:
Add the dependency as per below to your `build.gradle`. You can alternatively specify `/snapshots` for the repository containing the latest development builds (not recommended).
```groovy
allprojects {
repositories {
maven { url 'https://jitpack.io' }
maven { url 'https://repo.william278.net/releases' }
}
}
```
Add the dependency as per below. Replace `version` with the latest version of HuskHomes (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskHomes2?color=%23282828&label=%20&style=flat-square)
Add the dependency as per below. Replace `VERSION` with the latest version of HuskHomes (without the v): ![Latest version](https://img.shields.io/github/v/tag/WiIIiam278/HuskHomes2?color=%23282828&label=%20&style=flat-square)
```groovy
dependencies {
compileOnly 'net.william278:HuskHomes2:version'
compileOnly 'net.william278:huskhomes:VERSION'
}
```
</details>
+2 -2
View File
@@ -100,11 +100,11 @@ economy:
# Use this currency for payments (works only with RedisEconomy), defaults to Vault currency
redis_economy_name: vault
free_home_slots: 5
# Require money to perform certain actions. Check https://william278.net/docs/huskhomes/economy-hook for available actions
costs:
additional_home_slot: 100.0
random_teleport: 25.0
make_home_public: 50.0
back_command: 0.0
random_teleport: 25.0
map_hook:
# Display public homes/warps on your web map (supports Dynmap and BlueMap)
enabled: true
+56 -10
View File
@@ -1,20 +1,66 @@
HuskHomes supports charging players' Vault economy balances for performing certain actions. This requires the Vault plugin and a compatible economy plugin.
HuskHomes supports restricting certain actions behind an economic cost. Players must have enough money in their account to perform the action, otherwise the action will not be allowed. The cost of the action will be deducted from the player's account just before the action is performed.
To enable the economy hook, set `enabled` to `true` under the `economy` section of the config. Players with the `huskhomes.bypass.economy` permission bypass economy checks and don't need to pay for things.
## Setup
<details>
<summary>Spigot & Paper setup</summary>
> **Applies to:** Spigot, Paper
To enable the Economy Hook on Sponge server, install both [Vault](https://www.spigotmc.org/resources/vault.34315/) and a compatible economy plugin. Extended support for [RedisEconomy](https://github.com/Emibergo02/RedisEconomy) is also provided, and the `redis_economy_name` setting can be used to specify the currency to use for transactions. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files).
</details>
<details>
<summary>Sponge setup</summary>
> **Applies to:** Sponge
To enable the Economy Hook on Sponge server, you require a mod installed for managing player economy accounts through the Sponge economy API. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files).
</details>
### Bypassing economy checks
Players with the `huskhomes.bypass.economy` [permission node](commands) bypass economy checks and can perform economy actions without paying.
## Home slots
With the economy hook enabled, players will need to pay for home slots beyond their initial "free" allotment.
The price will be levied against the player when they attempt to set home and have no free slots left. A warning message will notify the player of this when they have set their last free home slot.
You can configure the number of 'free home slots' a user gets using the `free_home_slots` setting in the `economy` section. The default is `5`.
You can configure the number of 'free home slots' a user gets using the `free_home_slots` setting in the `economy` section of the config. The default is `5`.
## Economy actions
You can set prices to charge for these actions.
You can set the economy cost for the following actions in the `costs` section of the `config.yml` file. Note that this section by default only has the `additional_home_slot`, `make_home_public` and `random_teleport` actions defined. Add the other actions to this section of the file and associate a price with them to enable them.
| Action | Description | Default Price |
|------------------------|---------------------------------------------|---------------|
| `ADDITIONAL_HOME_SLOT` | When a user wants to buy another home slot | `$100.00` |
| `MAKE_HOME_PUBLIC` | When a user wants to make their home public | `$50.00` |
| `RANDOM_TELEPORT` | When a user executes /rtp | `$25.00` |
| `BACK_COMMAND` | When a user executes /back | `$0.00` |
### Table of actions
| Economy Action | Description | Default Cost |
|---------------------------|-------------------------------------------------------------|-------------:|
| `additional_home_slot` | When a user wants to buy another home slot | `$100.00` |
| `make_home_public` | When a user wants to make their home public | `$50.00` |
| `random_teleport` | When a user executes /rtp | `$25.00` |
| `back_command` | When a user executes /back to return to their last position | `$0.00` |
| `home_teleport` | When a user executes /home to teleport to a home | `$0.00` |
| `public_home_teleport` | When a user uses /phome to teleport to a public home | `$0.00` |
| `warp_teleport` | When a user uses /warp to teleport to a warp | `$0.00` |
| `spawn_teleport` | When a user uses /spawn to teleport to spawn | `$0.00` |
| `send_teleport_request` | When a user sends a teleport request | `$0.00` |
| `accept_teleport_request` | When a user accepts an incoming teleport request | `$0.00` |
### Example config
<details>
<summary>Defining economy costs (config.yml)</summary>
```yaml
# Require money to perform certain actions. Check https://william278.net/docs/huskhomes/economy-hook for available actions
costs:
additional_home_slot: 100.0
make_home_public: 50.0
random_teleport: 25.0
back_command: 0.0
home_teleport: 0.0
public_home_teleport: 0.0
warp_teleport: 0.0
spawn_teleport: 0.0
send_teleport_request: 0.0
accept_teleport_request: 0.0
```
</details>