refactor: housekeeping, update docs

This commit is contained in:
William278 committed 2024-02-18 14:22:03 +00:00
1 parent 046d8e99f7
commit 842f7d4297
6 files changed
+28 -23

No files matched your search

+10 -2
View File
@@ -6,7 +6,15 @@ HuskHomes supports restricting certain actions behind an economic cost. Players
> **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. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files).
To enable the Economy Hook on a Spigot/Paper server, install both [Vault](https://www.spigotmc.org/resources/vault.34315/) and a compatible economy plugin. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files).
</details>
<details>
<summary>Fabric setup</summary>
> **Applies to:** Fabric
To enable the Economy Hook on a Fabric server, the [Impactor Economy](https://modrinth.com/mod/impactor) mod must be installed to provide an API for plugins to perform economy operations. Then, set `enabled` to `true` under the `economy` section of [`config.yml`](config-files).
</details>
<details>
@@ -14,7 +22,7 @@ To enable the Economy Hook on Sponge server, install both [Vault](https://www.sp
> **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).
To enable the Economy Hook on a 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
+3 -1
View File
@@ -1,4 +1,6 @@
If you have [PlaceholderAPI](https://github.com/PlaceholderAPI/PlaceholderAPI) installed, HuskHomes (v4.0.5+) will automatically register a hook providing a number of placeholders that will be replaced with their appropriate values.
HuskHomes (v4.0.5+) can register a hook providing a number of placeholders that will be replaced with their appropriate values.
On Spigot/Paper, this requires [PlaceholderAPI](https://github.com/PlaceholderAPI/PlaceholderAPI); on Fabric, [Fabric PlaceholderAPI](https://modrinth.com/mod/placeholder-api) is needed instead.
## List of placeholders
| Placeholder | Description | Example Value |
+4 -10
View File
@@ -6,22 +6,14 @@ apply plugin: 'fabric-loom'
loom.serverOnlyMinecraftJar()
repositories {
maven {
url "https://maven.impactdev.net/repository/development/"
name "Impactor Economy"
}
maven {
url "https://maven.nucleoid.xyz/"
name "placeholderapi"
}
maven { url 'https://maven.impactdev.net/repository/development/' }
maven { url 'https://maven.nucleoid.xyz/' }
}
dependencies {
minecraft "com.mojang:minecraft:${fabric_minecraft_version}"
mappings "net.fabricmc:yarn:${fabric_yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation("net.impactdev.impactor.api:economy:${impactor_api_version}")
modImplementation include("eu.pb4:placeholder-api:${placeholder_api_version}")
// Fabric API modules
Set<String> fabricApiModules = [
@@ -37,6 +29,8 @@ dependencies {
}
modImplementation include("net.kyori:adventure-platform-fabric:${adventure_platform_fabric_version}")
modImplementation include("me.lucko:fabric-permissions-api:${fabric_permissions_api_version}")
modImplementation include("eu.pb4:placeholder-api:${fabric_placeholder_api_version}")
modImplementation("net.impactdev.impactor.api:economy:${fabric_impactor_api_version}")
implementation include("redis.clients:jedis:$jedis_version")
implementation include("org.apache.commons:commons-pool2:$commons_pool_version")
@@ -53,7 +53,7 @@ import net.william278.huskhomes.database.SqLiteDatabase;
import net.william278.huskhomes.event.FabricEventDispatcher;
import net.william278.huskhomes.hook.FabricImpactorEconomyHook;
import net.william278.huskhomes.hook.Hook;
import net.william278.huskhomes.hook.PlaceHolderAPIHook;
import net.william278.huskhomes.hook.FabricPlaceholderAPIHook;
import net.william278.huskhomes.listener.EventListener;
import net.william278.huskhomes.listener.FabricEventListener;
import net.william278.huskhomes.manager.Manager;
@@ -203,7 +203,7 @@ public class FabricHuskHomes implements DedicatedServerModInitializer, HuskHomes
}
if (isDependencyLoaded("placeholder-api")) {
getHooks().add(new PlaceHolderAPIHook(this));
getHooks().add(new FabricPlaceholderAPIHook(this));
}
}
@@ -30,14 +30,16 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public class PlaceHolderAPIHook extends Hook {
public class FabricPlaceholderAPIHook extends Hook {
public PlaceHolderAPIHook(@NotNull FabricHuskHomes plugin) {
public FabricPlaceholderAPIHook(@NotNull FabricHuskHomes plugin) {
super(plugin, "Fabric PlaceholderAPI");
}
private Identifier createIdentifier(String placeholderName) {
return new Identifier("huskhomes", placeholderName);
@SuppressWarnings("SameParameterValue")
@NotNull
private Identifier createIdentifier(@NotNull String name) {
return new Identifier("huskhomes", name);
}
@Override
@@ -47,7 +49,6 @@ public class PlaceHolderAPIHook extends Hook {
return PlaceholderResult.invalid("No player!");
}
if (arg == null) {
return PlaceholderResult.invalid("No argument for player!");
}
@@ -79,7 +80,7 @@ public class PlaceHolderAPIHook extends Hook {
};
if (response == null) {
return PlaceholderResult.invalid("invaild argument for player!");
return PlaceholderResult.invalid("Invaild argument for player!");
}
return PlaceholderResult.value(response);
+2 -2
View File
@@ -24,5 +24,5 @@ fabric_yarn_mappings=1.20.4+build.3
fabric_api_version=0.95.4+1.20.4
fabric_permissions_api_version=0.2-SNAPSHOT
adventure_platform_fabric_version=5.11.0
impactor_api_version=5.1.1-SNAPSHOT
placeholder_api_version=2.3.0+1.20.3
fabric_impactor_api_version=5.1.1-SNAPSHOT
fabric_placeholder_api_version=2.3.0+1.20.3