From 36b5b9a847e2b1d9a2b0fd6ec86c3dc05d762326 Mon Sep 17 00:00:00 2001 From: ewof Date: Fri, 26 Apr 2024 17:56:21 -0400 Subject: [PATCH] fixes and bump version number --- build.gradle.kts | 2 +- .../townywaypoints/commands/TownyWaypointsCommand.java | 8 ++++---- .../townywaypoints/settings/TownyWaypointsSettings.java | 8 ++++---- src/main/resources/paper-plugin.yml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f97a9a9..adc844b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "net.mvndicraft.townywaypoints" -version = "1.2-SNAPSHOT" +version = "1.3-SNAPSHOT" repositories { mavenCentral() diff --git a/src/main/java/net/mvndicraft/townywaypoints/commands/TownyWaypointsCommand.java b/src/main/java/net/mvndicraft/townywaypoints/commands/TownyWaypointsCommand.java index c60fc9c..f5576e5 100644 --- a/src/main/java/net/mvndicraft/townywaypoints/commands/TownyWaypointsCommand.java +++ b/src/main/java/net/mvndicraft/townywaypoints/commands/TownyWaypointsCommand.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import com.palmergames.bukkit.towny.TownyAPI; -import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.TownBlock; @@ -167,13 +166,14 @@ public static void onTravel(Player player, String townName, String waypointName, Messaging.sendMsg(player, Translatable.of("msg_waypoint_travel_warmup_cost", travelcost)); teleport(player, loc, waypoint.travelWithVehicle()); - double splitCost = travelcost * TownyWaypointsSettings.getSplit(); + double splitCostNation = travelcost * (1.0 - TownyWaypointsSettings.getSplit()); + double splitCostTown = travelcost * TownyWaypointsSettings.getSplit(); - town.getAccount().deposit(town.hasNation() ? splitCost : travelcost, + town.getAccount().deposit(town.hasNation() ? splitCostTown : travelcost, Translatable.of("msg_deposit_reason").toString()); if (town.hasNation()) - town.getNationOrNull().getAccount().deposit(splitCost, + town.getNationOrNull().getAccount().deposit(splitCostNation, Translatable.of("msg_deposit_reason").toString()); if (!CooldownTimerTask.hasCooldown(player.getName(), "waypoint")) diff --git a/src/main/java/net/mvndicraft/townywaypoints/settings/TownyWaypointsSettings.java b/src/main/java/net/mvndicraft/townywaypoints/settings/TownyWaypointsSettings.java index 0c83c20..f9daf1e 100644 --- a/src/main/java/net/mvndicraft/townywaypoints/settings/TownyWaypointsSettings.java +++ b/src/main/java/net/mvndicraft/townywaypoints/settings/TownyWaypointsSettings.java @@ -1,6 +1,10 @@ package net.mvndicraft.townywaypoints.settings; public class TownyWaypointsSettings { + public static double getSplit() { + return Settings.getDouble(ConfigNodes.WAYPOINTS_ECONOMY_SPLIT); + } + public static int getMaxDistance() { return Settings.getInt(ConfigNodes.WAYPOINTS_RESTRICTIONS_MAX_DISTANCE); } @@ -12,8 +16,4 @@ public static int getCooldown() { public static boolean getPeerToPeer() { return Settings.getBoolean(ConfigNodes.WAYPOINTS_RESTRICTIONS_PEER_TO_PEER); } - - public static double getSplit() { - return Settings.getDouble(ConfigNodes.WAYPOINTS_ECONOMY_SPLIT); - } } diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml index aa8c569..5a677fe 100644 --- a/src/main/resources/paper-plugin.yml +++ b/src/main/resources/paper-plugin.yml @@ -1,5 +1,5 @@ name: TownyWaypoints -version: '1.2' +version: '1.3' main: net.mvndicraft.townywaypoints.TownyWaypoints description: Configurable Waypoints as Towny plots api-version: '1.20'