Fixes some warnings, and updates dependencies
All checks were successful
EpicKnarvik97/Blacksmith/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2023-09-23 19:15:11 +02:00
parent 191f548f5a
commit 72ea5600fe
5 changed files with 13 additions and 6 deletions

View File

@ -69,7 +69,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version> <version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -87,7 +87,7 @@
<dependency> <dependency>
<groupId>net.knarcraft</groupId> <groupId>net.knarcraft</groupId>
<artifactId>knarlib</artifactId> <artifactId>knarlib</artifactId>
<version>1.1</version> <version>1.2.3</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -123,7 +123,14 @@ public class BlacksmithPlugin extends JavaPlugin {
translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND); translator.registerMessageCategory(TranslatableTimeUnit.UNIT_SECOND);
translator.registerMessageCategory(BlacksmithTranslatableMessage.ITEM_TYPE_ENCHANTMENT); translator.registerMessageCategory(BlacksmithTranslatableMessage.ITEM_TYPE_ENCHANTMENT);
translator.loadLanguages(this.getDataFolder(), "en", fileConfiguration.getString("language", "en")); 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 //Set up Vault integration
if (!setUpVault()) { if (!setUpVault()) {

View File

@ -56,7 +56,7 @@ public final class TimeFormatter {
String text = BlacksmithPlugin.getTranslator().getTranslatedMessage(BlacksmithTranslatableMessage.valueOf(interval.name())); String text = BlacksmithPlugin.getTranslator().getTranslatedMessage(BlacksmithTranslatableMessage.valueOf(interval.name()));
//Choose a random entry if a comma-separated list is provided //Choose a random entry if a comma-separated list is provided
if (text != null && text.contains(",")) { if (text.contains(",")) {
String[] parts = text.split(","); String[] parts = text.split(",");
String randomPart = parts[new Random().nextInt(parts.length)]; String randomPart = parts[new Random().nextInt(parts.length)];
if (randomPart != null) { if (randomPart != null) {
@ -65,7 +65,7 @@ public final class TimeFormatter {
} }
//Use the set message, or use the default //Use the set message, or use the default
if (text != null && !text.trim().isEmpty()) { if (!text.trim().isEmpty()) {
return text; return text;
} else { } else {
return interval.getDefaultText(); return interval.getDefaultText();

View File

@ -38,7 +38,6 @@ public class PlayerListener implements Listener {
ItemStack usedItem = event.getPlayer().getInventory().getItem(event.getHand()); ItemStack usedItem = event.getPlayer().getInventory().getItem(event.getHand());
if (usedItem != null && isArmor(usedItem)) { if (usedItem != null && isArmor(usedItem)) {
event.setUseItemInHand(Event.Result.DENY); event.setUseItemInHand(Event.Result.DENY);
event.getPlayer().updateInventory();
} }
} }

View File

@ -4,6 +4,7 @@ authors: [ EpicKnarvik97, aPunch, jrbudda, HurricanKai ]
version: '${project.version}' version: '${project.version}'
main: net.knarcraft.blacksmith.BlacksmithPlugin main: net.knarcraft.blacksmith.BlacksmithPlugin
depend: [ Citizens, Vault ] depend: [ Citizens, Vault ]
prefix: "Blacksmith"
api-version: 1.19 api-version: 1.19