Skip to content

Commit

Permalink
Fix for bypass permission
Browse files Browse the repository at this point in the history
  • Loading branch information
samolego committed Feb 19, 2022
1 parent 7da70dc commit 6d79f58
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,12 @@ public TaterzenNPC getNpc() {

@Override
public boolean selectNpc(@Nullable TaterzenNPC npc) {
if (
npc != null && !npc.canEdit(this.player) &&
Taterzens.getInstance().getPlatform().checkPermission(
this.player.createCommandSourceStack(), "taterzens.npc.select.bypass", config.perms.selectBypassLevel
)
) {
if (npc != null && !npc.allowEditBy(this.player) &&
!Taterzens.getInstance().getPlatform().checkPermission(
this.player.createCommandSourceStack(), "taterzens.npc.select.bypass", config.perms.selectBypassLevel)) {
return false;
}

TaterzenNPC selectedNpc = this.taterzens$selectedNpc;
this.taterzens$selectedNpc = npc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1741,16 +1741,16 @@ public boolean causeFallDamage(float fallDistance, float multiplier, DamageSourc
* @param entity entity to check.
* @return true if taterzen can be edited by entity, otherwise false.
*/
public boolean canEdit(Entity entity) {
return this.canEdit(entity.getUUID());
public boolean allowEditBy(Entity entity) {
return this.allowEditBy(entity.getUUID());
}

/**
* Whether taterzen should be allowed to be edited by provided uuid.
* @param uuid uuid to check.
* @return true if taterzen can be edited by provided uuid, otherwise false.
*/
public boolean canEdit(UUID uuid) {
public boolean allowEditBy(UUID uuid) {
return this.lockedUuid == null || this.lockedUuid.equals(uuid) || this.getUUID().equals(uuid);
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fabric_version=0.45.1+1.18
forge_version=39.0.10

# Mod Properties
mod_version = 1.8.3
mod_version = 1.8.4
maven_group = org.samo_lego
archives_base_name = taterzens

Expand Down

0 comments on commit 6d79f58

Please sign in to comment.