Updates KnarLib and Spigot
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
2025-09-16 17:25:11 +02:00
parent 967791d275
commit 1b1dad4b8b
6 changed files with 12 additions and 14 deletions

View File

@@ -65,7 +65,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.21.5-R0.1-SNAPSHOT</version> <version>1.21.8-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@@ -83,7 +83,7 @@
<dependency> <dependency>
<groupId>net.knarcraft</groupId> <groupId>net.knarcraft</groupId>
<artifactId>knarlib</artifactId> <artifactId>knarlib</artifactId>
<version>1.2.14</version> <version>1.2.18</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -15,10 +15,10 @@ public enum ItemType {
* *
* @return <p>The name of this item type</p> * @return <p>The name of this item type</p>
*/ */
public String getItemTypeName() { public FormatBuilder getItemTypeName() {
return switch (this) { return switch (this) {
case MATERIAL -> new FormatBuilder(Translatable.ITEM_TYPE_MATERIAL).toString(); case MATERIAL -> new FormatBuilder(Translatable.ITEM_TYPE_MATERIAL);
case ENCHANTMENT -> new FormatBuilder(Translatable.ITEM_TYPE_ENCHANTMENT).toString(); case ENCHANTMENT -> new FormatBuilder(Translatable.ITEM_TYPE_ENCHANTMENT);
}; };
} }

View File

@@ -22,8 +22,8 @@ public final class NPCFormatter {
* @param message <p>The message to send</p> * @param message <p>The message to send</p>
*/ */
public static void sendNPCMessage(@NotNull NPC npc, @NotNull Player player, @NotNull String message) { public static void sendNPCMessage(@NotNull NPC npc, @NotNull Player player, @NotNull String message) {
player.sendMessage(new FormatBuilder(Translatable.NPC_TALK_FORMAT).replace("{npc}", new FormatBuilder(Translatable.NPC_TALK_FORMAT).replace("{npc}",
npc.getName()).replace("{message}", message).color().toString()); npc.getName()).replace("{message}", message).displayColored(player);
} }
/** /**

View File

@@ -155,7 +155,7 @@ public enum Translatable implements TranslatableMessage {
*/ */
@NotNull @NotNull
public static FormatBuilder getRawValueMessage(@NotNull String rawValue) { public static FormatBuilder getRawValueMessage(@NotNull String rawValue) {
return new FormatBuilder(Translatable.RAW_VALUE).replace("{rawValue}", rawValue); return new FormatBuilder(Translatable.RAW_VALUE).color().replace("{rawValue}", rawValue);
} }
/** /**

View File

@@ -80,9 +80,8 @@ public class BlacksmithTrait extends CustomTrait<BlacksmithSetting> {
(!reforgeAbleItems.isEmpty() && !reforgeAbleItems.contains(hand.getType())); (!reforgeAbleItems.isEmpty() && !reforgeAbleItems.contains(hand.getType()));
if (notHoldingAnvil && notHoldingRepairable) { if (notHoldingAnvil && notHoldingRepairable) {
String invalidMessage = new FormatBuilder(config.getInvalidItemMessage()).replace("{title}", NPCFormatter.sendNPCMessage(this.npc, player, new FormatBuilder(config.getInvalidItemMessage()).
config.getBlacksmithTitle()).toString(); replace("{title}", config.getBlacksmithTitle()));
NPCFormatter.sendNPCMessage(this.npc, player, invalidMessage);
return; return;
} }

View File

@@ -5,7 +5,6 @@ import net.knarcraft.blacksmith.config.SettingValueType;
import net.knarcraft.blacksmith.config.Settings; import net.knarcraft.blacksmith.config.Settings;
import net.knarcraft.blacksmith.formatting.Translatable; import net.knarcraft.blacksmith.formatting.Translatable;
import net.knarcraft.knarlib.formatting.FormatBuilder; import net.knarcraft.knarlib.formatting.FormatBuilder;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -77,7 +76,7 @@ public final class ConfigCommandHelper {
// Display the current value of the setting // Display the current value of the setting
getCurrentValueMessage(setting.getCommandName(), currentValue).neutral(sender); getCurrentValueMessage(setting.getCommandName(), currentValue).neutral(sender);
if (printRawValue) { if (!currentValue.equals(defaultValue) && printRawValue) {
displayRaw(sender, currentValue); displayRaw(sender, currentValue);
} }
} }
@@ -89,7 +88,7 @@ public final class ConfigCommandHelper {
* @param value <p>The value to display raw</p> * @param value <p>The value to display raw</p>
*/ */
public static void displayRaw(@NotNull CommandSender sender, @NotNull String value) { public static void displayRaw(@NotNull CommandSender sender, @NotNull String value) {
sender.sendMessage(Translatable.getRawValueMessage(value.replace(ChatColor.COLOR_CHAR, '&')).toString()); new FormatBuilder(Translatable.RAW_VALUE).color().replace("{rawValue}", value).displayRaw(sender);
} }
} }