diff --git a/docs/Economy-Hook.md b/docs/Economy-Hook.md
index 47c54e82..533f011f 100644
--- a/docs/Economy-Hook.md
+++ b/docs/Economy-Hook.md
@@ -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).
+
+
+
+Fabric setup
+
+> **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).
@@ -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).
### Bypassing economy checks
diff --git a/docs/Placeholders.md b/docs/Placeholders.md
index 404a1a39..bbfb22fd 100644
--- a/docs/Placeholders.md
+++ b/docs/Placeholders.md
@@ -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 |
diff --git a/fabric/build.gradle b/fabric/build.gradle
index edb54950..d0daa704 100644
--- a/fabric/build.gradle
+++ b/fabric/build.gradle
@@ -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 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")
diff --git a/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java b/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java
index 3dc01f6f..9184c4fc 100644
--- a/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java
+++ b/fabric/src/main/java/net/william278/huskhomes/FabricHuskHomes.java
@@ -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));
}
}
diff --git a/fabric/src/main/java/net/william278/huskhomes/hook/PlaceHolderAPIHook.java b/fabric/src/main/java/net/william278/huskhomes/hook/FabricPlaceholderAPIHook.java
similarity index 89%
rename from fabric/src/main/java/net/william278/huskhomes/hook/PlaceHolderAPIHook.java
rename to fabric/src/main/java/net/william278/huskhomes/hook/FabricPlaceholderAPIHook.java
index 168677c0..488b8862 100644
--- a/fabric/src/main/java/net/william278/huskhomes/hook/PlaceHolderAPIHook.java
+++ b/fabric/src/main/java/net/william278/huskhomes/hook/FabricPlaceholderAPIHook.java
@@ -1,88 +1,89 @@
-/*
- * This file is part of HuskHomes, licensed under the Apache License 2.0.
- *
- * Copyright (c) William278
- * Copyright (c) contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.william278.huskhomes.hook;
-
-import eu.pb4.placeholders.api.PlaceholderResult;
-import eu.pb4.placeholders.api.Placeholders;
-import net.minecraft.util.Identifier;
-import net.william278.huskhomes.FabricHuskHomes;
-import net.william278.huskhomes.user.FabricUser;
-import net.william278.huskhomes.user.OnlineUser;
-import net.william278.huskhomes.user.SavedUser;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.List;
-
-public class PlaceHolderAPIHook extends Hook {
-
- public PlaceHolderAPIHook(@NotNull FabricHuskHomes plugin) {
- super(plugin, "Fabric PlaceholderAPI");
- }
-
- private Identifier createIdentifier(String placeholderName) {
- return new Identifier("huskhomes", placeholderName);
- }
-
- @Override
- public void initialize() {
- Placeholders.register(createIdentifier("player"), (ctx, arg) -> {
- if (!ctx.hasPlayer()) {
- return PlaceholderResult.invalid("No player!");
- }
-
-
- if (arg == null) {
- return PlaceholderResult.invalid("No argument for player!");
- }
-
- assert ctx.player() != null;
- final OnlineUser player = FabricUser.adapt(ctx.player(), (FabricHuskHomes) plugin);
-
- final String response = switch (arg) {
- case "homes_count" -> String.valueOf(plugin.getManager().homes()
- .getUserHomes()
- .getOrDefault(player.getUsername(), List.of()).size());
- case "max_homes" -> String.valueOf(plugin.getManager().homes().getMaxHomes(player));
- case "max_public_homes" -> String.valueOf(plugin.getManager().homes().getMaxPublicHomes(player));
- case "free_home_slots" -> String.valueOf(plugin.getManager().homes().getFreeHomes(player));
- case "home_slots" -> String.valueOf(plugin.getSavedUser(player)
- .map(SavedUser::getHomeSlots).orElse(0));
- case "homes_list" -> String.join(", ", plugin.getManager().homes()
- .getUserHomes()
- .getOrDefault(player.getUsername(), List.of()));
- case "public_homes_count" -> String.valueOf(plugin.getManager().homes()
- .getPublicHomes()
- .getOrDefault(player.getUsername(), List.of()).size());
- case "public_homes_list" -> String.join(", ", plugin.getManager().homes()
- .getPublicHomes()
- .getOrDefault(player.getUsername(), List.of()));
- case "ignoring_tp_requests" -> String.valueOf(plugin.getManager().requests()
- .isIgnoringRequests(player));
- default -> null;
- };
-
- if (response == null) {
- return PlaceholderResult.invalid("invaild argument for player!");
- }
-
- return PlaceholderResult.value(response);
- });
- }
+/*
+ * This file is part of HuskHomes, licensed under the Apache License 2.0.
+ *
+ * Copyright (c) William278
+ * Copyright (c) contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.william278.huskhomes.hook;
+
+import eu.pb4.placeholders.api.PlaceholderResult;
+import eu.pb4.placeholders.api.Placeholders;
+import net.minecraft.util.Identifier;
+import net.william278.huskhomes.FabricHuskHomes;
+import net.william278.huskhomes.user.FabricUser;
+import net.william278.huskhomes.user.OnlineUser;
+import net.william278.huskhomes.user.SavedUser;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class FabricPlaceholderAPIHook extends Hook {
+
+ public FabricPlaceholderAPIHook(@NotNull FabricHuskHomes plugin) {
+ super(plugin, "Fabric PlaceholderAPI");
+ }
+
+ @SuppressWarnings("SameParameterValue")
+ @NotNull
+ private Identifier createIdentifier(@NotNull String name) {
+ return new Identifier("huskhomes", name);
+ }
+
+ @Override
+ public void initialize() {
+ Placeholders.register(createIdentifier("player"), (ctx, arg) -> {
+ if (!ctx.hasPlayer()) {
+ return PlaceholderResult.invalid("No player!");
+ }
+
+ if (arg == null) {
+ return PlaceholderResult.invalid("No argument for player!");
+ }
+
+ assert ctx.player() != null;
+ final OnlineUser player = FabricUser.adapt(ctx.player(), (FabricHuskHomes) plugin);
+
+ final String response = switch (arg) {
+ case "homes_count" -> String.valueOf(plugin.getManager().homes()
+ .getUserHomes()
+ .getOrDefault(player.getUsername(), List.of()).size());
+ case "max_homes" -> String.valueOf(plugin.getManager().homes().getMaxHomes(player));
+ case "max_public_homes" -> String.valueOf(plugin.getManager().homes().getMaxPublicHomes(player));
+ case "free_home_slots" -> String.valueOf(plugin.getManager().homes().getFreeHomes(player));
+ case "home_slots" -> String.valueOf(plugin.getSavedUser(player)
+ .map(SavedUser::getHomeSlots).orElse(0));
+ case "homes_list" -> String.join(", ", plugin.getManager().homes()
+ .getUserHomes()
+ .getOrDefault(player.getUsername(), List.of()));
+ case "public_homes_count" -> String.valueOf(plugin.getManager().homes()
+ .getPublicHomes()
+ .getOrDefault(player.getUsername(), List.of()).size());
+ case "public_homes_list" -> String.join(", ", plugin.getManager().homes()
+ .getPublicHomes()
+ .getOrDefault(player.getUsername(), List.of()));
+ case "ignoring_tp_requests" -> String.valueOf(plugin.getManager().requests()
+ .isIgnoringRequests(player));
+ default -> null;
+ };
+
+ if (response == null) {
+ return PlaceholderResult.invalid("Invaild argument for player!");
+ }
+
+ return PlaceholderResult.value(response);
+ });
+ }
}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index df9a5567..d2471c76 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -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