mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 14:38:53 +00:00
Tweak permission registration
This commit is contained in:
19 files changed
+84
-253
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package net.william278.huskhomes.teleport;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.command.BackCommand;
|
||||
import net.william278.huskhomes.config.Settings;
|
||||
import net.william278.huskhomes.event.ITeleportEvent;
|
||||
import net.william278.huskhomes.hook.EconomyHook;
|
||||
@@ -22,21 +23,23 @@ public class Teleport {
|
||||
protected final Teleportable teleporter;
|
||||
protected final Target target;
|
||||
protected final Type type;
|
||||
protected final boolean updateLastPosition;
|
||||
protected final List<EconomyHook.Action> economyActions;
|
||||
private final boolean async;
|
||||
protected final boolean updateLastPosition;
|
||||
|
||||
protected Teleport(@NotNull OnlineUser executor, @NotNull Teleportable teleporter, @NotNull Target target,
|
||||
@NotNull Type type, boolean updateLastPosition, @NotNull List<EconomyHook.Action> actions,
|
||||
@NotNull HuskHomes plugin) {
|
||||
this.plugin = plugin;
|
||||
this.executor = executor;
|
||||
this.teleporter = teleporter;
|
||||
this.target = target;
|
||||
this.type = type;
|
||||
this.updateLastPosition = updateLastPosition;
|
||||
this.economyActions = actions;
|
||||
this.async = plugin.getSettings().isAsynchronousTeleports();
|
||||
this.plugin = plugin;
|
||||
this.updateLastPosition = updateLastPosition && plugin.getCommand(BackCommand.class)
|
||||
.map(command -> executor.hasPermission(command.getPermission()))
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.william278.huskhomes.config.Settings;
|
||||
import net.william278.huskhomes.hook.EconomyHook;
|
||||
import net.william278.huskhomes.position.Position;
|
||||
import net.william278.huskhomes.user.OnlineUser;
|
||||
import net.william278.huskhomes.util.Permission;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -14,6 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class TimedTeleport extends Teleport {
|
||||
|
||||
public static final String BYPASS_PERMISSION = "huskhomes.bypass_teleport_warmup";
|
||||
private final OnlineUser teleporter;
|
||||
private final Position startLocation;
|
||||
private final double startHealth;
|
||||
@@ -32,7 +32,7 @@ public class TimedTeleport extends Teleport {
|
||||
@Override
|
||||
public void execute() throws TeleportationException {
|
||||
// Check if the teleporter can bypass warmup
|
||||
if (timeLeft == 0 || teleporter.hasPermission(Permission.BYPASS_TELEPORT_WARMUP.node)) {
|
||||
if (timeLeft == 0 || teleporter.hasPermission(BYPASS_PERMISSION)) {
|
||||
super.execute();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user