Search in sources :

Example 1 with IslandLogsGUI

use of com.iridium.iridiumskyblock.gui.IslandLogsGUI in project IridiumSkyblock by Iridium-Development.

the class LogsCommand method execute.

/**
 * Executes the command for the specified {@link CommandSender} with the provided arguments.
 * Not called when the command execution was invalid (no permission, no player or command disabled).
 *
 * @param sender The CommandSender which executes this command
 * @param args   The arguments used with this command. They contain the sub-command
 */
@Override
public boolean execute(CommandSender sender, String[] args) {
    Player player = (Player) sender;
    User user = IridiumSkyblock.getInstance().getUserManager().getUser(player);
    Optional<Island> island = user.getIsland();
    if (!island.isPresent()) {
        player.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().noIsland.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
        return false;
    }
    player.openInventory(new IslandLogsGUI(island.get(), player.getOpenInventory().getTopInventory()).getInventory());
    return true;
}
Also used : Player(org.bukkit.entity.Player) User(com.iridium.iridiumskyblock.database.User) Island(com.iridium.iridiumskyblock.database.Island) IslandLogsGUI(com.iridium.iridiumskyblock.gui.IslandLogsGUI)

Aggregations

Island (com.iridium.iridiumskyblock.database.Island)1 User (com.iridium.iridiumskyblock.database.User)1 IslandLogsGUI (com.iridium.iridiumskyblock.gui.IslandLogsGUI)1 Player (org.bukkit.entity.Player)1