From 669d0500fe042b256da75013840d4eeb6dc050ae Mon Sep 17 00:00:00 2001 From: TreemanKing <67459602+TreemanKing@users.noreply.github.com> Date: Sun, 12 May 2024 22:35:21 +1000 Subject: [PATCH] fix: Permission Tag (#418) --- .../core/tags/activation/PermissionTag.java | 10 +++++----- lang/src/main/resources/lang/en_GB.lang | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/sekwah/advancedportals/core/tags/activation/PermissionTag.java b/core/src/main/java/com/sekwah/advancedportals/core/tags/activation/PermissionTag.java index cd1c697e..82a14057 100644 --- a/core/src/main/java/com/sekwah/advancedportals/core/tags/activation/PermissionTag.java +++ b/core/src/main/java/com/sekwah/advancedportals/core/tags/activation/PermissionTag.java @@ -55,11 +55,11 @@ public String description() { @Override public boolean preActivated(TagTarget target, PlayerContainer player, ActivationData activeData, String[] argData) { - if (target instanceof AdvancedPortal portal) { - var portalName = portal.getName(); - if (!player.hasPermission(argData[0])) return false; - } - return false; + if (!player.hasPermission(argData[1])) { + player.sendMessage(Lang.translate("portal.error.nopermission")); + return false; + } + return true; } @Override diff --git a/lang/src/main/resources/lang/en_GB.lang b/lang/src/main/resources/lang/en_GB.lang index 76da36e1..125f5e48 100644 --- a/lang/src/main/resources/lang/en_GB.lang +++ b/lang/src/main/resources/lang/en_GB.lang @@ -126,6 +126,7 @@ portal.error.takenname= The name given for the portal is already taken. portal.error.selection.differentworlds= Both the selected points need to be in the same world. portal.error.selection.missing= You need to select both points for the portal. portal.error.save= There was a problem saving the portal. +portal.error.nopermission=You don't have permission to use that portal. portal.nobuild= You don't have permission to build here!