Fixes colored NPC names, and cleans up a bit
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2024-12-15 14:20:03 +01:00
parent b01ccfc537
commit 7e17122bb2
10 changed files with 24 additions and 41 deletions

View File

@ -2,7 +2,6 @@ package net.knarcraft.blacksmith.command;
import net.knarcraft.blacksmith.BlacksmithPlugin; import net.knarcraft.blacksmith.BlacksmithPlugin;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -7,7 +7,6 @@ import net.knarcraft.blacksmith.util.ConfigHelper;
import net.knarcraft.blacksmith.util.ItemHelper; import net.knarcraft.blacksmith.util.ItemHelper;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View File

@ -494,16 +494,6 @@ public class ScrapperNPCSettings implements TraitSettings<ScrapperSetting> {
return asString(ScrapperSetting.CANNOT_SALVAGE_ENCHANTED_BOOK_MESSAGE); return asString(ScrapperSetting.CANNOT_SALVAGE_ENCHANTED_BOOK_MESSAGE);
} }
/**
* Gets the message to display when explaining that the scrapper needs to be provided more items for enchanted book salvage
*
* @return <p>The message to display when explaining that the scrapper needs to be provided more items for enchanted book salvage</p>
*/
@NotNull
public String getNotEnoughItemsMessage() {
return asString(ScrapperSetting.NOT_ENOUGH_ITEMS_MESSAGE);
}
/** /**
* Gets the message to display when explaining that the scrapper cannot salvage an enchanted book with a single enchantment * Gets the message to display when explaining that the scrapper cannot salvage an enchanted book with a single enchantment
* *

View File

@ -256,13 +256,6 @@ public enum ScrapperSetting implements Setting {
"&cI'm sorry, but I'm unable to salvage enchanted books!", "&cI'm sorry, but I'm unable to salvage enchanted books!",
"The message to display when asked to salvage enchanted books, and the option is disabled", true, true), "The message to display when asked to salvage enchanted books, and the option is disabled", true, true),
/**
* The message displayed when explaining that a player needs to provide items to salvage an enchanted book
*/
NOT_ENOUGH_ITEMS_MESSAGE("notEnoughItemsMessage", SettingValueType.STRING,
"&cI'm sorry, but you need to provide enough items for salvaging the enchanted book",
"The message displayed when a player attempts to salvage an enchanted book without providing enough items", true, true),
/** /**
* The message displayed when explaining that a player cannot salvage an enchanted book containing a single enchantment * The message displayed when explaining that a player cannot salvage an enchanted book containing a single enchantment
*/ */

View File

@ -11,7 +11,11 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/** /**
* The cost of performing an action * The cost of performing an action

View File

@ -27,7 +27,8 @@ public final class BlacksmithStringFormatter {
public static void sendNPCMessage(NPC npc, Player player, String message) { public static void sendNPCMessage(NPC npc, Player player, String message) {
player.sendMessage(BlacksmithPlugin.getStringFormatter().replacePlaceholders( player.sendMessage(BlacksmithPlugin.getStringFormatter().replacePlaceholders(
BlacksmithTranslatableMessage.NPC_TALK_FORMAT, List.of("{npc}", "{message}"), BlacksmithTranslatableMessage.NPC_TALK_FORMAT, List.of("{npc}", "{message}"),
List.of(npc.getName(), ColorHelper.translateColorCodes(message, ColorConversion.RGB)))); List.of(ColorHelper.translateColorCodes(npc.getRawName(), ColorConversion.RGB),
ColorHelper.translateColorCodes(message, ColorConversion.RGB))));
} }
} }

View File

@ -265,9 +265,6 @@ scrapper:
# The message displayed when explaining that enchanted book salvage is disabled # The message displayed when explaining that enchanted book salvage is disabled
cannotSalvageEnchantedBookMessage: "&cI'm sorry, but I'm unable to salvage enchanted books!" cannotSalvageEnchantedBookMessage: "&cI'm sorry, but I'm unable to salvage enchanted books!"
# The message displayed when a player attempts to salvage an enchanted book without providing enough normal books
notEnoughItemsMessage: "&cI'm sorry, but you need to provide {number} {item} to salvage the enchanted book"
# The message displayed when a player attempts to salvage an enchanted book with a single enchantment # The message displayed when a player attempts to salvage an enchanted book with a single enchantment
cannotSplitEnchantedBookFurtherMessage: "&cI'm sorry, but I cannot salvage that enchanted book any further" cannotSplitEnchantedBookFurtherMessage: "&cI'm sorry, but I cannot salvage that enchanted book any further"

View File

@ -43,7 +43,7 @@ en:
# The format used when displaying any duration remaining # The format used when displaying any duration remaining
DURATION_FORMAT: "in {time} {unit}" DURATION_FORMAT: "in {time} {unit}"
# The format used when NPCs talk to players ({npc} = The NPC's name, {message} is the actual message contents) # The format used when NPCs talk to players ({npc} = The NPC's name, {message} is the actual message contents)
NPC_TALK_FORMAT: "&a[{npc}] -> You:&r {message}" NPC_TALK_FORMAT: "&a[{npc}&r&a] -> You:&r {message}"
# Translation of the duration of less than a second # Translation of the duration of less than a second
UNIT_NOW: "imminently" UNIT_NOW: "imminently"
# Translation of seconds in singular form # Translation of seconds in singular form