<commit_before>package de.themoep.inventorygui;

/*
 * Copyright 2017 <NAME> (https://github.com/Phoenix616/)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Mozilla Public License as published by
 * the Mozilla Foundation, version 2.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Mozilla Public License v2.0 for more details.
 *
 * You should have received a copy of the Mozilla Public License v2.0
 * along with this program. If not, see <http://mozilla.org/MPL/2.0/>.
 */

import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;

/**
 * Represents an element in a gui
 */
public abstract class GuiElement {
    private final char slotChar;
    private Action action;
    protected int[] slots = new int[0];
    protected InventoryGui gui;

    /**
     * Represents an element in a gui
     * @param slotChar The character to replace in the gui setup string
     * @param action   The action to run when the player clicks on this element
     */
    public GuiElement(char slotChar, Action action) {
        this.slotChar = slotChar;
        setAction(action);
    }

    /**
     * Represents an element in a gui that doesn't have any action when clicked
     * @param slotChar  The character to replace in the gui setup string
     */
    public GuiElement(char slotChar) {
        this(slotChar, null);
    }

    /**
     * Get the character in the gui setup that corresponds with this element
     * @return  The character
     */
    public char getSlotChar() {
        return slotChar;
    }

    /**
     * Get the item that is displayed by this element on a certain page
     * @param slot  The slot to get the item for
     * @return      The ItemStack that is displayed as this element
     */
    public abstract ItemStack getItem(int slot);

    /**
     * Get the action that is executed when clicking on this element
     * @return      The action to run
     */
    public Action getAction() {
        return action;
    }

    /**
     * Set the action that is executed when clicking on this element
     * @param action    The action to run
     */
    public void setAction(Action action) {
        this.action = action;
    }

    /**
     * Set the ids of the slots where this element is assigned to
     * @param slots An array of the slot ids where this element is displayed
     */
    public void setSlots(int[] slots) {
        this.slots = slots;
    }
<commit_msg>Add getter for the slots array This gives us the ability to check things like total amount of available  slots for this element or manually modify the slots if necessary.<commit_after>package de.themoep.inventorygui;

/*
 * Copyright 2017 <NAME> (https://github.com/Phoenix616/)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Mozilla Public License as published by
 * the Mozilla Foundation, version 2.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * Mozilla Public License v2.0 for more details.
 *
 * You should have received a copy of the Mozilla Public License v2.0
 * along with this program. If not, see <http://mozilla.org/MPL/2.0/>.
 */

import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;

/**
 * Represents an element in a gui
 */
public abstract class GuiElement {
    private final char slotChar;
    private Action action;
    protected int[] slots = new int[0];
    protected InventoryGui gui;

    /**
     * Represents an element in a gui
     * @param slotChar The character to replace in the gui setup string
     * @param action   The action to run when the player clicks on this element
     */
    public GuiElement(char slotChar, Action action) {
        this.slotChar = slotChar;
        setAction(action);
    }

    /**
     * Represents an element in a gui that doesn't have any action when clicked
     * @param slotChar  The character to replace in the gui setup string
     */
    public GuiElement(char slotChar) {
        this(slotChar, null);
    }

    /**
     * Get the character in the gui setup that corresponds with this element
     * @return  The character
     */
    public char getSlotChar() {
        return slotChar;
    }

    /**
     * Get the item that is displayed by this element on a certain page
     * @param slot  The slot to get the item for
     * @return      The ItemStack that is displayed as this element
     */
    public abstract ItemStack getItem(int slot);

    /**
     * Get the action that is executed when clicking on this element
     * @return      The action to run
     */
    public Action getAction() {
        return action;
    }

    /**
     * Set the action that is executed when clicking on this element
     * @param action    The action to run
     */
    public void setAction(Action action) {
        this.action = action;
    }

    /**
     * Get the indexes of the lots that this element is displayed in
     * @return An array of the lost indexes
     */
    public int[] getSlots() {
        return slots;
    }

    /**
     * Set the ids of the slots where this element is assigned to
     * @param slots An array of the slot ids where this element is displayed
     */
    public void setSlots(int[] slots) {
        this.slots = slots;
    }

{'fraction_non_alphanumeric': 0.07089226471101799, 'fraction_numerical': 0.005238344683080147, 'mean_word_length': 2.5755305867665417, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '411679', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1508, 'n_words': 695}