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.ConfigHelper;
import net.knarcraft.knarlib.util.UpdateChecker; import net.knarcraft.knarlib.util.UpdateChecker;
import org.bukkit.Bukkit; 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.configuration.file.FileConfiguration;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;

View File

@@ -157,6 +157,8 @@ public class BlackSmithConfigCommand implements CommandExecutor {
return false; return false;
} }
ItemType itemType = ItemType.ENCHANTMENT; ItemType itemType = ItemType.ENCHANTMENT;
// Note: While depreciated in Spigot, the new method is not available for Paper
@SuppressWarnings("deprecation")
String itemChanged = enchantment.getKey().getKey(); String itemChanged = enchantment.getKey().getKey();
settings.setEnchantmentCost(enchantment, newPrice); settings.setEnchantmentCost(enchantment, newPrice);
Translatable.getItemValueChangedMessage(blacksmithSetting.getCommandName(), itemType, itemChanged, newValue).success(sender); 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 //Load all enchantment prices
ConfigurationSection enchantmentCostNode = getAndCreateSection(fileConfiguration, getBase(BlacksmithSetting.ENCHANTMENT_COST.getPath())); ConfigurationSection enchantmentCostNode = getAndCreateSection(fileConfiguration, getBase(BlacksmithSetting.ENCHANTMENT_COST.getPath()));
for (Enchantment enchantment : this.enchantmentCosts.keySet()) { 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)); enchantmentCostNode.set(unNormalizeName(enchantment.getKey().getKey()), this.enchantmentCosts.get(enchantment));
} }

View File

@@ -196,7 +196,7 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
continue; continue;
} }
} }
output.put(entry.getKey(), (Integer) entry.getValue().getAmount()); output.put(entry.getKey(), entry.getValue().getAmount());
} }
return output; return output;

View File

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

View File

@@ -215,12 +215,12 @@ public class ScrapperTrait extends CustomTrait<ScrapperSetting> {
} }
if (!getSettings().splitEnchantedBook()) { 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); return new SalvageResult(SalvageMethod.ENCHANTED_BOOK, new ArrayList<>(), SalvageState.NO_SALVAGE, 0);
} }
if (SalvageHelper.getEnchantmentCount(itemInHand) <= 1) { 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); return new SalvageResult(SalvageMethod.ENCHANTED_BOOK, new ArrayList<>(), SalvageState.NO_SALVAGE, 0);
} }

View File

@@ -1,9 +1,9 @@
package net.knarcraft.blacksmith.util; package net.knarcraft.blacksmith.util;
import net.knarcraft.blacksmith.BlacksmithPlugin;
import net.knarcraft.blacksmith.container.ActionCost; 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.blacksmith.property.CostType;
import net.knarcraft.knarlib.formatting.FormatBuilder;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -42,7 +42,7 @@ public final class CostHelper {
* @throws IllegalArgumentException <p>If the specified cost is invalid</p> * @throws IllegalArgumentException <p>If the specified cost is invalid</p>
*/ */
public static double parseSimpleCost(@NotNull CommandSender commandSender, public static double parseSimpleCost(@NotNull CommandSender commandSender,
@NotNull String costString) throws IllegalArgumentException { @NotNull String costString) throws IllegalArgumentException {
try { try {
double cost = Double.parseDouble(costString); double cost = Double.parseDouble(costString);
if (cost < 0) { if (cost < 0) {
@@ -50,8 +50,7 @@ public final class CostHelper {
} }
return cost; return cost;
} catch (NumberFormatException exception) { } catch (NumberFormatException exception) {
BlacksmithPlugin.getStringFormatter().displayErrorMessage(commandSender, new FormatBuilder(Translatable.DOUBLE_COST_REQUIRED).error(commandSender);
BlacksmithTranslatableMessage.DOUBLE_COST_REQUIRED);
throw new IllegalArgumentException("Invalid cost given"); throw new IllegalArgumentException("Invalid cost given");
} }
} }
@@ -106,7 +105,7 @@ public final class CostHelper {
*/ */
@Nullable @Nullable
public static ActionCost modifyActionCost(@NotNull String[] arguments, @NotNull ActionCost oldCost, public static ActionCost modifyActionCost(@NotNull String[] arguments, @NotNull ActionCost oldCost,
@NotNull Player player) { @NotNull Player player) {
CostType costType; CostType costType;
if (arguments.length > 2) { if (arguments.length > 2) {
costType = CostType.parse(arguments[2]); costType = CostType.parse(arguments[2]);
@@ -156,7 +155,7 @@ public final class CostHelper {
*/ */
@Nullable @Nullable
private static ActionCost parseCost(@NotNull CostType costType, @NotNull String[] arguments, @NotNull ActionCost oldCost, private static ActionCost parseCost(@NotNull CostType costType, @NotNull String[] arguments, @NotNull ActionCost oldCost,
@NotNull Player player) { @NotNull Player player) {
switch (costType) { switch (costType) {
case ECONOMY: case ECONOMY:
double economyCost = Double.parseDouble(arguments[0]); double economyCost = Double.parseDouble(arguments[0]);

View File

@@ -136,6 +136,8 @@ public final class SalvageHelper {
} else { } else {
return null; 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() + Material patternMaterial = Material.matchMaterial(armorTrim.getPattern().getKey().getKey() +
"_ARMOR_TRIM_SMITHING_TEMPLATE"); "_ARMOR_TRIM_SMITHING_TEMPLATE");
if (patternMaterial != null) { if (patternMaterial != null) {

View File

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