3.1.0 release (UltimateClaims support)

This commit is contained in:
SuperRonanCraft 2021-04-03 15:44:31 -04:00
parent 4ea6869abb
commit bec400943a
8 changed files with 53 additions and 8 deletions

View File

@ -255,6 +255,13 @@
<version>920a610</version>
<scope>provided</scope>
</dependency>
<!-- UltimateClaims (https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65) -->
<dependency>
<groupId>com.github.songoda</groupId>
<artifactId>ultimateclaims</artifactId>
<version>012e53d</version>
<scope>provided</scope>
</dependency>
<!-- Particles Library -->
<dependency>
<groupId>xyz.xenondevs</groupId>

View File

@ -124,7 +124,7 @@ public class RTP {
public void loadWorldLocations() {
FileBasics.FILETYPE config = FileBasics.FILETYPE.LOCATIONS;
worldLocations.clear();
if (!config.getBoolean("Settings.Enabled"))
if (!config.getBoolean("Enabled"))
return;
List<Map<?, ?>> map = config.getMapList("Locations");
for (Map<?, ?> m : map)

View File

@ -14,6 +14,7 @@ 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 com.songoda.ultimateclaims.UltimateClaims;
import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.angeschossen.lands.api.integration.LandsIntegration;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
@ -32,6 +33,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
boolean plugin_kingdomsx = getKingdomsx(loc);
boolean plugin_hClaims = gethClaims(loc);
boolean plugin_griefDefender = getGriefDefender(loc);
boolean plugin_ultimateClaims = getUltimateClaims(loc);
return plugin_worldguard
&& plugin_griefPrevention
&& plugin_towny
@ -41,7 +43,8 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
&& plugin_residence
&& plugin_kingdomsx
&& plugin_hClaims
&& plugin_griefDefender;
&& plugin_griefDefender
&& plugin_ultimateClaims;
}
// TESTED (v2.12.3)
@ -186,14 +189,29 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
if (getPl().getSettings().getsDepends().isGriefDefender())
try {
for (Claim claim : GriefDefender.getCore().getAllClaims())
if (claim.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
return false;
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 (getPl().getSettings().getsDepends().isUltimateClaims())
try {
result = UltimateClaims.getInstance().getClaimManager().getClaim(loc.getChunk()) == null;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private BetterRTP getPl() {
return BetterRTP.getInstance();

View File

@ -64,7 +64,8 @@ public class LangFile {
"du.yml", //Dutch
"es.yml", //Spanish
"cs.yml", //Czech
"pl.yml" //Polish
"pl.yml", //Polish
"it.yml" //Italian
};
private void generateDefaults() {

View File

@ -18,6 +18,7 @@ public class SoftDepends {
private boolean respect_kingdomsx = false;
private boolean respect_hClaims = false;
private boolean respect_griefDefender = false;
private boolean respect_ultimateClaims = false;
//RETURNABLES
private boolean worldguard = false;
private boolean griefprevention = false;
@ -29,6 +30,7 @@ public class SoftDepends {
private boolean kingdomsx = false;
private boolean hClaims = false;
private boolean griefDefender = false;
private boolean ultimateClaims = false;
public boolean isWorldguard() {
return worldguard;
@ -70,6 +72,10 @@ public class SoftDepends {
return griefDefender;
}
public boolean isUltimateClaims() {
return ultimateClaims;
}
void load() {
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
String pre = "Settings.Respect.";
@ -83,6 +89,7 @@ public class SoftDepends {
respect_kingdomsx = config.getBoolean( pre + "KingdomsX");
respect_hClaims = config.getBoolean( pre + "hClaims");
respect_griefDefender = config.getBoolean( pre + "GriefDefender");
respect_ultimateClaims = config.getBoolean( pre + "UltimateClaims");
registerWorldguard();
registerGriefPrevention();
registerTowny();
@ -93,6 +100,7 @@ public class SoftDepends {
registerKingdomsX();
registerClaimAPIPandomim();
registerGriefDefender();
registerUltimateClaims();
}
public void registerWorldguard() {
@ -155,6 +163,12 @@ public class SoftDepends {
debug("Respecting `GriefDefender` was " + (griefDefender ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerUltimateClaims() {
ultimateClaims = respect_ultimateClaims && Bukkit.getPluginManager().isPluginEnabled("UltimateClaims");
if (respect_ultimateClaims)
debug("Respecting `UltimateClaims` was " + (ultimateClaims ? "SUCCESSFULLY" : "NOT") + " registered");
}
private void debug(String str) {
if (BetterRTP.getInstance().getSettings().debug)
BetterRTP.getInstance().getLogger().log(Level.INFO, str);

View File

@ -25,6 +25,9 @@ Settings:
hClaims: false
## Respect GriefDefender areas (https://www.spigotmc.org/resources/griefdefender.68900/)
GriefDefender: false
## Respect UltimateClaims areas (https://songoda.com/marketplace/product/ultimateclaims-the-ultimate-claiming-plugin.65)
UltimateClaims: false
## Output to console some debugging info
Debugger: false
## Amount of chunks to preload around a safe location

View File

@ -6,8 +6,9 @@
# CenterY: 150
# MaxRadius: 100
# MinRadius: 5
Settings:
Enabled: false
Enabled: false
Locations:
- main_loc:
World: world

View File

@ -1,5 +1,5 @@
main: me.SuperRonanCraft.BetterRTP.BetterRTP
version: '3.1.0'
version: '3.1.1'
name: BetterRTP
author: SuperRonanCraft
softdepend:
@ -15,6 +15,7 @@ softdepend:
- Kingdoms
- hClaims
- GriefDefender
- UltimateClaims
api-version: '1.13'
commands: