mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 00:55:45 +00:00
factionsuuid added as dependency
This commit is contained in:
parent
2fc9c7e94a
commit
ffd5d3e921
12
pom.xml
12
pom.xml
@ -81,6 +81,11 @@
|
||||
<id>redprotect-repo</id>
|
||||
<url>https://raw.githubusercontent.com/FabioZumbi12/RedProtect/mvn-repo/</url>
|
||||
</repository>
|
||||
<!-- FactionsUUID Repo -->
|
||||
<repository>
|
||||
<id>factions-uuid</id>
|
||||
<url>http://ci.ender.zone/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!--Spigot API-->
|
||||
@ -151,5 +156,12 @@
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
</project>
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 #
|
||||
|
Loading…
x
Reference in New Issue
Block a user