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

@@ -30,10 +30,6 @@ import net.knarcraft.knarlib.plugin.ConfigCommentPlugin;
import net.knarcraft.knarlib.util.ConfigHelper;
import net.knarcraft.knarlib.util.UpdateChecker;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
import org.bukkit.command.TabCompleter;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile;

View File

@@ -157,6 +157,8 @@ public class BlackSmithConfigCommand implements CommandExecutor {
return false;
}
ItemType itemType = ItemType.ENCHANTMENT;
// Note: While depreciated in Spigot, the new method is not available for Paper
@SuppressWarnings("deprecation")
String itemChanged = enchantment.getKey().getKey();
settings.setEnchantmentCost(enchantment, newPrice);
Translatable.getItemValueChangedMessage(blacksmithSetting.getCommandName(), itemType, itemChanged, newValue).success(sender);

View File

@@ -523,6 +523,8 @@ public class GlobalBlacksmithSettings implements Settings<BlacksmithSetting> {
//Load all enchantment prices
ConfigurationSection enchantmentCostNode = getAndCreateSection(fileConfiguration, getBase(BlacksmithSetting.ENCHANTMENT_COST.getPath()));
for (Enchantment enchantment : this.enchantmentCosts.keySet()) {
// Note: While depreciated in Spigot, the new method is not available for Paper
//noinspection deprecation
enchantmentCostNode.set(unNormalizeName(enchantment.getKey().getKey()), this.enchantmentCosts.get(enchantment));
}

View File

@@ -72,7 +72,7 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
/**
* Displays this action cost as a string
*
*
* @param player <p>The player to calculate the cost for</p>
* @return <p>The string representation of this action cost</p>
*/
@@ -196,7 +196,7 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
continue;
}
}
output.put(entry.getKey(), (Integer) entry.getValue().getAmount());
output.put(entry.getKey(), entry.getValue().getAmount());
}
return output;

View File

@@ -59,6 +59,8 @@ public class ReforgeSession extends Session implements Runnable {
enchantments = new ArrayList<>();
for (Enchantment enchantment : enchantmentRegistry) {
// Note: While depreciated in Spigot, the new method is not available for Paper
//noinspection deprecation
enchantments.add(enchantment.getKey().getKey());
}
}

View File

@@ -215,12 +215,12 @@ public class ScrapperTrait extends CustomTrait<ScrapperSetting> {
}
if (!getSettings().splitEnchantedBook()) {
sendNPCMessage(this.npc, player, getSettings().getCannotSalvageEnchantedBookMessage());
NPCFormatter.sendNPCMessage(this.npc, player, getSettings().getCannotSalvageEnchantedBookMessage());
return new SalvageResult(SalvageMethod.ENCHANTED_BOOK, new ArrayList<>(), SalvageState.NO_SALVAGE, 0);
}
if (SalvageHelper.getEnchantmentCount(itemInHand) <= 1) {
sendNPCMessage(this.npc, player, getSettings().getCannotSplitEnchantedBookFurtherMessage());
NPCFormatter.sendNPCMessage(this.npc, player, getSettings().getCannotSplitEnchantedBookFurtherMessage());
return new SalvageResult(SalvageMethod.ENCHANTED_BOOK, new ArrayList<>(), SalvageState.NO_SALVAGE, 0);
}

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]);

View File

@@ -136,6 +136,8 @@ public final class SalvageHelper {
} else {
return null;
}
// Note: While depreciated in Spigot, the new method is not available for Paper
@SuppressWarnings("deprecation")
Material patternMaterial = Material.matchMaterial(armorTrim.getPattern().getKey().getKey() +
"_ARMOR_TRIM_SMITHING_TEMPLATE");
if (patternMaterial != null) {

View File

@@ -79,6 +79,8 @@ public final class TabCompleteValuesHelper {
List<String> enchantments = new ArrayList<>();
for (Enchantment enchantment : enchantmentRegistry) {
// Note: While depreciated in Spigot, the new method is not available for Paper
//noinspection deprecation
enchantments.add(enchantment.getKey().getKey());
}
return enchantments;