Fixes merge problems
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good
This commit is contained in:
@@ -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;
|
||||||
|
@@ -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);
|
||||||
|
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ public record ActionCost(double monetaryCost, int expCost, @Nullable ItemStack i
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays this action cost as a string
|
* Displays this action cost as a string
|
||||||
*
|
*
|
||||||
* @param player <p>The player to calculate the cost for</p>
|
* @param player <p>The player to calculate the cost for</p>
|
||||||
* @return <p>The string representation of this action cost</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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
output.put(entry.getKey(), (Integer) entry.getValue().getAmount());
|
output.put(entry.getKey(), entry.getValue().getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
@@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
@@ -28,9 +28,9 @@ public final class CostHelper {
|
|||||||
|
|
||||||
private static List<String> plugins;
|
private static List<String> plugins;
|
||||||
private static Map<String, List<String>> permissions;
|
private static Map<String, List<String>> permissions;
|
||||||
|
|
||||||
private CostHelper() {
|
private CostHelper() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -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,15 +50,14 @@ 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows tab-completion actions for altering a cost
|
* Shows tab-completion actions for altering a cost
|
||||||
*
|
*
|
||||||
* @param arguments <p>The arguments given by the user</p>
|
* @param arguments <p>The arguments given by the user</p>
|
||||||
* @return <p>The available tab-complete options</p>
|
* @return <p>The available tab-complete options</p>
|
||||||
*/
|
*/
|
||||||
@@ -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]);
|
||||||
|
@@ -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) {
|
||||||
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user