From 72ea5600fe3a23cff77e08221224c51d3b7decf8 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 23 Sep 2023 19:15:11 +0200 Subject: [PATCH] Fixes some warnings, and updates dependencies --- pom.xml | 4 ++-- .../java/net/knarcraft/blacksmith/BlacksmithPlugin.java | 9 ++++++++- .../knarcraft/blacksmith/formatting/TimeFormatter.java | 4 ++-- .../knarcraft/blacksmith/listener/PlayerListener.java | 1 - src/main/resources/plugin.yml | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index dbc6712..89bec74 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ org.spigotmc spigot-api - 1.19.4-R0.1-SNAPSHOT + 1.20.1-R0.1-SNAPSHOT provided @@ -87,7 +87,7 @@ net.knarcraft knarlib - 1.1 + 1.2.3 compile diff --git a/src/main/java/net/knarcraft/blacksmith/BlacksmithPlugin.java b/src/main/java/net/knarcraft/blacksmith/BlacksmithPlugin.java index 1f50ca5..66a5951 100644 --- a/src/main/java/net/knarcraft/blacksmith/BlacksmithPlugin.java +++ b/src/main/java/net/knarcraft/blacksmith/BlacksmithPlugin.java @@ -123,7 +123,14 @@ public class BlacksmithPlugin extends JavaPlugin { translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND); translator.registerMessageCategory(BlacksmithTranslatableMessage.ITEM_TYPE_ENCHANTMENT); translator.loadLanguages(this.getDataFolder(), "en", fileConfiguration.getString("language", "en")); - BlacksmithPlugin.stringFormatter = new StringFormatter(this.getDescription().getPrefix(), translator); + PluginDescriptionFile description = this.getDescription(); + String prefix; + if (description.getPrefix() == null) { + prefix = "Blacksmith"; + } else { + prefix = description.getPrefix(); + } + BlacksmithPlugin.stringFormatter = new StringFormatter(prefix, translator); //Set up Vault integration if (!setUpVault()) { diff --git a/src/main/java/net/knarcraft/blacksmith/formatting/TimeFormatter.java b/src/main/java/net/knarcraft/blacksmith/formatting/TimeFormatter.java index ddea841..4936ead 100644 --- a/src/main/java/net/knarcraft/blacksmith/formatting/TimeFormatter.java +++ b/src/main/java/net/knarcraft/blacksmith/formatting/TimeFormatter.java @@ -56,7 +56,7 @@ public final class TimeFormatter { String text = BlacksmithPlugin.getTranslator().getTranslatedMessage(BlacksmithTranslatableMessage.valueOf(interval.name())); //Choose a random entry if a comma-separated list is provided - if (text != null && text.contains(",")) { + if (text.contains(",")) { String[] parts = text.split(","); String randomPart = parts[new Random().nextInt(parts.length)]; if (randomPart != null) { @@ -65,7 +65,7 @@ public final class TimeFormatter { } //Use the set message, or use the default - if (text != null && !text.trim().isEmpty()) { + if (!text.trim().isEmpty()) { return text; } else { return interval.getDefaultText(); diff --git a/src/main/java/net/knarcraft/blacksmith/listener/PlayerListener.java b/src/main/java/net/knarcraft/blacksmith/listener/PlayerListener.java index bfc300e..2bfcf50 100644 --- a/src/main/java/net/knarcraft/blacksmith/listener/PlayerListener.java +++ b/src/main/java/net/knarcraft/blacksmith/listener/PlayerListener.java @@ -38,7 +38,6 @@ public class PlayerListener implements Listener { ItemStack usedItem = event.getPlayer().getInventory().getItem(event.getHand()); if (usedItem != null && isArmor(usedItem)) { event.setUseItemInHand(Event.Result.DENY); - event.getPlayer().updateInventory(); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 9e24995..b17d3d9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -4,6 +4,7 @@ authors: [ EpicKnarvik97, aPunch, jrbudda, HurricanKai ] version: '${project.version}' main: net.knarcraft.blacksmith.BlacksmithPlugin depend: [ Citizens, Vault ] +prefix: "Blacksmith" api-version: 1.19