diff --git a/pom.xml b/pom.xml index 7c68ccc..f34311c 100644 --- a/pom.xml +++ b/pom.xml @@ -81,6 +81,11 @@ redprotect-repo https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/ + + + factions-uuid + http://ci.ender.zone/plugin/repository/everything/ + @@ -151,5 +156,12 @@ LATEST provided + + + com.massivecraft + Factions + 1.6.9.5-U0.5.16 + provided + \ 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 e2beb93..5af4750 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,10 @@ package me.SuperRonanCraft.BetterRTP.player.rtp; import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect; +import com.massivecraft.factions.Board; +import com.massivecraft.factions.FLocation; +import com.massivecraft.factions.Faction; +import com.massivecraft.factions.Factions; import com.palmergames.bukkit.towny.TownyAPI; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldguard.LocalPlayer; @@ -20,7 +24,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende boolean griefPrevention = getGriefprevention(loc); boolean towny = getTowny(loc); boolean redProtect = getRedProtect(loc); - return worldguard && griefPrevention && towny && redProtect; + boolean factionsUUID = getFactionsUUID(loc); + return worldguard && griefPrevention && towny && redProtect && factionsUUID; } // TESTED on v2.12.3 @@ -40,7 +45,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // TESTED on v2.12.3 + // TESTED on v2.13.0 // GriefPrevention v16.15.0 // https://www.spigotmc.org/resources/griefprevention.1884/ private boolean getGriefprevention(Location loc) { @@ -68,7 +73,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } - // TESTED 2.12.3 + // TESTED 2.13.0 // RedProtect v7.7.2 // https://www.spigotmc.org/resources/redprotect.15841/ private boolean getRedProtect(Location loc) { @@ -82,6 +87,22 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende return result; } + // NOT TESTED 2.13.2 + // FactionsUUID v7.7.2 + // https://www.spigotmc.org/resources/redprotect.15841/ + private boolean getFactionsUUID(Location loc) { + boolean result = true; + if (getPl().getSettings().getsDepends().isFactionsUUID()) + try { + FLocation floc = new FLocation(loc); + Faction faction = Board.getInstance().getFactionAt(floc); + result = faction.isWilderness() || faction.isWarZone() || faction.isSafeZone(); + } 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 c8e6152..b13fb34 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/settings/SoftDepends.java @@ -12,11 +12,13 @@ public class SoftDepends { private boolean respect_griefprevention = false; private boolean respect_towny = false; private boolean respect_redProtect = false; + private boolean respect_factionsUUID = false; //RETURNABLES private boolean worldguard = false; private boolean griefprevention = false; private boolean towny = false; private boolean redProtect = false; + private boolean factionsUUID = false; public boolean isWorldguard() { return worldguard; @@ -34,6 +36,10 @@ public class SoftDepends { return redProtect; } + public boolean isFactionsUUID() { + return factionsUUID; + } + void load() { FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG); String pre = "Settings.Respect."; @@ -41,10 +47,12 @@ public class SoftDepends { respect_griefprevention = config.getBoolean(pre + "GriefPrevention"); respect_towny = config.getBoolean( pre + "Towny"); respect_redProtect = config.getBoolean( pre + "RedProtect"); + respect_factionsUUID = config.getBoolean( pre + "FactionsUUID"); registerWorldguard(); registerGriefPrevention(); registerTowny(); registerRedProtect(); + registerFactionsUUID(); } public void registerWorldguard() { @@ -71,6 +79,12 @@ public class SoftDepends { debug("Respecting `RedProtect` was " + (redProtect ? "SUCCESSFULLY" : "NOT") + " registered"); } + public void registerFactionsUUID() { + factionsUUID = respect_factionsUUID && Bukkit.getPluginManager().isPluginEnabled("RedProtect"); + if (respect_factionsUUID) + debug("Respecting `FactionsUUID` was " + (factionsUUID ? "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 6699020..6628890 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -13,6 +13,8 @@ Settings: Towny: false ## Respect RedProtect areas (https://www.spigotmc.org/resources/redprotect.15841/) RedProtect: false + ## Respect FactionsUUID areas (https://www.spigotmc.org/resources/factionsuuid.1035/) + FactionsUUID: false ## Output to console some debugging info Debugger: false ## Must be a positive integer #