mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-22 10:36:00 +01:00
Use recent GD API (#51)
This commit is contained in:
parent
61c32c5995
commit
c30af21608
@ -12,15 +12,15 @@
|
||||
<artifactId>griefdefender</artifactId>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
<id>gdapi</id>
|
||||
<url>https://repo.glaremasters.me/repository/bloodshot</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.bloodmc</groupId>
|
||||
<artifactId>GriefDefenderAPI</artifactId>
|
||||
<version>-dd5aa2224c-1</version>
|
||||
<groupId>com.griefdefender</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>2.1.0-20220122.032038-5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.themoep.randomteleport.hook.plugin;
|
||||
|
||||
import com.griefdefender.api.GriefDefender;
|
||||
import com.griefdefender.api.claim.ClaimManager;
|
||||
import com.griefdefender.api.claim.ClaimTypes;
|
||||
import de.themoep.randomteleport.hook.ProtectionHook;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -23,13 +24,22 @@ public class GriefDefenderHook implements ProtectionHook {
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player player, Location location) {
|
||||
return GriefDefender.getCore().getClaimManager(location.getWorld().getUID()).getClaimAt(location.getBlockX(), location.getBlockY(), location.getBlockZ()).getType() == ClaimTypes.WILDERNESS;
|
||||
return canBuild(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBuild(Player player, World world, int chunkX, int chunkZ) {
|
||||
return canBuild(world, chunkX * 16, world.getSeaLevel(), chunkZ * 16);
|
||||
}
|
||||
|
||||
private boolean canBuild(World world, int x, int y, int z) {
|
||||
if (GriefDefender.getCore().isEnabled(world.getUID())) {
|
||||
return GriefDefender.getCore().getClaimManager(world.getUID()).getClaimAt(chunkX,0,chunkZ).isTrusted(player.getUniqueId());
|
||||
ClaimManager claimManager = GriefDefender.getCore().getClaimManager(world.getUID());
|
||||
if (claimManager == null) {
|
||||
return true;
|
||||
} else {
|
||||
return claimManager.getClaimAt(x, y, z).getType() == ClaimTypes.WILDERNESS;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user