Skip to content

Commit

Permalink
Update GD Parties hook. (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodmc committed Aug 4, 2023
1 parent 86f467b commit ff35981
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 56 deletions.
28 changes: 3 additions & 25 deletions bukkit/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,10 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.bloodmc</groupId>
<artifactId>GriefDefenderApi</artifactId>
<version>920a610</version>
<groupId>com.griefdefender</groupId>
<artifactId>api</artifactId>
<version>2.1.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>event-method-asm</artifactId>
<groupId>*</groupId>
</exclusion>
<exclusion>
<artifactId>event-api</artifactId>
<groupId>*</groupId>
</exclusion>
<exclusion>
<artifactId>text-api</artifactId>
<groupId>*</groupId>
</exclusion>
<exclusion>
<artifactId>guice</artifactId>
<groupId>*</groupId>
</exclusion>
<exclusion>
<artifactId>jsr305</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.elmakers.mine.bukkit</groupId>
Expand Down
28 changes: 3 additions & 25 deletions bukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,32 +158,10 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.bloodmc</groupId>
<artifactId>GriefDefenderApi</artifactId>
<version>920a610</version>
<groupId>com.griefdefender</groupId>
<artifactId>api</artifactId>
<version>2.1.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>event-method-asm</artifactId>
</exclusion>
<exclusion>
<groupId>*</groupId>
<artifactId>event-api</artifactId>
</exclusion>
<exclusion>
<groupId>*</groupId>
<artifactId>text-api</artifactId>
</exclusion>
<exclusion>
<groupId>*</groupId>
<artifactId>guice</artifactId>
</exclusion>
<exclusion>
<groupId>*</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.elmakers.mine.bukkit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.alessiodp.parties.bukkit.addons.external.ClaimHandler;
import com.alessiodp.parties.bukkit.configuration.data.BukkitConfigMain;
import com.alessiodp.parties.common.parties.objects.PartyImpl;
import com.flowpowered.math.vector.Vector3i;
import com.griefdefender.api.GriefDefender;
import com.griefdefender.api.claim.Claim;
import com.griefdefender.api.claim.TrustType;
Expand All @@ -15,21 +14,25 @@
public class GriefDefenderHook {

public static ClaimHandler.Result isManager(Player claimer) {
Vector3i vector = Vector3i.from(claimer.getLocation().getBlockX(), claimer.getLocation().getBlockY(), claimer.getLocation().getBlockZ());
Claim claim = GriefDefender.getCore().getClaimManager(claimer.getWorld().getUID()).getClaimAt(vector);
final Claim claim = GriefDefender.getCore().getClaimAt(claimer.getLocation());
if (claim == null) {
return ClaimHandler.Result.NOEXIST;
}
if (claim.isWilderness()) {
return ClaimHandler.Result.NOEXIST;
}
if (!claim.getOwnerName().equalsIgnoreCase(claimer.getName())
if (!claimer.getUniqueId().equals(claim.getOwnerUniqueId())
&& (BukkitConfigMain.ADDONS_CLAIM_NEEDOWNER || !claim.getUserTrusts(TrustTypes.MANAGER).contains(claimer.getUniqueId()))) {
return ClaimHandler.Result.NOMANAGER;
}
return ClaimHandler.Result.SUCCESS;
}

public static void addPartyPermission(Player claimer, PartyImpl party, ClaimHandler.PermissionType perm) {
Vector3i vector = Vector3i.from(claimer.getLocation().getBlockX(), claimer.getLocation().getBlockY(), claimer.getLocation().getBlockZ());
Claim claim = GriefDefender.getCore().getClaimManager(claimer.getWorld().getUID()).getClaimAt(vector);
final Claim claim = GriefDefender.getCore().getClaimAt(claimer.getLocation());
if (claim == null) {
return;
}
for (UUID uuid : party.getMembers()) {
if (claimer.getUniqueId().equals(uuid))
continue;
Expand Down

0 comments on commit ff35981

Please sign in to comment.