added Pueblos support

This commit is contained in:
SuperRonanCraft 2021-05-20 14:27:39 -04:00
parent a923d63d34
commit 18febd2da1
3 changed files with 39 additions and 20 deletions

View File

@ -17,9 +17,6 @@
<profiles> <profiles>
<profile> <profile>
<id>dev</id> <id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -276,12 +273,12 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Peublos (https://www.spigotmc.org/resources/pueblos.91255/) --> <!-- Peublos (https://www.spigotmc.org/resources/pueblos.91255/) -->
<!--dependency> <dependency>
<groupId>com.github.SuperRonanCraft</groupId> <groupId>com.github.SuperRonanCraft</groupId>
<artifactId>Pueblos</artifactId> <artifactId>Pueblos</artifactId>
<version>82ba1fb1</version> <version>2.0.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency--> </dependency>
<!-- Particles Library --> <!-- Particles Library -->
<dependency> <dependency>
<groupId>xyz.xenondevs</groupId> <groupId>xyz.xenondevs</groupId>

View File

@ -15,7 +15,9 @@ import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.RegionContainer; import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery; import com.sk89q.worldguard.protection.regions.RegionQuery;
import com.songoda.ultimateclaims.UltimateClaims; import com.songoda.ultimateclaims.UltimateClaims;
import me.RonanCraft.Pueblos.Pueblos;
import me.SuperRonanCraft.BetterRTP.BetterRTP; import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
import me.angeschossen.lands.api.integration.LandsIntegration; import me.angeschossen.lands.api.integration.LandsIntegration;
import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Location; import org.bukkit.Location;
@ -34,6 +36,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
boolean plugin_hClaims = gethClaims(loc); boolean plugin_hClaims = gethClaims(loc);
boolean plugin_griefDefender = getGriefDefender(loc); boolean plugin_griefDefender = getGriefDefender(loc);
boolean plugin_ultimateClaims = getUltimateClaims(loc); boolean plugin_ultimateClaims = getUltimateClaims(loc);
boolean plugin_pueblos = getPueblos(loc);
return plugin_worldguard return plugin_worldguard
&& plugin_griefPrevention && plugin_griefPrevention
&& plugin_towny && plugin_towny
@ -44,7 +47,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
&& plugin_kingdomsx && plugin_kingdomsx
&& plugin_hClaims && plugin_hClaims
&& plugin_griefDefender && plugin_griefDefender
&& plugin_ultimateClaims; && plugin_ultimateClaims
&& plugin_pueblos;
} }
// TESTED (v2.12.3) // TESTED (v2.12.3)
@ -52,7 +56,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://dev.bukkit.org/projects/worldguard // https://dev.bukkit.org/projects/worldguard
private boolean getWorlguard(Location loc) { private boolean getWorlguard(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isWorldguard()) if (getDepends().isWorldguard())
try { try {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery(); RegionQuery query = container.createQuery();
@ -72,7 +76,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/griefprevention.1884/ // https://www.spigotmc.org/resources/griefprevention.1884/
private boolean getGriefprevention(Location loc) { private boolean getGriefprevention(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isGriefprevention()) if (getDepends().isGriefprevention())
try { try {
result = GriefPrevention.instance.dataStore.getClaimAt(loc, true, null) == null; result = GriefPrevention.instance.dataStore.getClaimAt(loc, true, null) == null;
} catch (Exception e) { } catch (Exception e) {
@ -86,7 +90,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/towny.72694/ // https://www.spigotmc.org/resources/towny.72694/
private boolean getTowny(Location loc) { private boolean getTowny(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isTowny()) if (getDepends().isTowny())
try { try {
result = TownyAPI.getInstance().isWilderness(loc); result = TownyAPI.getInstance().isWilderness(loc);
} catch (Exception e) { } catch (Exception e) {
@ -100,7 +104,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/redprotect.15841/ // https://www.spigotmc.org/resources/redprotect.15841/
private boolean getRedProtect(Location loc) { private boolean getRedProtect(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isRedProtect()) if (getDepends().isRedProtect())
try { try {
result = RedProtect.get().getAPI().getRegion(loc) == null; result = RedProtect.get().getAPI().getRegion(loc) == null;
} catch (Exception e) { } catch (Exception e) {
@ -114,7 +118,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/factionsuuid.1035/ // https://www.spigotmc.org/resources/factionsuuid.1035/
private boolean getFactionsUUID(Location loc) { private boolean getFactionsUUID(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isFactionsUUID()) if (getDepends().isFactionsUUID())
try { try {
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc)); Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
result = faction.isWilderness() || faction.isWarZone() || faction.isSafeZone(); result = faction.isWilderness() || faction.isWarZone() || faction.isSafeZone();
@ -129,7 +133,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/lands.53313/ // https://www.spigotmc.org/resources/lands.53313/
private boolean getLands(Location loc) { private boolean getLands(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isLands()) if (getDepends().isLands())
try { try {
result = !(new LandsIntegration(BetterRTP.getInstance()).isClaimed(loc)); result = !(new LandsIntegration(BetterRTP.getInstance()).isClaimed(loc));
} catch (Exception e) { } catch (Exception e) {
@ -143,7 +147,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/residence.11480/ // https://www.spigotmc.org/resources/residence.11480/
private boolean getResidence(Location loc) { private boolean getResidence(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isResidence()) if (getDepends().isResidence())
try { try {
result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null; result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null;
} catch (Exception e) { } catch (Exception e) {
@ -157,7 +161,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/kingdomsx.77670/ // https://www.spigotmc.org/resources/kingdomsx.77670/
private boolean getKingdomsx(Location loc) { private boolean getKingdomsx(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isKingdomsX()) if (getDepends().isKingdomsX())
try { try {
org.kingdoms.constants.land.Land land = org.kingdoms.constants.land.Land.getLand(loc); org.kingdoms.constants.land.Land land = org.kingdoms.constants.land.Land.getLand(loc);
result = land == null || !land.isClaimed(); result = land == null || !land.isClaimed();
@ -172,7 +176,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/hclaims.90540/ (Local Repo) // https://www.spigotmc.org/resources/hclaims.90540/ (Local Repo)
private boolean gethClaims(Location loc) { private boolean gethClaims(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().ishClaims()) if (getDepends().ishClaims())
try { try {
result = ClaimAPI.isClaimed(loc); result = ClaimAPI.isClaimed(loc);
} catch (Exception e) { } catch (Exception e) {
@ -186,7 +190,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://www.spigotmc.org/resources/griefdefender.68900/ // https://www.spigotmc.org/resources/griefdefender.68900/
private boolean getGriefDefender(Location loc) { private boolean getGriefDefender(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isGriefDefender()) if (getDepends().isGriefDefender())
try { try {
for (Claim claim : GriefDefender.getCore().getAllClaims()) for (Claim claim : GriefDefender.getCore().getAllClaims())
if (claim.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) { if (claim.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) {
@ -204,7 +208,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
// https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65 // https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65
private boolean getUltimateClaims(Location loc) { private boolean getUltimateClaims(Location loc) {
boolean result = true; boolean result = true;
if (getPl().getSettings().getsDepends().isUltimateClaims()) if (getDepends().isPueblos())
try { try {
result = UltimateClaims.getInstance().getClaimManager().getClaim(loc.getChunk()) == null; result = UltimateClaims.getInstance().getClaimManager().getClaim(loc.getChunk()) == null;
} catch (Exception e) { } catch (Exception e) {
@ -213,7 +217,21 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
return result; return result;
} }
private BetterRTP getPl() { // NOT TESTED (3.1.0)
return BetterRTP.getInstance(); // Pueblos (v2.0.1)
// https://www.spigotmc.org/resources/pueblos.91255/
private boolean getPueblos(Location loc) {
boolean result = true;
if (getDepends().isUltimateClaims())
try {
result = Pueblos.getInstance().getClaimHandler().getClaimMain(loc) == null;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private SoftDepends getDepends() {
return BetterRTP.getInstance().getSettings().getsDepends();
} }
} }

View File

@ -78,6 +78,10 @@ public class SoftDepends {
return ultimateClaims; return ultimateClaims;
} }
public boolean isPueblos() {
return pueblos;
}
void load() { void load() {
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG); FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
String pre = "Settings.Respect."; String pre = "Settings.Respect.";