mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-10-26 05:50:41 +00:00
Regions validation recode + getLocations fix
This commit is contained in:
1 parent
61d7e335d9
commit
55182607bd
18 files changed
+453
-229
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP</artifactId>
|
<artifactId>BetterRTP</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>3.4.4</version>
|
<version>3.4.5-DEV</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
@@ -305,7 +305,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xyz.xenondevs</groupId>
|
<groupId>xyz.xenondevs</groupId>
|
||||||
<artifactId>particle</artifactId>
|
<artifactId>particle</artifactId>
|
||||||
<version>1.7.1</version>
|
<version>1.8.1</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Lombok Support (@Getter & @Setter)-->
|
<!-- Lombok Support (@Getter & @Setter)-->
|
||||||
@@ -328,5 +328,12 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Saber Factions (https://www.spigotmc.org/resources/saberfactions.69771/) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.SaberLLC</groupId>
|
||||||
|
<artifactId>Saber-Factions</artifactId>
|
||||||
|
<version>2.4.0-RC</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -86,13 +86,15 @@ public class CmdLocation implements RTPCommand, RTPCommandHelpable {
|
|||||||
//Get locations a player has access to
|
//Get locations a player has access to
|
||||||
public static HashMap<String, RTPWorld> getLocations(CommandSender sendi, @Nullable World world) {
|
public static HashMap<String, RTPWorld> getLocations(CommandSender sendi, @Nullable World world) {
|
||||||
HashMap<String, RTPWorld> locations = new HashMap<>();
|
HashMap<String, RTPWorld> locations = new HashMap<>();
|
||||||
|
boolean needPermission = BetterRTP.getInstance().getSettings().isLocationNeedPermission();
|
||||||
|
boolean needSameWorld = BetterRTP.getInstance().getSettings().isUseLocationsInSameWorld();
|
||||||
for (Map.Entry<String, RTPWorld> location : getLocations().entrySet()) {
|
for (Map.Entry<String, RTPWorld> location : getLocations().entrySet()) {
|
||||||
boolean add = false;
|
boolean add = true;
|
||||||
if (BetterRTP.getInstance().getSettings().isLocationNeedPermission())
|
if (needPermission) //Do we need permission to go to this location?
|
||||||
add = PermissionNode.getLocation(sendi, location.getKey());
|
add = PermissionNode.getLocation(sendi, location.getKey());
|
||||||
if (BetterRTP.getInstance().getSettings().isUseLocationsInSameWorld())
|
if (add && needSameWorld) //Can be added and needs same world (if not same world, we don't care to check)
|
||||||
add = world == null || location.getValue().getWorld().equals(world);
|
add = world == null || location.getValue().getWorld().equals(world);
|
||||||
if (add)
|
if (add) //Location can be added to list
|
||||||
locations.put(location.getKey(), location.getValue());
|
locations.put(location.getKey(), location.getValue());
|
||||||
}
|
}
|
||||||
return locations;
|
return locations;
|
||||||
|
|||||||
@@ -17,27 +17,29 @@ import com.sk89q.worldguard.protection.regions.RegionQuery;
|
|||||||
import com.songoda.ultimateclaims.UltimateClaims;
|
import com.songoda.ultimateclaims.UltimateClaims;
|
||||||
import me.RonanCraft.Pueblos.Pueblos;
|
import me.RonanCraft.Pueblos.Pueblos;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins.*;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
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;
|
||||||
|
|
||||||
public class RTPPluginValidation { //Safe locations depending on enabled dependencies
|
public class RTPPluginValidation {
|
||||||
|
|
||||||
boolean checkLocation(Location loc) {
|
boolean checkLocation(Location loc) {
|
||||||
boolean plugin_worldguard = getWorlguard(loc);
|
boolean plugin_worldGuard = RTP_WorldGuard.check(loc);
|
||||||
boolean plugin_griefPrevention = getGriefprevention(loc);
|
boolean plugin_griefPrevention = RTP_GriefPrevention.check(loc);
|
||||||
boolean plugin_towny = getTowny(loc);
|
boolean plugin_towny = RTP_Towny.check(loc);
|
||||||
boolean plugin_redProtect = getRedProtect(loc);
|
boolean plugin_redProtect = RTP_RedProtect.check(loc);
|
||||||
boolean plugin_factionsUUID = getFactionsUUID(loc);
|
boolean plugin_factionsUUID = RTP_FactionsUUID.check(loc);
|
||||||
boolean plugin_lands = getLands(loc);
|
boolean plugin_lands = RTP_Lands.check(loc);
|
||||||
boolean plugin_residence = getResidence(loc);
|
boolean plugin_residence = RTP_Residence.check(loc);
|
||||||
boolean plugin_kingdomsx = getKingdomsx(loc);
|
boolean plugin_kingdomsx = RTP_KingdomsX.check(loc);
|
||||||
boolean plugin_hClaims = gethClaims(loc);
|
boolean plugin_hClaims = RTP_hClaims.check(loc);
|
||||||
boolean plugin_griefDefender = getGriefDefender(loc);
|
boolean plugin_griefDefender = RTP_GriefDefender.check(loc);
|
||||||
boolean plugin_ultimateClaims = getUltimateClaims(loc);
|
boolean plugin_ultimateClaims = RTP_UltimateClaims.check(loc);
|
||||||
boolean plugin_pueblos = getPueblos(loc);
|
boolean plugin_pueblos = RTP_Pueblos.check(loc);
|
||||||
return plugin_worldguard
|
boolean plugin_saberFactions = RTP_SaberFactions.check(loc);
|
||||||
|
return plugin_worldGuard
|
||||||
&& plugin_griefPrevention
|
&& plugin_griefPrevention
|
||||||
&& plugin_towny
|
&& plugin_towny
|
||||||
&& plugin_redProtect
|
&& plugin_redProtect
|
||||||
@@ -48,190 +50,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
|
|||||||
&& plugin_hClaims
|
&& plugin_hClaims
|
||||||
&& plugin_griefDefender
|
&& plugin_griefDefender
|
||||||
&& plugin_ultimateClaims
|
&& plugin_ultimateClaims
|
||||||
&& plugin_pueblos;
|
&& plugin_pueblos
|
||||||
}
|
&& plugin_saberFactions;
|
||||||
|
|
||||||
// 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;
|
|
||||||
if (getDepends().isWorldguard())
|
|
||||||
try {
|
|
||||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
|
||||||
RegionQuery query = container.createQuery();
|
|
||||||
ApplicableRegionSet set = query.getApplicableRegions(BukkitAdapter.adapt(loc));
|
|
||||||
//for (ProtectedRegion region : set.getRegions()) {
|
|
||||||
// region.getId()
|
|
||||||
//}
|
|
||||||
result = set.size() == 0;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED (v2.13.0)
|
|
||||||
// GriefPrevention (v16.15.0)
|
|
||||||
// https://www.spigotmc.org/resources/griefprevention.1884/
|
|
||||||
private boolean getGriefprevention(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isGriefprevention())
|
|
||||||
try {
|
|
||||||
result = GriefPrevention.instance.dataStore.getClaimAt(loc, true, null) == null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
if (getDepends().isTowny())
|
|
||||||
try {
|
|
||||||
result = TownyAPI.getInstance().isWilderness(loc);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TESTED (2.13.0)
|
|
||||||
// RedProtect (v7.7.2)
|
|
||||||
// https://www.spigotmc.org/resources/redprotect.15841/
|
|
||||||
private boolean getRedProtect(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isRedProtect())
|
|
||||||
try {
|
|
||||||
result = RedProtect.get().getAPI().getRegion(loc) == null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
if (getDepends().isFactionsUUID())
|
|
||||||
try {
|
|
||||||
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
|
|
||||||
result = faction.isWilderness() || faction.isSafeZone();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT TESTED (2.14.3)
|
|
||||||
// Lands (v5.0.5)
|
|
||||||
// https://www.spigotmc.org/resources/lands.53313/
|
|
||||||
private boolean getLands(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isLands())
|
|
||||||
try {
|
|
||||||
result = !(new LandsIntegration(BetterRTP.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 (getDepends().isResidence())
|
|
||||||
try {
|
|
||||||
result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT TESTED (3.0.2)
|
|
||||||
// KingdomsX (v1.10.5.2)
|
|
||||||
// https://www.spigotmc.org/resources/kingdomsx.77670/
|
|
||||||
private boolean getKingdomsx(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isKingdomsx())
|
|
||||||
try {
|
|
||||||
org.kingdoms.constants.land.Land land = org.kingdoms.constants.land.Land.getLand(loc);
|
|
||||||
result = land == null || !land.isClaimed();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT TESTED (3.1.0)
|
|
||||||
// hClaims (v1.1.1)
|
|
||||||
// https://www.spigotmc.org/resources/hclaims.90540/ (Local Repo)
|
|
||||||
private boolean gethClaims(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isHClaims())
|
|
||||||
try {
|
|
||||||
result = ClaimAPI.getInstance().isClaimed(loc);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT TESTED (3.1.0)
|
|
||||||
// GriefDefender (v1.5.10)
|
|
||||||
// https://www.spigotmc.org/resources/griefdefender.68900/
|
|
||||||
private boolean getGriefDefender(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isGriefDefender())
|
|
||||||
try {
|
|
||||||
for (Claim claim : GriefDefender.getCore().getAllClaims())
|
|
||||||
if (claim.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) {
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT TESTED (3.1.0)
|
|
||||||
// UltimateClaims (v1.6.1)
|
|
||||||
// https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65
|
|
||||||
private boolean getUltimateClaims(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isUltimateClaims())
|
|
||||||
try {
|
|
||||||
result = UltimateClaims.getInstance().getClaimManager().getClaim(loc.getChunk()) == null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOT TESTED (3.1.0)
|
|
||||||
// Pueblos (v2.0.1)
|
|
||||||
// https://www.spigotmc.org/resources/pueblos.91255/
|
|
||||||
private boolean getPueblos(Location loc) {
|
|
||||||
boolean result = true;
|
|
||||||
if (getDepends().isPueblos())
|
|
||||||
try {
|
|
||||||
result = Pueblos.getInstance().getClaimHandler().getClaimMain(loc) == null;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SoftDepends getDepends() {
|
|
||||||
return BetterRTP.getInstance().getSettings().getsDepends();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Board;
|
||||||
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_FactionsUUID {
|
||||||
|
|
||||||
|
// NOT TESTED (2.13.2)
|
||||||
|
// FactionsUUID (v1.6.9.5-U0.5.16)
|
||||||
|
// https://www.spigotmc.org/resources/factionsuuid.1035/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isFactionsUUID())
|
||||||
|
try {
|
||||||
|
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
|
||||||
|
result = faction.isWilderness() || faction.isSafeZone();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.griefdefender.api.GriefDefender;
|
||||||
|
import com.griefdefender.api.claim.Claim;
|
||||||
|
import com.songoda.ultimateclaims.UltimateClaims;
|
||||||
|
import me.RonanCraft.Pueblos.Pueblos;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_GriefDefender {
|
||||||
|
|
||||||
|
// NOT TESTED (3.1.0)
|
||||||
|
// GriefDefender (v1.5.10)
|
||||||
|
// https://www.spigotmc.org/resources/griefdefender.68900/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isGriefDefender())
|
||||||
|
try {
|
||||||
|
for (Claim claim : GriefDefender.getCore().getAllClaims())
|
||||||
|
if (claim.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())) {
|
||||||
|
result = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_GriefPrevention {
|
||||||
|
|
||||||
|
// TESTED (v2.13.0)
|
||||||
|
// GriefPrevention (v16.15.0)
|
||||||
|
// https://www.spigotmc.org/resources/griefprevention.1884/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isGriefprevention())
|
||||||
|
try {
|
||||||
|
result = GriefPrevention.instance.dataStore.getClaimAt(loc, true, null) == null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_KingdomsX {
|
||||||
|
|
||||||
|
// NOT TESTED (3.0.2)
|
||||||
|
// KingdomsX (v1.10.5.2)
|
||||||
|
// https://www.spigotmc.org/resources/kingdomsx.77670/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isKingdomsx())
|
||||||
|
try {
|
||||||
|
org.kingdoms.constants.land.Land land = org.kingdoms.constants.land.Land.getLand(loc);
|
||||||
|
result = land == null || !land.isClaimed();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import me.angeschossen.lands.api.integration.LandsIntegration;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_Lands {
|
||||||
|
|
||||||
|
// NOT TESTED (2.14.3)
|
||||||
|
// Lands (v5.0.5)
|
||||||
|
// https://www.spigotmc.org/resources/lands.53313/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isLands())
|
||||||
|
try {
|
||||||
|
result = !(new LandsIntegration(BetterRTP.getInstance()).isClaimed(loc));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import me.RonanCraft.Pueblos.Pueblos;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_Pueblos {
|
||||||
|
|
||||||
|
// NOT TESTED (3.1.0)
|
||||||
|
// Pueblos (v2.0.1)
|
||||||
|
// https://www.spigotmc.org/resources/pueblos.91255/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isPueblos())
|
||||||
|
try {
|
||||||
|
result = Pueblos.getInstance().getClaimHandler().getClaimMain(loc) == null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_RedProtect {
|
||||||
|
|
||||||
|
// TESTED (2.13.0)
|
||||||
|
// RedProtect (v7.7.2)
|
||||||
|
// https://www.spigotmc.org/resources/redprotect.15841/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isRedProtect())
|
||||||
|
try {
|
||||||
|
result = RedProtect.get().getAPI().getRegion(loc) == null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.bekvon.bukkit.residence.Residence;
|
||||||
|
import com.griefdefender.api.GriefDefender;
|
||||||
|
import com.griefdefender.api.claim.Claim;
|
||||||
|
import com.hakan.claimsystem.api.ClaimAPI;
|
||||||
|
import com.songoda.ultimateclaims.UltimateClaims;
|
||||||
|
import me.RonanCraft.Pueblos.Pueblos;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_Residence {
|
||||||
|
|
||||||
|
// NOT TESTED (2.14.3)
|
||||||
|
// Residence (v4.9.1.9)
|
||||||
|
// https://www.spigotmc.org/resources/residence.11480/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isResidence())
|
||||||
|
try {
|
||||||
|
result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.*;
|
||||||
|
import me.RonanCraft.Pueblos.Pueblos;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_SaberFactions {
|
||||||
|
|
||||||
|
// NOT TESTED (3.4.5)
|
||||||
|
// SaberFactions (v2.0.1)
|
||||||
|
// https://www.spigotmc.org/resources/saberfactions.69771/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isSaberFactions())
|
||||||
|
try {
|
||||||
|
FLocation fLoc = new FLocation(loc);
|
||||||
|
Faction faction = Board.getInstance().getFactionAt(fLoc);
|
||||||
|
result = faction == null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.palmergames.bukkit.towny.TownyAPI;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_Towny {
|
||||||
|
|
||||||
|
// NOT TESTED (2.13.0)
|
||||||
|
// Towny (v0.96.1.11)
|
||||||
|
// https://www.spigotmc.org/resources/towny.72694/
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isTowny())
|
||||||
|
try {
|
||||||
|
result = TownyAPI.getInstance().isWilderness(loc);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.songoda.ultimateclaims.UltimateClaims;
|
||||||
|
import me.RonanCraft.Pueblos.Pueblos;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_UltimateClaims {
|
||||||
|
|
||||||
|
// NOT TESTED (3.1.0)
|
||||||
|
// UltimateClaims (v1.6.1)
|
||||||
|
// https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isUltimateClaims())
|
||||||
|
try {
|
||||||
|
result = UltimateClaims.getInstance().getClaimManager().getClaim(loc.getChunk()) == null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
|
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||||
|
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_WorldGuard {
|
||||||
|
|
||||||
|
// TESTED (v2.12.3)
|
||||||
|
// Worldguard (v7.0.4 B1), WorldEdit (v7.2.0 B5)
|
||||||
|
// https://dev.bukkit.org/projects/worldguard
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isWorldguard())
|
||||||
|
try {
|
||||||
|
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||||
|
RegionQuery query = container.createQuery();
|
||||||
|
ApplicableRegionSet set = query.getApplicableRegions(BukkitAdapter.adapt(loc));
|
||||||
|
//for (ProtectedRegion region : set.getRegions()) {
|
||||||
|
// region.getId()
|
||||||
|
//}
|
||||||
|
result = set.size() == 0;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
|
import com.hakan.claimsystem.api.ClaimAPI;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RTP_hClaims {
|
||||||
|
|
||||||
|
// NOT TESTED (3.1.0)
|
||||||
|
// hClaims (v1.1.1)
|
||||||
|
// https://www.spigotmc.org/resources/hclaims.90540/ (Local Repo)
|
||||||
|
public static boolean check(Location loc) {
|
||||||
|
boolean result = true;
|
||||||
|
if (getDepends().isHClaims())
|
||||||
|
try {
|
||||||
|
result = ClaimAPI.getInstance().isClaimed(loc);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SoftDepends getDepends() {
|
||||||
|
return BetterRTP.getInstance().getSettings().getsDepends();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,31 +9,35 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
public class SoftDepends {
|
public class SoftDepends {
|
||||||
|
|
||||||
private boolean respect_worldguard = false;
|
private boolean
|
||||||
private boolean respect_griefprevention = false;
|
respect_worldguard = false,
|
||||||
private boolean respect_towny = false;
|
respect_griefprevention = false,
|
||||||
private boolean respect_redProtect = false;
|
respect_towny = false,
|
||||||
private boolean respect_factionsUUID = false;
|
respect_redProtect = false,
|
||||||
private boolean respect_lands = false;
|
respect_factionsUUID = false,
|
||||||
private boolean respect_residence = false;
|
respect_lands = false,
|
||||||
private boolean respect_kingdomsx = false;
|
respect_residence = false,
|
||||||
private boolean respect_hClaims = false;
|
respect_kingdomsx = false,
|
||||||
private boolean respect_griefDefender = false;
|
respect_hClaims = false,
|
||||||
private boolean respect_ultimateClaims = false;
|
respect_griefDefender = false,
|
||||||
private boolean respect_pueblos = false;
|
respect_ultimateClaims = false,
|
||||||
|
respect_pueblos = false,
|
||||||
|
respect_saberFactions = false;
|
||||||
//RETURNABLES
|
//RETURNABLES
|
||||||
@Getter private boolean worldguard = false;
|
@Getter private boolean
|
||||||
@Getter private boolean griefprevention = false;
|
worldguard = false,
|
||||||
@Getter private boolean towny = false;
|
griefprevention = false,
|
||||||
@Getter private boolean redProtect = false;
|
towny = false,
|
||||||
@Getter private boolean factionsUUID = false;
|
redProtect = false,
|
||||||
@Getter private boolean lands = false;
|
factionsUUID = false,
|
||||||
@Getter private boolean residence = false;
|
lands = false,
|
||||||
@Getter private boolean kingdomsx = false;
|
residence = false,
|
||||||
@Getter private boolean hClaims = false;
|
kingdomsx = false,
|
||||||
@Getter private boolean griefDefender = false;
|
hClaims = false,
|
||||||
@Getter private boolean ultimateClaims = false;
|
griefDefender = false,
|
||||||
@Getter private boolean pueblos = false;
|
ultimateClaims = false,
|
||||||
|
pueblos = false,
|
||||||
|
saberFactions = false;
|
||||||
|
|
||||||
void load() {
|
void load() {
|
||||||
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
|
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
|
||||||
@@ -50,6 +54,7 @@ public class SoftDepends {
|
|||||||
respect_griefDefender = config.getBoolean( pre + "GriefDefender");
|
respect_griefDefender = config.getBoolean( pre + "GriefDefender");
|
||||||
respect_ultimateClaims = config.getBoolean( pre + "UltimateClaims");
|
respect_ultimateClaims = config.getBoolean( pre + "UltimateClaims");
|
||||||
respect_pueblos = config.getBoolean( pre + "Pueblos");
|
respect_pueblos = config.getBoolean( pre + "Pueblos");
|
||||||
|
respect_saberFactions = config.getBoolean( pre + "SaberFactions");
|
||||||
registerWorldguard();
|
registerWorldguard();
|
||||||
registerGriefPrevention();
|
registerGriefPrevention();
|
||||||
registerTowny();
|
registerTowny();
|
||||||
@@ -62,6 +67,7 @@ public class SoftDepends {
|
|||||||
registerGriefDefender();
|
registerGriefDefender();
|
||||||
registerUltimateClaims();
|
registerUltimateClaims();
|
||||||
registerPueblos();
|
registerPueblos();
|
||||||
|
registerSaberFactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerWorldguard() {
|
public void registerWorldguard() {
|
||||||
@@ -136,6 +142,12 @@ public class SoftDepends {
|
|||||||
debug("Respecting `Pueblos` was " + (pueblos ? "SUCCESSFULLY" : "NOT") + " registered");
|
debug("Respecting `Pueblos` was " + (pueblos ? "SUCCESSFULLY" : "NOT") + " registered");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerSaberFactions() {
|
||||||
|
saberFactions = respect_saberFactions && Bukkit.getPluginManager().isPluginEnabled("Factions");
|
||||||
|
if (respect_saberFactions)
|
||||||
|
debug("Respecting `SaberFactions` was " + (saberFactions ? "SUCCESSFULLY" : "NOT") + " registered");
|
||||||
|
}
|
||||||
|
|
||||||
private void debug(String str) {
|
private void debug(String str) {
|
||||||
if (BetterRTP.getInstance().getSettings().isDebug())
|
if (BetterRTP.getInstance().getSettings().isDebug())
|
||||||
BetterRTP.getInstance().getLogger().log(Level.INFO, str);
|
BetterRTP.getInstance().getLogger().log(Level.INFO, str);
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ Settings:
|
|||||||
GriefDefender: false
|
GriefDefender: false
|
||||||
## Respect UltimateClaims areas (https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65)
|
## Respect UltimateClaims areas (https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65)
|
||||||
UltimateClaims: false
|
UltimateClaims: false
|
||||||
|
## Respect Pueblos regions (https://www.spigotmc.org/resources/pueblos.91255/) (My Favorite :D)
|
||||||
|
Pueblos: false
|
||||||
|
## Respect SaberFactions areas (https://www.spigotmc.org/resources/saberfactions.69771/)
|
||||||
|
SaberFactions: false
|
||||||
|
|
||||||
## Output to console some debugging info
|
## Output to console some debugging info
|
||||||
Debugger: false
|
Debugger: false
|
||||||
|
|||||||
Reference in new issue
Block a user