Search code examples
javaexceptionstack-overflow

StackOverflowError when trying to render inventory with HashMap


I am trying to create a inventory with my Pane object using a HashMap for the slots and buttons. However, I am recieving a StackOverFlowError, probably (maybe?) because of some recursion, but I am completely unable to spot where. Relevant code:

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * Project created by ExpDev
 */


public abstract class Pane implements InventoryHolder {

    private Inventory inventory;

    private Map<Integer, Button> buttons = new HashMap<>();

    /**
     * @param rows Amount of rows. Max = 9
     */
    public Pane(int rows, String title) {
        Objects.requireNonNull(title, "title can not be null!");
        if (rows > 6) {
            throw new IllegalArgumentException("Rows must be <= 6, got " + rows);
        }

        this.inventory = Bukkit.createInventory(this, rows * 9, color(title));
    }

    /**
     * @param button The button to add
     */
    public void addButton(Button button) {

        // Finding next available
        buttons.put(buttons.size(), button);

        reRender();
    }

    public void addButton(int place, Button button) {

        buttons.put(place, button);

        reRender();
    }

    /**
     * @param place The place the button is located
     */
    @SuppressWarnings("unused")
    public void removeButton(int place) {
        buttons.remove(place);

        reRender();
    }

    /**
     * Renders the inventory again
     */
    @SuppressWarnings("WeakerAccess")
    public void reRender() {
        inventory.clear();
        createControls(inventory);

        render(inventory);
    }

    /**
     * @param event The {@link InventoryClickEvent}
     */
    @SuppressWarnings("WeakerAccess")
    public void onClick(InventoryClickEvent event) {
        event.setCancelled(true);

        handleClick(event);

    }

    /**
     * Creates the controls
     *
     * @param inventory The inventory
     */
    @SuppressWarnings("WeakerAccess")
    protected abstract void createControls(Inventory inventory);

    /**
     * Get the object's inventory.
     *
     * @return The inventory.
     */
    @Override
    public Inventory getInventory() {
        return inventory;
    }

    @SuppressWarnings("WeakerAccess")
    protected String color(String input) {
        return ChatColor.translateAlternateColorCodes('&', input);
    }

    /**
     * @param player The {@link Player} to open it for
     */
    public void open(Player player) {
        reRender();
        player.openInventory(getInventory());
    }

    /**
     * @param event The click event
     */
    void handleClick(InventoryClickEvent event) {
        // user clicked in his own inventory. Silently drop it
        if (event.getRawSlot() > event.getInventory().getSize()) {
            return;
        }
        // user clicked outside of the inventory
        if (event.getSlotType() == InventoryType.SlotType.OUTSIDE) {
            return;
        }
        if (event.getSlot() >= buttons.size()) {
            return;
        }
        Button button = buttons.get(event.getSlot());
        button.onClick(event);
    }

    /**
     * @param inventory The inventory to render in
     */
    void render(Inventory inventory) {

        for (int i : buttons.keySet()) {
            Button button = buttons.get(i);

            inventory.setItem(i, button.getItemStack());
            System.out.println("Putting " + button.getItemStack().getType().toString() + " in slot " +i);
        }
    }

    /**
     * @return True if this page is empty
     */
    boolean isEmpty() {
        return buttons.isEmpty();
    }
}

BecomeYouTuberPane class extending Pane

import me.expdev.youtubebot.Conf;
import me.expdev.youtubebot.YTPlayer;
import me.expdev.youtubebot.utils.ItemStackUtil;
import me.expdev.youtubebot.youtube.YTRequirements;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.Inventory;

import java.util.ArrayList;
import java.util.List;

/**
 * Project created by ExpDev
 */
public class BecomeYouTuberPane extends Pane {

    private YTPlayer player;

    public BecomeYouTuberPane(YTPlayer player) {
        super(3, "&5YouTuber Rank");

        this.player = player;
    }

