mirror of
https://github.com/Phoenix616/RandomTeleport.git
synced 2024-11-25 20:15:55 +01:00
Use recent GD API (#51)
This commit is contained in:
parent
61c32c5995
commit
c30af21608
@ -12,15 +12,15 @@
|
|||||||
<artifactId>griefdefender</artifactId>
|
<artifactId>griefdefender</artifactId>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>gdapi</id>
|
||||||
<url>https://jitpack.io</url>
|
<url>https://repo.glaremasters.me/repository/bloodshot</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.bloodmc</groupId>
|
<groupId>com.griefdefender</groupId>
|
||||||
<artifactId>GriefDefenderAPI</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>-dd5aa2224c-1</version>
|
<version>2.1.0-20220122.032038-5</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package de.themoep.randomteleport.hook.plugin;
|
package de.themoep.randomteleport.hook.plugin;
|
||||||
|
|
||||||
import com.griefdefender.api.GriefDefender;
|
import com.griefdefender.api.GriefDefender;
|
||||||
|
import com.griefdefender.api.claim.ClaimManager;
|
||||||
import com.griefdefender.api.claim.ClaimTypes;
|
import com.griefdefender.api.claim.ClaimTypes;
|
||||||
import de.themoep.randomteleport.hook.ProtectionHook;
|
import de.themoep.randomteleport.hook.ProtectionHook;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -23,13 +24,22 @@ public class GriefDefenderHook implements ProtectionHook {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBuild(Player player, Location location) {
|
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
|
@Override
|
||||||
public boolean canBuild(Player player, World world, int chunkX, int chunkZ) {
|
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())) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user