From be82279540c197cbc8f58d8fa8476e22fbff034e Mon Sep 17 00:00:00 2001 From: Jules Date: Sun, 25 Jun 2023 02:22:50 +0200 Subject: [PATCH] Permission to skip waypoint waiting time --- .../java/net/Indyuce/mmocore/api/player/PlayerData.java | 7 ++++--- MMOCore-Dist/src/main/resources/plugin.yml | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 291b0c6f..642da37d 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -353,7 +353,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD /** * @return If the item is unlocked by the player - * This is used for skills that can be locked & unlocked. + * This is used for skills that can be locked & unlocked. */ public boolean hasUnlocked(Unlockable unlockable) { return unlockable.isUnlockedByDefault() || unlockedItems.contains(unlockable.getUnlockNamespacedKey()); @@ -747,6 +747,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD final int y = getPlayer().getLocation().getBlockY(); final int z = getPlayer().getLocation().getBlockZ(); final int warpTime = target.getWarpTime(); + final boolean hasPerm = getPlayer().hasPermission("mmocore.bypass-waypoint-wait"); int t; public void run() { @@ -759,7 +760,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD } MMOCore.plugin.configManager.getSimpleMessage("warping-comencing", "left", String.valueOf((warpTime - t) / 20)).send(getPlayer()); - if (t++ >= warpTime) { + if (hasPerm || t++ >= warpTime) { getPlayer().teleport(target.getLocation()); getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20, 1, false, false)); MMOCore.plugin.soundManager.getSound(SoundEvent.WARP_TELEPORT).playTo(getPlayer()); @@ -1191,7 +1192,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD * checks if they could potentially upgrade to one of these * * @return If the player can change its current class to - * a subclass + * a subclass */ @Deprecated public boolean canChooseSubclass() { diff --git a/MMOCore-Dist/src/main/resources/plugin.yml b/MMOCore-Dist/src/main/resources/plugin.yml index 73f9f2c2..15f9782a 100644 --- a/MMOCore-Dist/src/main/resources/plugin.yml +++ b/MMOCore-Dist/src/main/resources/plugin.yml @@ -24,6 +24,9 @@ permissions: mmocore.currency: description: Access to /deposit and /withdraw default: op + mmocore.bypass-waypoint-wait: + description: Bypass waypoint waiting time + default: op mmocore.class-select: description: Access to /class default: op