Fixes merge problems
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2025-09-06 15:16:00 +02:00
parent bb46967892
commit 967791d275
9 changed files with 23 additions and 18 deletions

View File

@@ -1,9 +1,9 @@
package net.knarcraft.blacksmith.util;
import net.knarcraft.blacksmith.BlacksmithPlugin;
import net.knarcraft.blacksmith.container.ActionCost;
import net.knarcraft.blacksmith.formatting.BlacksmithTranslatableMessage;
import net.knarcraft.blacksmith.formatting.Translatable;
import net.knarcraft.blacksmith.property.CostType;
import net.knarcraft.knarlib.formatting.FormatBuilder;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -28,9 +28,9 @@ public final class CostHelper {
private static List<String> plugins;
private static Map<String, List<String>> permissions;
private CostHelper() {
}
/**
@@ -42,7 +42,7 @@ public final class CostHelper {
* @throws IllegalArgumentException <p>If the specified cost is invalid</p>
*/
public static double parseSimpleCost(@NotNull CommandSender commandSender,
@NotNull String costString) throws IllegalArgumentException {
@NotNull String costString) throws IllegalArgumentException {
try {
double cost = Double.parseDouble(costString);
if (cost < 0) {
@@ -50,15 +50,14 @@ public final class CostHelper {
}
return cost;
} catch (NumberFormatException exception) {
BlacksmithPlugin.getStringFormatter().displayErrorMessage(commandSender,
BlacksmithTranslatableMessage.DOUBLE_COST_REQUIRED);
new FormatBuilder(Translatable.DOUBLE_COST_REQUIRED).error(commandSender);
throw new IllegalArgumentException("Invalid cost given");
}
}
/**
* Shows tab-completion actions for altering a cost
*
*
* @param arguments <p>The arguments given by the user</p>
* @return <p>The available tab-complete options</p>
*/
@@ -106,7 +105,7 @@ public final class CostHelper {
*/
@Nullable
public static ActionCost modifyActionCost(@NotNull String[] arguments, @NotNull ActionCost oldCost,
@NotNull Player player) {
@NotNull Player player) {
CostType costType;
if (arguments.length > 2) {
costType = CostType.parse(arguments[2]);
@@ -156,7 +155,7 @@ public final class CostHelper {
*/
@Nullable
private static ActionCost parseCost(@NotNull CostType costType, @NotNull String[] arguments, @NotNull ActionCost oldCost,
@NotNull Player player) {
@NotNull Player player) {
switch (costType) {
case ECONOMY:
double economyCost = Double.parseDouble(arguments[0]);