fix: Run GriefPrevention region check in sync (#1804)

* fix: Run GP check in sync

Fixes #1692

* refactor: Sync on last condition only
This commit is contained in:
Alexander Brandes 2022-06-15 13:37:08 +02:00 committed by GitHub
parent 1a3b0dc133
commit 5b2f8502fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
package com.fastasyncworldedit.bukkit.regions; package com.fastasyncworldedit.bukkit.regions;
import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.regions.FaweMask;
import com.fastasyncworldedit.core.util.TaskManager;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.BukkitWorld;
@ -28,8 +29,8 @@ public class GriefPreventionFeature extends BukkitMaskManager implements Listene
public boolean isAllowed(Player player, Claim claim, MaskType type) { public boolean isAllowed(Player player, Claim claim, MaskType type) {
return claim != null && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim return claim != null && (claim.getOwnerName().equalsIgnoreCase(player.getName()) || claim
.getOwnerName() .getOwnerName()
.equals(player.getUniqueId()) || .equals(player.getUniqueId()) || TaskManager.taskManager().sync(() -> type == MaskType.MEMBER &&
type == MaskType.MEMBER && claim.allowBuild(player, Material.AIR) == null); claim.allowBuild(player, Material.AIR) == null));
} }
@Override @Override