Update for 1.4.3 release.

* Fix claim default permission lookups.
* (Sponge) Fix collide-block listener not cancelling event.
This commit is contained in:
bloodshot 2020-06-25 22:24:33 -04:00
parent 343dfe9566
commit 5c8354563c
5 changed files with 28 additions and 8 deletions

View File

@ -348,8 +348,13 @@ private Tristate getUserPermission(GDPermissionHolder holder, Claim claim, Strin
return value;
}
contexts.remove(claim.getContext());
return getFlagDefaultPermission(claim, permission, contexts);
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
contexts.remove(claim.getContext());
return getFlagDefaultPermission(claim, permission, contexts);
}
return getClaimFlagPermission(claim, permission, contexts, inheritParents);
}
private Tristate getClaimFlagPermission(Claim claim, String permission) {

View File

@ -3,5 +3,5 @@ main: com.griefdefender.GDBootstrap
softdepend: [dynmap, PlaceholderAPI, WorldEdit, WorldGuard, Vault]
depend: [LuckPerms]
load: STARTUP
version: '1.4.2'
version: '1.4.3'
api-version: 1.13

View File

@ -2,7 +2,7 @@
name=GriefDefender
group=com.griefdefender
url=https://github.com/bloodmc/GriefDefender
version=1.4.2
version=1.4.3
apiVersion=1.0.0-20200528.202302-24
# Bukkit
adapterVersion=1.16.1-20200625.044010-2

View File

@ -480,13 +480,22 @@ public void onBlockCollide(CollideBlockEvent event, @Root Entity source) {
targetClaim = this.dataStore.getClaimAt(event.getTargetLocation());
}
if (GDPermissionManager.getInstance().getFinalPermission(event, event.getTargetLocation(), targetClaim, Flags.COLLIDE_BLOCK, source, event.getTargetBlock(), user, TrustTypes.ACCESSOR, true) == Tristate.TRUE) {
entityBlockCache.setLastResult(Tristate.TRUE);
Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, event.getTargetLocation(), targetClaim, Flags.COLLIDE_BLOCK, source, event.getTargetBlock(), user, TrustTypes.ACCESSOR, true);
if (result != Tristate.UNDEFINED) {
if (result == Tristate.TRUE) {
entityBlockCache.setLastResult(Tristate.TRUE);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
return;
}
entityBlockCache.setLastResult(Tristate.FALSE);
event.setCancelled(true);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
return;
}
if (GDFlags.PORTAL_USE && event.getTargetBlock().getType() == BlockTypes.PORTAL) {
if (GDPermissionManager.getInstance().getFinalPermission(event, event.getTargetLocation(), targetClaim, Flags.PORTAL_USE, source, event.getTargetBlock(), user, TrustTypes.ACCESSOR, true) == Tristate.TRUE) {
entityBlockCache.setLastResult(Tristate.TRUE);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
return;
}
@ -505,6 +514,7 @@ public void onBlockCollide(CollideBlockEvent event, @Root Entity source) {
}
}
entityBlockCache.setLastResult(Tristate.TRUE);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
}

View File

@ -401,8 +401,13 @@ private Tristate getUserPermission(GDPermissionHolder holder, Claim claim, Strin
return value;
}
contexts.remove(claim.getContext());
return getFlagDefaultPermission(claim, permission, contexts);
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
contexts.remove(claim.getContext());
return getFlagDefaultPermission(claim, permission, contexts);
}
return getClaimFlagPermission(claim, permission, contexts, inheritParents);
}
private Tristate getClaimFlagPermission(Claim claim, String permission) {