diff --git a/LocalJars/Residence4.9.1.9.jar b/LocalJars/Residence4.9.1.9.jar new file mode 100644 index 0000000..edd1872 Binary files /dev/null and b/LocalJars/Residence4.9.1.9.jar differ diff --git a/pom.xml b/pom.xml index e43e69a..5732440 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.SuperRonanCraft BetterRTP - 2.14.2 + 2.14.3 1.8 @@ -86,11 +86,6 @@ factions-uuid http://ci.ender.zone/plugin/repository/everything/ - @@ -168,5 +163,20 @@ 1.6.9.5-U0.5.16 provided + + + com.github.angeschossen + LandsAPI + 4.9.4 + provided + + + + com.zrips + residence + 4.9.1.9 + system + ${project.basedir}/LocalJars/Residence4.9.1.9.jar + \ No newline at end of file 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 244bc84..2f4eba2 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPluginValidation.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPluginValidation.java @@ -1,6 +1,7 @@ package me.SuperRonanCraft.BetterRTP.player.rtp; import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect; +import com.bekvon.bukkit.residence.Residence; import com.massivecraft.factions.Board; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; @@ -11,22 +12,31 @@ import com.sk89q.worldguard.protection.ApplicableRegionSet; import com.sk89q.worldguard.protection.regions.RegionContainer; import com.sk89q.worldguard.protection.regions.RegionQuery; import me.SuperRonanCraft.BetterRTP.Main; +import me.angeschossen.lands.api.integration.LandsIntegration; import me.ryanhamshire.GriefPrevention.GriefPrevention; import org.bukkit.Location; public class RTPPluginValidation { //Safe locations depending on enabled dependencies boolean checkLocation(Location loc) { - boolean worldguard = getWorlguard(loc); - boolean griefPrevention = getGriefprevention(loc); - boolean towny = getTowny(loc); - boolean redProtect = getRedProtect(loc); - boolean factionsUUID = getFactionsUUID(loc); - return worldguard && griefPrevention && towny && redProtect && factionsUUID; + boolean plugin_worldguard = getWorlguard(loc); + boolean plugin_griefPrevention = getGriefprevention(loc); + boolean plugin_towny = getTowny(loc); + boolean plugin_redProtect = getRedProtect(loc); + boolean plugin_factionsUUID = getFactionsUUID(loc); + boolean plugin_lands = getLands(loc); + boolean plugin_residence = getResidence(loc); + return plugin_worldguard + && plugin_griefPrevention + && plugin_towny + && plugin_redProtect + && plugin_factionsUUID + && plugin_lands + && plugin_residence; } - // TESTED on v2.12.3 - // Worldguard v7.0.4 B1, WorldEdit v7.2.0 B5 + // TESTED (v2.12.3) + // Worldguard (v7.0.4 B1), WorldEdit (v7.2.0 B5) // https://dev.bukkit.org/projects/worldguard private boolean getWorlguard(Location loc) { boolean result = true; @@ -42,8 +52,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // TESTED on v2.13.0 - // GriefPrevention v16.15.0 + // TESTED (v2.13.0) + // GriefPrevention (v16.15.0) // https://www.spigotmc.org/resources/griefprevention.1884/ private boolean getGriefprevention(Location loc) { boolean result = true; @@ -56,8 +66,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // NOT TESTED - // Towny v0.96.1.11 + // NOT TESTED (2.13.0) + // Towny (v0.96.1.11) // https://www.spigotmc.org/resources/towny.72694/ private boolean getTowny(Location loc) { boolean result = true; @@ -70,8 +80,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // TESTED 2.13.0 - // RedProtect v7.7.2 + // TESTED (2.13.0) + // RedProtect (v7.7.2) // https://www.spigotmc.org/resources/redprotect.15841/ private boolean getRedProtect(Location loc) { boolean result = true; @@ -84,8 +94,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // NOT TESTED 2.13.2 - // FactionsUUID v1.6.9.5-U0.5.16 + // NOT TESTED (2.13.2) + // FactionsUUID (v1.6.9.5-U0.5.16) // https://www.spigotmc.org/resources/factionsuuid.1035/ private boolean getFactionsUUID(Location loc) { boolean result = true; @@ -99,19 +109,33 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // NOT TESTED 2.14.2 - // Residence v2.5.8 - // https://www.spigotmc.org/resources/residence.11480/ - /*private boolean getResidence(Location loc) { + // NOT TESTED (2.14.3) + // Lands (v4.9.4) + // https://www.spigotmc.org/resources/lands.53313/ + private boolean getLands(Location loc) { boolean result = true; - if (getPl().getSettings().getsDepends().isFactionsUUID()) + if (getPl().getSettings().getsDepends().isLands()) try { - ResidenceApi resAPI = Residence.getAPI(); + result = new LandsIntegration(Main.getInstance()).isClaimed(loc); } catch (Exception e) { e.printStackTrace(); } return result; - }*/ + } + + // NOT TESTED (2.14.3) + // Residence (v4.9.1.9) + // https://www.spigotmc.org/resources/residence.11480/ + private boolean getResidence(Location loc) { + boolean result = true; + if (getPl().getSettings().getsDepends().isResidence()) + try { + result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null; + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } private Main getPl() { return Main.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 3a073b8..4a268aa 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java @@ -13,12 +13,16 @@ public class SoftDepends { private boolean respect_towny = false; private boolean respect_redProtect = false; private boolean respect_factionsUUID = false; + private boolean respect_lands = false; + private boolean respect_residence = false; //RETURNABLES private boolean worldguard = false; private boolean griefprevention = false; private boolean towny = false; private boolean redProtect = false; private boolean factionsUUID = false; + private boolean lands = false; + private boolean residence = false; public boolean isWorldguard() { return worldguard; @@ -40,6 +44,14 @@ public class SoftDepends { return factionsUUID; } + public boolean isLands() { + return lands; + } + + public boolean isResidence() { + return residence; + } + void load() { FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG); String pre = "Settings.Respect."; @@ -48,11 +60,15 @@ public class SoftDepends { 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"); registerWorldguard(); registerGriefPrevention(); registerTowny(); registerRedProtect(); registerFactionsUUID(); + registerLands(); + registerResidence(); } public void registerWorldguard() { @@ -85,6 +101,18 @@ public class SoftDepends { debug("Respecting `FactionsUUID` was " + (factionsUUID ? "SUCCESSFULLY" : "NOT") + " registered"); } + public void registerLands() { + lands = respect_lands && Bukkit.getPluginManager().isPluginEnabled("Lands"); + if (respect_lands) + debug("Respecting `Lands` was " + (lands ? "SUCCESSFULLY" : "NOT") + " registered"); + } + + public void registerResidence() { + residence = respect_residence && Bukkit.getPluginManager().isPluginEnabled("Residence"); + if (respect_residence) + debug("Respecting `Residence` was " + (residence ? "SUCCESSFULLY" : "NOT") + " registered"); + } + private void debug(String str) { if (Main.getInstance().getSettings().debug) Main.getInstance().getLogger().log(Level.INFO, str); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index e197420..bf0f25f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -15,6 +15,8 @@ Settings: RedProtect: false ## Respect FactionsUUID areas (https://www.spigotmc.org/resources/factionsuuid.1035/) FactionsUUID: false + ## Respect Lands areas (https://www.spigotmc.org/resources/lands.53313/) + Lands: 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 62f38bc..b1b72ba 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,8 +1,8 @@ main: me.SuperRonanCraft.BetterRTP.Main -version: '2.14.2' +version: '2.14.3' name: BetterRTP author: SuperRonanCraft -softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect] +softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect, Lands, Residence] api-version: '1.13' commands: