added hClaims support

This commit is contained in:
SuperRonanCraft 2021-03-28 11:55:34 -04:00
parent 7ecf1cd1a9
commit 5b5d18f2fe
6 changed files with 67 additions and 10 deletions

BIN
LocalJars/hClaims.jar Normal file

Binary file not shown.

23
pom.xml
View File

@ -37,6 +37,22 @@
<goal>install-file</goal>
</goals>
</execution>
<execution>
<id>hack-binary-2</id>
<phase>clean</phase>
<configuration>
<file>${basedir}/LocalJars/hClaims.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.hakan</groupId>
<artifactId>claimsystem</artifactId>
<version>1.1.1</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
@ -225,6 +241,13 @@
</exclusion>
</exclusions>
</dependency>
<!-- ClaimAPI for Pandomim on Discord -->
<dependency>
<groupId>com.hakan</groupId>
<artifactId>claimapi</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<!-- Particles Library -->
<dependency>
<groupId>xyz.xenondevs</groupId>

View File

@ -3,6 +3,7 @@ package me.SuperRonanCraft.BetterRTP.player.rtp;
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
import com.bekvon.bukkit.residence.Residence;
import com.bekvon.bukkit.residence.commands.set;
import com.hakan.claimsystem.api.ClaimAPI;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
@ -29,6 +30,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
boolean plugin_lands = getLands(loc);
boolean plugin_residence = getResidence(loc);
boolean plugin_kingdomsx = getKingdomsx(loc);
boolean plugin_claims_pandomim = getClaimAPIPandomim(loc);
return plugin_worldguard
&& plugin_griefPrevention
&& plugin_towny
@ -36,7 +38,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
&& plugin_factionsUUID
&& plugin_lands
&& plugin_residence
&& plugin_kingdomsx;
&& plugin_kingdomsx
&& plugin_claims_pandomim;
}
// TESTED (v2.12.3)
@ -159,6 +162,20 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
return result;
}
// NOT TESTED (3.0.5)
// hClaims (v1.1.1)
// https://github.com/pixelnw/claimapi (Local Repo)
private boolean getClaimAPIPandomim(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isClaimAPIPandomim())
try {
result = ClaimAPI.isClaimed(loc);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private BetterRTP getPl() {
return BetterRTP.getInstance();
}

View File

@ -16,6 +16,7 @@ public class SoftDepends {
private boolean respect_lands = false;
private boolean respect_residence = false;
private boolean respect_kingdomsx = false;
private boolean respect_claimAPIPandomim = false;
//RETURNABLES
private boolean worldguard = false;
private boolean griefprevention = false;
@ -25,6 +26,7 @@ public class SoftDepends {
private boolean lands = false;
private boolean residence = false;
private boolean kingdomsx = false;
private boolean claimAPIPandomim = false;
public boolean isWorldguard() {
return worldguard;
@ -58,17 +60,22 @@ public class SoftDepends {
return kingdomsx;
}
public boolean isClaimAPIPandomim() {
return claimAPIPandomim;
}
void load() {
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
String pre = "Settings.Respect.";
respect_worldguard = config.getBoolean( pre + "WorldGuard");
respect_griefprevention = config.getBoolean(pre + "GriefPrevention");
respect_griefprevention = config.getBoolean( pre + "GriefPrevention");
respect_towny = config.getBoolean( pre + "Towny");
respect_redProtect = config.getBoolean( pre + "RedProtect");
respect_factionsUUID = config.getBoolean( pre + "FactionsUUID");
respect_lands = config.getBoolean( pre + "Lands");
respect_residence = config.getBoolean( pre + "Residence");
respect_kingdomsx = config.getBoolean( pre + "KingdomsX");
respect_claimAPIPandomim = config.getBoolean( pre + "hClaims");
registerWorldguard();
registerGriefPrevention();
registerTowny();
@ -77,6 +84,7 @@ public class SoftDepends {
registerLands();
registerResidence();
registerKingdomsX();
registerClaimAPIPandomim();
}
public void registerWorldguard() {
@ -127,6 +135,12 @@ public class SoftDepends {
debug("Respecting `KingdomsX` was " + (kingdomsx ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerClaimAPIPandomim() {
claimAPIPandomim = respect_claimAPIPandomim && Bukkit.getPluginManager().isPluginEnabled("hClaim");
if (respect_claimAPIPandomim)
debug("Respecting `hClaims` was " + (claimAPIPandomim ? "SUCCESSFULLY" : "NOT") + " registered");
}
private void debug(String str) {
if (BetterRTP.getInstance().getSettings().debug)
BetterRTP.getInstance().getLogger().log(Level.INFO, str);

View File

@ -21,6 +21,8 @@ Settings:
Residence: false
## Respect KingdomsX areas (https://www.spigotmc.org/resources/kingdomsx.77670/)
KingdomsX: false
## Respect hClaims areas (https://github.com/pixelnw/claimapi)
hClaims: false
## Output to console some debugging info
Debugger: false
## Amount of chunks to preload around a safe location

View File

@ -13,11 +13,12 @@ softdepend:
- Residence
- ProtocolLib
- Kingdoms
- hClaims
api-version: '1.13'
commands:
betterrtp:
aliases: [brtp, rtp]
aliases: [brtp, rtp, randomtp]
description: Randomly teleport to a location
permissions: