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,10 +348,15 @@ private Tristate getUserPermission(GDPermissionHolder holder, Claim claim, Strin
return value; return value;
} }
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
contexts.remove(claim.getContext()); contexts.remove(claim.getContext());
return getFlagDefaultPermission(claim, permission, contexts); return getFlagDefaultPermission(claim, permission, contexts);
} }
return getClaimFlagPermission(claim, permission, contexts, inheritParents);
}
private Tristate getClaimFlagPermission(Claim claim, String permission) { private Tristate getClaimFlagPermission(Claim claim, String permission) {
return this.getClaimFlagPermission(claim, permission, new HashSet<>(), null); return this.getClaimFlagPermission(claim, permission, new HashSet<>(), null);
} }

View File

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

View File

@ -2,7 +2,7 @@
name=GriefDefender name=GriefDefender
group=com.griefdefender group=com.griefdefender
url=https://github.com/bloodmc/GriefDefender url=https://github.com/bloodmc/GriefDefender
version=1.4.2 version=1.4.3
apiVersion=1.0.0-20200528.202302-24 apiVersion=1.0.0-20200528.202302-24
# Bukkit # Bukkit
adapterVersion=1.16.1-20200625.044010-2 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()); 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) { 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); entityBlockCache.setLastResult(Tristate.TRUE);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync(); GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
return; return;
} }
entityBlockCache.setLastResult(Tristate.FALSE);
event.setCancelled(true);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
return;
}
if (GDFlags.PORTAL_USE && event.getTargetBlock().getType() == BlockTypes.PORTAL) { 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) { 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(); GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
return; return;
} }
@ -505,6 +514,7 @@ public void onBlockCollide(CollideBlockEvent event, @Root Entity source) {
} }
} }
entityBlockCache.setLastResult(Tristate.TRUE);
GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync(); GDTimings.BLOCK_COLLIDE_EVENT.stopTimingIfSync();
} }

View File

@ -401,10 +401,15 @@ private Tristate getUserPermission(GDPermissionHolder holder, Claim claim, Strin
return value; return value;
} }
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
contexts.remove(claim.getContext()); contexts.remove(claim.getContext());
return getFlagDefaultPermission(claim, permission, contexts); return getFlagDefaultPermission(claim, permission, contexts);
} }
return getClaimFlagPermission(claim, permission, contexts, inheritParents);
}
private Tristate getClaimFlagPermission(Claim claim, String permission) { private Tristate getClaimFlagPermission(Claim claim, String permission) {
return this.getClaimFlagPermission(claim, permission, new HashSet<>(), null); return this.getClaimFlagPermission(claim, permission, new HashSet<>(), null);
} }