Hub / src / main / java / com / lifeknight / relaymchub / player / HubGameSettings.java
HubGameSettings.java
Raw
package com.lifeknight.relaymchub.player;

import com.lifeknight.relaymcutils.player.SmartGUI;
import com.lifeknight.relaymcutils.player.settings.GameSettings;
import com.lifeknight.relayutils.player.Group;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

public class HubGameSettings extends GameSettings {
    public SmartGUI getGUI(Group highest, SmartGUI back) {
        SmartGUI smartGUI = super.getGUI(highest);


        for (int i = 39; i < 44; i++) {
            try {
                smartGUI.getGui().setItem(i, new ItemStack(Material.LIGHT_GRAY_STAINED_GLASS_PANE));
            } catch (Exception ignored) {

            }
        }
        smartGUI.add(0, Material.ARROW, (player, b, b1) -> back.open(player), ChatColor.RED + "Back");
        return smartGUI;
    }


    @Override
    protected int calculatePosition(int rowLength, int index, int totalSize, boolean sections) {
        int rowIndex = index / rowLength;
        int positionInRow = index % rowLength;

        return (rowIndex + 1) * 9 + 1 + positionInRow;
    }
}