    @Override
    protected void createControls(Inventory inventory) {
        // slot 11 and slot 15

        // Lore representing the YTRequirements for the rank
        List<String> reqLore = new ArrayList<String>();
        reqLore.add(ChatColor.GRAY + "YTRequirements for the " + ChatColor.LIGHT_PURPLE + "YouTube Rank" + ChatColor.GRAY + ":");

        // The requirements
        YTRequirements requirements = Conf.YTRequirements;

        reqLore.add(ChatColor.GRAY + " - You need " + ChatColor.YELLOW + requirements.getSubscriberCount() + "+ " + ChatColor.GRAY + "Subscribers");
        reqLore.add(ChatColor.GRAY + " - You need " + ChatColor.YELLOW + requirements.getViewCount() + "+ " + ChatColor.GRAY + "Views");
        reqLore.add(ChatColor.GRAY + " - You need " + ChatColor.YELLOW + requirements.getAverageViewCount() + "+ " + ChatColor.GRAY + "Average Views");
        reqLore.add(ChatColor.GRAY + " - You need " + ChatColor.YELLOW + requirements.getVideoCount() + "+ " + ChatColor.GRAY + "Videos");

        addButton(11, new Button(ItemStackUtil.getItemStack(Material.BOOK,
                1,
                0,
                ChatColor.LIGHT_PURPLE + "YouTube Rank",
                reqLore.toArray(new String[0])))
        );

        // Confirm button
        addButton(15, new Button(ItemStackUtil.getItemStack(Material.WOOD_BUTTON,
                1,
                0,
                ChatColor.BOLD.toString() + ChatColor.GREEN + "Continue",
                ChatColor.GRAY + "Start becoming a " + ChatColor.YELLOW + "YouTuber"),
                e -> {
                    player.setPreVerifying(true);
                    player.closePane();
                    player.msg("&7Type your &9https://www.youtube.com/channel/channelId &7or &9/user/username &7in chat &9(disabled for this process)&7.");
                })); // Start verifying

    }
}

Button class import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack;

import java.util.Objects; import java.util.function.Consumer;

/**
 * A button
 */
public class Button {

    private static int counter;
    private final int ID = counter++;

    private ItemStack itemStack;
    private Consumer<InventoryClickEvent> action;

    /**
     * @param itemStack The Item
     */
    @SuppressWarnings("unused")
    public Button(ItemStack itemStack) {
        this(itemStack, event -> {});
    }

    /**
     * @param itemStack The Item
     * @param action    The action
     */
    public Button(ItemStack itemStack, Consumer<InventoryClickEvent> action) {
        this.itemStack = itemStack;
        this.action = action;
    }

    /**
     * @return The icon
     */
    @SuppressWarnings("WeakerAccess")
    public ItemStack getItemStack() {
        return itemStack;
    }

    /**
     * @param action The new action
     */
    @SuppressWarnings("unused")
    public void setAction(Consumer<InventoryClickEvent> action) {
        this.action = action;
    }

    /**
     * @param event The event that triggered it
     */
    @SuppressWarnings("WeakerAccess")
    public void onClick(InventoryClickEvent event) {
        action.accept(event);
    }

    // We do not want equals collisions. The default hashcode would not fulfil this contract.
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Button)) {
            return false;
        }
        Button button = (Button) o;
        return ID == button.ID;
    }

    @Override
    public int hashCode() {
        return Objects.hash(ID);
    }
}

Exception:

[22:51:41 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'youtube' in plugin YouTubeBot v1.0-SNAPSHOT
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_131]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_131]
        at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8-R0.1-SNAPSHOT.jar:git-Spigot-21fe707-e1ebe52]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
Caused by: java.lang.StackOverflowError
        at java.util.regex.Pattern.sequence(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.expr(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.group0(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.sequence(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.expr(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.group0(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.sequence(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.expr(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.compile(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.<init>(Unknown Source) ~[?:1.8.0_131]
        at java.util.regex.Pattern.compile(Unknown Source) ~[?:1.8.0_131]
        at java.lang.String.replaceAll(Unknown Source) ~[?:1.8.0_131]
        at me.expdev.youtubebot.utils.translation.TextUtil.parseColorAmp(TextUtil.java:30) ~[?:?]
        at me.expdev.youtubebot.utils.translation.TextUtil.parseColor(TextUtil.java:20) ~[?:?]
        at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_131]
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_131]
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_131]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_131]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_131]
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_131]
        at java.util.stream.ReferencePipeline.collect(Unknown Source) ~[?:1.8.0_131]
        at me.expdev.youtubebot.utils.ItemStackUtil.getItemStack(ItemStackUtil.java:33) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]
        at me.expdev.youtubebot.gui.BecomeYouTuberPane.createControls(BecomeYouTuberPane.java:56) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.reRender(Pane.java:73) ~[?:?]
        at me.expdev.youtubebot.gui.Pane.addButton(Pane.java:54) ~[?:?]

Any help is greatly appreciated! Thank you.


Solution

  • Indeed you have a recursion problem. It's as follows:

    1. You call reRender (Pane)
    2. createControls in BecomeYouTuberPane calls addButton
    3. addButton calls reRender and so the loop closes