Run residence permission playerHas check on main thread

This commit is contained in:
dordsor21 2021-07-18 13:18:55 +01:00
parent 275ba9bd84
commit e6b18cf230
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -5,6 +5,7 @@ import com.bekvon.bukkit.residence.protection.ClaimedResidence;
import com.bekvon.bukkit.residence.protection.CuboidArea; import com.bekvon.bukkit.residence.protection.CuboidArea;
import com.fastasyncworldedit.bukkit.FaweBukkit; import com.fastasyncworldedit.bukkit.FaweBukkit;
import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.regions.FaweMask;
import com.fastasyncworldedit.core.util.TaskManager;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.internal.util.LogManagerCompat;
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion;
@ -29,7 +30,10 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener {
} }
public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) { public boolean isAllowed(Player player, ClaimedResidence residence, MaskType type) {
return residence != null && (residence.getOwner().equals(player.getName()) || residence.getOwner().equals(player.getUniqueId().toString()) || type == MaskType.MEMBER && residence.getPermissions().playerHas(player, "build", false)); return residence != null &&
(residence.getOwner().equals(player.getName()) ||
residence.getOwner().equals(player.getUniqueId().toString()) ||
type == MaskType.MEMBER && TaskManager.IMP.sync(() -> residence.getPermissions().playerHas(player, "build", false)));
} }
@Override @Override