From d8aabeee88dc55c6deb30412655a313f492a8d19 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Fri, 23 Jun 2023 20:34:20 +0200 Subject: [PATCH] Updates for 1.20 Makes sure to unregister and refund on the sign edit event, as the sign might be registered as a paid sign already. Updates Spigot Updates Vault repository --- pom.xml | 10 +++++----- src/main/java/net/knarcraft/paidsigns/PaidSigns.java | 4 ++-- .../net/knarcraft/paidsigns/listener/SignListener.java | 8 ++++++++ src/main/resources/plugin.yml | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 5de09e5..42a37e3 100644 --- a/pom.xml +++ b/pom.xml @@ -82,8 +82,8 @@ https://oss.sonatype.org/content/groups/public/ - vault-repo - https://nexus.hc.to/content/repositories/pub_releases + jitpack.io + https://jitpack.io @@ -101,11 +101,11 @@ org.spigotmc spigot-api - 1.19.2-R0.1-SNAPSHOT + 1.20.1-R0.1-SNAPSHOT provided - net.milkbowl.vault + com.github.MilkBowl VaultAPI 1.7 provided @@ -113,7 +113,7 @@ org.jetbrains annotations - 23.0.0 + 24.0.1 provided diff --git a/src/main/java/net/knarcraft/paidsigns/PaidSigns.java b/src/main/java/net/knarcraft/paidsigns/PaidSigns.java index 514bca2..c367b7b 100644 --- a/src/main/java/net/knarcraft/paidsigns/PaidSigns.java +++ b/src/main/java/net/knarcraft/paidsigns/PaidSigns.java @@ -92,7 +92,7 @@ public final class PaidSigns extends JavaPlugin { //Initialize translator translator = new Translator(); translator.registerMessageCategory(PaidSignsTranslatableMessage.BOOLEAN_TRUE); - translator.loadLanguages(this.getDataFolder(), language); + translator.loadLanguages(this.getDataFolder(), "en", language); stringFormatter = new StringFormatter(this.getDescription().getPrefix(), translator); signManager = new PaidSignManager(PaidSignManager.loadSigns()); @@ -118,7 +118,7 @@ public final class PaidSigns extends JavaPlugin { public void reload() { this.reloadConfig(); loadConfig(); - translator.loadLanguages(this.getDataFolder(), language); + translator.loadLanguages(this.getDataFolder(), "en", language); signManager = new PaidSignManager(PaidSignManager.loadSigns()); TrackedSignManager.loadTrackedSigns(); } diff --git a/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java b/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java index e498e06..5c5ef34 100644 --- a/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java +++ b/src/main/java/net/knarcraft/paidsigns/listener/SignListener.java @@ -36,6 +36,14 @@ public class SignListener implements Listener { return; } + // As signs can be edited now, this event might be triggered on an already registered sign, so unregister + if (SignHelper.isSign(event.getBlock())) { + try { + TrackedSignManager.removeTrackedSign(event.getBlock().getLocation(), true, false); + } catch (IOException ignored) { + } + } + String[] lines = event.getLines(); Map allPaidSigns = PaidSigns.getInstance().getSignManager().getAllPaidSigns(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 08fe730..bfdfa9b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: PaidSigns version: '${project.version}' main: net.knarcraft.paidsigns.PaidSigns -api-version: 1.19 +api-version: '1.19' prefix: PaidSigns depend: [ Vault ] authors: [ EpicKnarvik97 ]