Fix container trust.

* Fix public/admin usernames not displaying properly after restart.
* Fix block collision debug spam.
This commit is contained in:
bloodshot 2019-07-28 12:41:26 -04:00
parent af5fade803
commit d23e070e68
3 changed files with 16 additions and 11 deletions

View File

@ -511,7 +511,7 @@ public void onPlayerBucketEvent(PlayerBucketEvent event) {
final GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
final Location location = clickedBlock.getLocation();
final GDClaim claim = this.dataStore.getClaimAt(location);
final TrustType trustType = NMSUtil.getInstance().isBlockContainer(clickedBlock) ? TrustTypes.CONTAINER : TrustTypes.ACCESSOR;
final TrustType trustType = NMSUtil.getInstance().hasBlockTileEntity(location) ? TrustTypes.CONTAINER : TrustTypes.ACCESSOR;
Tristate result = GDPermissionManager.getInstance().getFinalPermission(event, location, claim, GDPermissions.INTERACT_BLOCK_SECONDARY, source, clickedBlock, player, trustType, true);
if (result == Tristate.FALSE) {
@ -610,8 +610,7 @@ public void onPlayerInteractBlockSecondary(PlayerInteractEvent event) {
return;
}
final GDClaim claim = this.dataStore.getClaimAt(location);
//GriefDefender.getPermissionManager().getFinalPermission(claim, Flags.ENTITY_SPAWN, source, target, user)
final TrustType trustType = NMSUtil.getInstance().isBlockContainer(clickedBlock) ? TrustTypes.CONTAINER : event.hasBlock() ? TrustTypes.BUILDER : TrustTypes.ACCESSOR;
final TrustType trustType = NMSUtil.getInstance().hasBlockTileEntity(clickedBlock.getLocation()) ? TrustTypes.CONTAINER : event.hasBlock() && event.getAction() != Action.PHYSICAL ? TrustTypes.BUILDER : TrustTypes.ACCESSOR;
if (GDFlags.INTERACT_BLOCK_SECONDARY && playerData != null) {
String permission = GDPermissions.INTERACT_BLOCK_SECONDARY;
if (event.getAction() == Action.PHYSICAL) {
@ -634,7 +633,13 @@ public void onPlayerInteractBlockSecondary(PlayerInteractEvent event) {
// Don't send a deny message if the player is holding an investigation tool
if (NMSUtil.getInstance().getRunningServerTicks() != lastInteractItemSecondaryTick || lastInteractItemCancelled != true) {
if (!NMSUtil.getInstance().hasItemInOneHand(player, GriefDefenderPlugin.getInstance().investigationTool)) {
this.sendInteractBlockDenyMessage(itemInHand, clickedBlock, claim, player, playerData);
if (event.getAction() == Action.PHYSICAL) {
if (player.getWorld().getTime() % 100 == 0L) {
this.sendInteractBlockDenyMessage(itemInHand, clickedBlock, claim, player, playerData);
}
} else {
this.sendInteractBlockDenyMessage(itemInHand, clickedBlock, claim, player, playerData);
}
}
}

View File

@ -387,12 +387,12 @@ public Tristate processResult(Claim claim, String permission, Tristate permissio
public Tristate processResult(Claim claim, String permission, String trust, Tristate permissionValue, GDPermissionHolder permissionHolder) {
if (GriefDefenderPlugin.debugActive) {
if (this.currentEvent != null && (this.currentEvent instanceof BlockPhysicsEvent)) {
/*if (claim.getWorld().getProperties().getTotalTime() % 100 == 0L) {
GriefDefenderPlugin.addEventLogEntry(this.currentEvent, claim, this.eventLocation, this.eventSubject, this.eventSourceId, this.eventTargetId, permissionSubject, permission, trust, permissionValue);
}*/
} else {
GriefDefenderPlugin.addEventLogEntry(this.currentEvent, this.eventLocation, this.eventSourceId, this.eventTargetId, this.eventSubject == null ? permissionHolder : this.eventSubject, permission, trust, permissionValue);
if (((GDClaim) claim).getWorld().getTime() % 100 != 0L) {
return permissionValue;
}
}
GriefDefenderPlugin.addEventLogEntry(this.currentEvent, this.eventLocation, this.eventSourceId, this.eventTargetId, this.eventSubject == null ? permissionHolder : this.eventSubject, permission, trust, permissionValue);
}
return permissionValue;

View File

@ -99,10 +99,10 @@ public String lookupPlayerName(String uuid) {
@Nullable
public String getUserName(UUID uuid) {
if (uuid == GriefDefenderPlugin.PUBLIC_UUID) {
if (uuid.equals(GriefDefenderPlugin.PUBLIC_UUID)) {
return "public";
}
if (uuid == GriefDefenderPlugin.ADMIN_USER_UUID || uuid == GriefDefenderPlugin.WORLD_USER_UUID) {
if (uuid.equals(GriefDefenderPlugin.ADMIN_USER_UUID) || uuid.equals(GriefDefenderPlugin.WORLD_USER_UUID)) {
return "administrator";
}