Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento authored Sep 1, 2024
2 parents 6de62ae + 8de7019 commit 57e4770
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/main/java/world/bentobox/islandfly/FlyToggleCommand.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package world.bentobox.islandfly;

import java.util.List;

import org.bukkit.entity.Player;

import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.util.Util;
import world.bentobox.islandfly.config.Settings;

import java.util.List;


/**
* This command allows to enable and disable fly mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FlyListener implements Listener {
/**
* Addon instance object.
*/
private final IslandFlyAddon addon;
private final IslandFlyAddon islandFlyAddon;


/**
Expand Down Expand Up @@ -61,7 +61,7 @@ public void onToggleFlight(final PlayerToggleFlightEvent event) {
* @return true if fly was blocked
*/
private boolean checkUser(User user) {
String permPrefix = addon.getPlugin().getIWM().getPermissionPrefix(user.getWorld());
String permPrefix = islandFlyAddon.getPlugin().getIWM().getPermissionPrefix(user.getWorld());
// Ignore ops
if (user.isOp() || user.getPlayer().getGameMode().equals(GameMode.CREATIVE)
|| user.getPlayer().getGameMode().equals(GameMode.SPECTATOR)
Expand All @@ -78,7 +78,7 @@ public void onEnterIsland(final IslandEnterEvent event) {
user.getPlayer().setFlying(mdv.asBoolean());
});
// Wait until after arriving at the island
Bukkit.getScheduler().runTask(this.addon.getPlugin(), () -> checkUser(user));
Bukkit.getScheduler().runTask(this.islandFlyAddon.getPlugin(), () -> checkUser(user));
}

/**
Expand All @@ -88,15 +88,15 @@ public void onEnterIsland(final IslandEnterEvent event) {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onExitIsland(final IslandExitEvent event) {
final User user = User.getInstance(event.getPlayerUUID());
String permPrefix = addon.getPlugin().getIWM().getPermissionPrefix(user.getWorld());
String permPrefix = islandFlyAddon.getPlugin().getIWM().getPermissionPrefix(user.getWorld());
// Ignore ops
if (user.isOp() || user.getPlayer().getGameMode().equals(GameMode.CREATIVE)
|| user.getPlayer().getGameMode().equals(GameMode.SPECTATOR)
|| user.hasPermission(permPrefix + "island.flybypass")
|| (!user.hasPermission(permPrefix + "island.fly")
&& !user.hasPermission(permPrefix + "island.flyspawn"))) return;
// Alert player fly will be disabled
final int flyTimeout = this.addon.getSettings().getFlyTimeout();
final int flyTimeout = this.islandFlyAddon.getSettings().getFlyTimeout();

// If timeout is 0 or less disable fly immediately
if (flyTimeout <= 0) {
Expand Down

0 comments on commit 57e4770

Please sign in to comment.