From 9c217926696674b9f9b31ffc593b0faf4551265f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Poirier?= <97362850+matipoirierg@users.noreply.github.com> Date: Mon, 10 Jun 2024 10:39:11 -0400 Subject: [PATCH] Update RTP_HuskTowns.java (#218) --- .../depends/regionPlugins/RTP_HuskTowns.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/references/depends/regionPlugins/RTP_HuskTowns.java b/src/main/java/me/SuperRonanCraft/BetterRTP/references/depends/regionPlugins/RTP_HuskTowns.java index a9560e3..16b067f 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/depends/regionPlugins/RTP_HuskTowns.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/depends/regionPlugins/RTP_HuskTowns.java @@ -1,21 +1,27 @@ package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins; -import net.william278.husktowns.api.HuskTownsAPI; +import net.william278.husktowns.api.BukkitHuskTownsAPI; import org.bukkit.Location; +import org.bukkit.plugin.java.JavaPlugin; public class RTP_HuskTowns implements RegionPluginCheck { - // NOT TESTED (3.4.5) - // HuskTowns (v1.8.1) - // https://www.spigotmc.org/resources/husktowns.92672/ + private final BukkitHuskTownsAPI huskTownsAPI; + + public RTP_HuskTowns(JavaPlugin plugin) { + this.huskTownsAPI = BukkitHuskTownsAPI.getInstance(); + } + + @Override public boolean check(Location loc) { boolean result = true; - if (REGIONPLUGINS.HUSKTOWNS.isEnabled()) + if (REGIONPLUGINS.HUSKTOWNS.isEnabled()) { try { - result = !HuskTownsAPI.getInstance().getClaimAt(loc).isPresent(); + result = !huskTownsAPI.getClaimAt(loc).isPresent(); } catch (Exception e) { e.printStackTrace(); } + } return result; } }