Added support for Lands

This commit is contained in:
OmerBenGera 2022-06-03 11:17:38 +03:00
parent 4e14b4f1e2
commit 7d14d1d7e2
4 changed files with 45 additions and 0 deletions

13
Hook_Lands/build.gradle Normal file
View File

@ -0,0 +1,13 @@
group 'Hook_Lands'
dependencies {
compileOnly 'me.angeschossen:Lands:latest'
compileOnly "org.spigotmc:v1_8_R3-Taco:latest"
compileOnly project(":API")
compileOnly parent
}
if (project.hasProperty('hook.compile_lands') &&
!Boolean.valueOf(project.findProperty("hook.compile_lands").toString())) {
project.tasks.all { task -> task.enabled = false }
}

View File

@ -0,0 +1,27 @@
package com.bgsoftware.wildloaders.hooks;
import com.bgsoftware.wildloaders.WildLoadersPlugin;
import com.bgsoftware.wildloaders.api.hooks.ClaimsProvider;
import me.angeschossen.lands.api.integration.LandsIntegration;
import me.angeschossen.lands.api.land.Land;
import me.angeschossen.lands.api.role.enums.RoleSetting;
import org.bukkit.Chunk;
import java.util.UUID;
public final class ClaimsProvider_Lands implements ClaimsProvider {
private final LandsIntegration landsIntegration;
public ClaimsProvider_Lands(WildLoadersPlugin plugin) {
landsIntegration = new LandsIntegration(plugin, false);
landsIntegration.initialize();
}
@Override
public boolean hasClaimAccess(UUID player, Chunk chunk) {
Land land = landsIntegration.getLand(chunk.getWorld(), chunk.getX(), chunk.getZ());
return land == null || land.canSetting(player, RoleSetting.BLOCK_PLACE);
}
}

View File

@ -14,4 +14,5 @@ include 'v1_17_R1'
include 'v1_18_R1'
include 'Hook_EpicSpawners7'
include 'v1_18_R2'
include 'Hook_Lands'

View File

@ -50,6 +50,10 @@ public final class ProvidersHandler implements ProvidersManager {
Optional<ClaimsProvider> claimsProvider = createInstance("ClaimsProvider_SuperiorSkyblock");
claimsProvider.ifPresent(this::addClaimsProvider);
}
if (Bukkit.getPluginManager().isPluginEnabled("Lands")) {
Optional<ClaimsProvider> claimsProvider = createInstance("ClaimsProvider_Lands");
claimsProvider.ifPresent(this::addClaimsProvider);
}
}
private void loadTickableProviders() {