diff --git a/LocalJars/hClaims.jar b/LocalJars/hClaims.jar new file mode 100644 index 0000000..5ed51d8 Binary files /dev/null and b/LocalJars/hClaims.jar differ diff --git a/pom.xml b/pom.xml index c22cb9b..9ad2a63 100644 --- a/pom.xml +++ b/pom.xml @@ -37,6 +37,22 @@ install-file + + hack-binary-2 + clean + + ${basedir}/LocalJars/hClaims.jar + default + com.hakan + claimsystem + 1.1.1 + jar + true + + + install-file + + @@ -225,6 +241,13 @@ + + + com.hakan + claimapi + LATEST + provided + xyz.xenondevs diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPluginValidation.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPluginValidation.java index 7b8769e..76d4b60 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPluginValidation.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPluginValidation.java @@ -3,6 +3,7 @@ package me.SuperRonanCraft.BetterRTP.player.rtp; import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect; import com.bekvon.bukkit.residence.Residence; import com.bekvon.bukkit.residence.commands.set; +import com.hakan.claimsystem.api.ClaimAPI; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; @@ -29,6 +30,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende boolean plugin_lands = getLands(loc); boolean plugin_residence = getResidence(loc); boolean plugin_kingdomsx = getKingdomsx(loc); + boolean plugin_claims_pandomim = getClaimAPIPandomim(loc); return plugin_worldguard && plugin_griefPrevention && plugin_towny @@ -36,7 +38,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende && plugin_factionsUUID && plugin_lands && plugin_residence - && plugin_kingdomsx; + && plugin_kingdomsx + && plugin_claims_pandomim; } // TESTED (v2.12.3) @@ -159,6 +162,20 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } + // NOT TESTED (3.0.5) + // hClaims (v1.1.1) + // https://github.com/pixelnw/claimapi (Local Repo) + private boolean getClaimAPIPandomim(Location loc) { + boolean result = true; + if (getPl().getSettings().getsDepends().isClaimAPIPandomim()) + try { + result = ClaimAPI.isClaimed(loc); + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + private BetterRTP getPl() { return BetterRTP.getInstance(); } diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java b/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java index 435b54e..fd7fc3f 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java @@ -16,6 +16,7 @@ public class SoftDepends { private boolean respect_lands = false; private boolean respect_residence = false; private boolean respect_kingdomsx = false; + private boolean respect_claimAPIPandomim = false; //RETURNABLES private boolean worldguard = false; private boolean griefprevention = false; @@ -25,6 +26,7 @@ public class SoftDepends { private boolean lands = false; private boolean residence = false; private boolean kingdomsx = false; + private boolean claimAPIPandomim = false; public boolean isWorldguard() { return worldguard; @@ -58,17 +60,22 @@ public class SoftDepends { return kingdomsx; } + public boolean isClaimAPIPandomim() { + return claimAPIPandomim; + } + void load() { FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG); String pre = "Settings.Respect."; - respect_worldguard = config.getBoolean( pre + "WorldGuard"); - respect_griefprevention = config.getBoolean(pre + "GriefPrevention"); - respect_towny = config.getBoolean( pre + "Towny"); - respect_redProtect = config.getBoolean( pre + "RedProtect"); - respect_factionsUUID = config.getBoolean( pre + "FactionsUUID"); - respect_lands = config.getBoolean( pre + "Lands"); - respect_residence = config.getBoolean( pre + "Residence"); - respect_kingdomsx = config.getBoolean( pre + "KingdomsX"); + respect_worldguard = config.getBoolean( pre + "WorldGuard"); + respect_griefprevention = config.getBoolean( pre + "GriefPrevention"); + respect_towny = config.getBoolean( pre + "Towny"); + respect_redProtect = config.getBoolean( pre + "RedProtect"); + respect_factionsUUID = config.getBoolean( pre + "FactionsUUID"); + respect_lands = config.getBoolean( pre + "Lands"); + respect_residence = config.getBoolean( pre + "Residence"); + respect_kingdomsx = config.getBoolean( pre + "KingdomsX"); + respect_claimAPIPandomim = config.getBoolean( pre + "hClaims"); registerWorldguard(); registerGriefPrevention(); registerTowny(); @@ -77,6 +84,7 @@ public class SoftDepends { registerLands(); registerResidence(); registerKingdomsX(); + registerClaimAPIPandomim(); } public void registerWorldguard() { @@ -127,6 +135,12 @@ public class SoftDepends { debug("Respecting `KingdomsX` was " + (kingdomsx ? "SUCCESSFULLY" : "NOT") + " registered"); } + public void registerClaimAPIPandomim() { + claimAPIPandomim = respect_claimAPIPandomim && Bukkit.getPluginManager().isPluginEnabled("hClaim"); + if (respect_claimAPIPandomim) + debug("Respecting `hClaims` was " + (claimAPIPandomim ? "SUCCESSFULLY" : "NOT") + " registered"); + } + private void debug(String str) { if (BetterRTP.getInstance().getSettings().debug) BetterRTP.getInstance().getLogger().log(Level.INFO, str); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 573482d..55d4bac 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -21,6 +21,8 @@ Settings: Residence: false ## Respect KingdomsX areas (https://www.spigotmc.org/resources/kingdomsx.77670/) KingdomsX: false + ## Respect hClaims areas (https://github.com/pixelnw/claimapi) + hClaims: false ## Output to console some debugging info Debugger: false ## Amount of chunks to preload around a safe location diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ad3bcaf..ebcde32 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -13,11 +13,12 @@ softdepend: - Residence - ProtocolLib - Kingdoms + - hClaims api-version: '1.13' commands: betterrtp: - aliases: [brtp, rtp] + aliases: [brtp, rtp, randomtp] description: Randomly teleport to a location permissions: