factionsuuid added as dependency

This commit is contained in:
SuperRonanCraft 2020-09-25 16:57:53 -04:00
parent 2fc9c7e94a
commit ffd5d3e921
4 changed files with 52 additions and 3 deletions

12
pom.xml
View File

@ -81,6 +81,11 @@
<id>redprotect-repo</id> <id>redprotect-repo</id>
<url>https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/</url> <url>https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/</url>
</repository> </repository>
<!-- FactionsUUID Repo -->
<repository>
<id>factions-uuid</id>
<url>http://ci.ender.zone/plugin/repository/everything/</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>
<!--Spigot API--> <!--Spigot API-->
@ -151,5 +156,12 @@
<version>LATEST</version> <version>LATEST</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- FactionsUUID (https://www.spigotmc.org/resources/factionsuuid.1035/) -->
<dependency>
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>1.6.9.5-U0.5.16</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,6 +1,10 @@
package me.SuperRonanCraft.BetterRTP.player.rtp; package me.SuperRonanCraft.BetterRTP.player.rtp;
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect; 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.palmergames.bukkit.towny.TownyAPI;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.LocalPlayer;
@ -20,7 +24,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
boolean griefPrevention = getGriefprevention(loc); boolean griefPrevention = getGriefprevention(loc);
boolean towny = getTowny(loc); boolean towny = getTowny(loc);
boolean redProtect = getRedProtect(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 // TESTED on v2.12.3
@ -40,7 +45,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
return result; return result;
} }
// TESTED on v2.12.3 // TESTED on v2.13.0
// GriefPrevention v16.15.0 // GriefPrevention v16.15.0
// https://www.spigotmc.org/resources/griefprevention.1884/ // https://www.spigotmc.org/resources/griefprevention.1884/
private boolean getGriefprevention(Location loc) { private boolean getGriefprevention(Location loc) {
@ -68,7 +73,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
return result; return result;
} }
// TESTED 2.12.3 // TESTED 2.13.0
// RedProtect v7.7.2 // RedProtect v7.7.2
// https://www.spigotmc.org/resources/redprotect.15841/ // https://www.spigotmc.org/resources/redprotect.15841/
private boolean getRedProtect(Location loc) { private boolean getRedProtect(Location loc) {
@ -82,6 +87,22 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
return result; 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() { private Main getPl() {
return Main.getInstance(); return Main.getInstance();
} }

View File

@ -12,11 +12,13 @@ public class SoftDepends {
private boolean respect_griefprevention = false; private boolean respect_griefprevention = false;
private boolean respect_towny = false; private boolean respect_towny = false;
private boolean respect_redProtect = false; private boolean respect_redProtect = false;
private boolean respect_factionsUUID = false;
//RETURNABLES //RETURNABLES
private boolean worldguard = false; private boolean worldguard = false;
private boolean griefprevention = false; private boolean griefprevention = false;
private boolean towny = false; private boolean towny = false;
private boolean redProtect = false; private boolean redProtect = false;
private boolean factionsUUID = false;
public boolean isWorldguard() { public boolean isWorldguard() {
return worldguard; return worldguard;
@ -34,6 +36,10 @@ public class SoftDepends {
return redProtect; return redProtect;
} }
public boolean isFactionsUUID() {
return factionsUUID;
}
void load() { void load() {
FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG); FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
String pre = "Settings.Respect."; String pre = "Settings.Respect.";
@ -41,10 +47,12 @@ public class SoftDepends {
respect_griefprevention = config.getBoolean(pre + "GriefPrevention"); respect_griefprevention = config.getBoolean(pre + "GriefPrevention");
respect_towny = config.getBoolean( pre + "Towny"); respect_towny = config.getBoolean( pre + "Towny");
respect_redProtect = config.getBoolean( pre + "RedProtect"); respect_redProtect = config.getBoolean( pre + "RedProtect");
respect_factionsUUID = config.getBoolean( pre + "FactionsUUID");
registerWorldguard(); registerWorldguard();
registerGriefPrevention(); registerGriefPrevention();
registerTowny(); registerTowny();
registerRedProtect(); registerRedProtect();
registerFactionsUUID();
} }
public void registerWorldguard() { public void registerWorldguard() {
@ -71,6 +79,12 @@ public class SoftDepends {
debug("Respecting `RedProtect` was " + (redProtect ? "SUCCESSFULLY" : "NOT") + " registered"); 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) { private void debug(String str) {
if (Main.getInstance().getSettings().debug) if (Main.getInstance().getSettings().debug)
Main.getInstance().getLogger().log(Level.INFO, str); Main.getInstance().getLogger().log(Level.INFO, str);

View File

@ -13,6 +13,8 @@ Settings:
Towny: false Towny: false
## Respect RedProtect areas (https://www.spigotmc.org/resources/redprotect.15841/) ## Respect RedProtect areas (https://www.spigotmc.org/resources/redprotect.15841/)
RedProtect: false RedProtect: false
## Respect FactionsUUID areas (https://www.spigotmc.org/resources/factionsuuid.1035/)
FactionsUUID: false
## Output to console some debugging info ## Output to console some debugging info
Debugger: false Debugger: false
## Must be a positive integer # ## Must be a positive integer #