From a6299a7419acae2e45b8806280c8bc347e519960 Mon Sep 17 00:00:00 2001 From: Fulminazzo Date: Thu, 11 Apr 2024 20:32:45 +0200 Subject: [PATCH] Added javadoc --- .../java/it/angrybear/yagl/guis/GUIImpl.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gui/base/src/main/java/it/angrybear/yagl/guis/GUIImpl.java b/gui/base/src/main/java/it/angrybear/yagl/guis/GUIImpl.java index 7f709ade..fe543b5c 100644 --- a/gui/base/src/main/java/it/angrybear/yagl/guis/GUIImpl.java +++ b/gui/base/src/main/java/it/angrybear/yagl/guis/GUIImpl.java @@ -80,12 +80,19 @@ public boolean isMovable(int slot) { return this; } - protected int addSingle(GUIContent content, int j) { - for (; j < this.contents.size(); j++) { - Contents c = this.contents.get(j); + /** + * Tries to add the given content from the given index. + * + * @param content the content + * @param index the index + * @return the new index if it was successful, -1 in case of error + */ + protected int addSingle(final @NotNull GUIContent content, int index) { + for (; index < this.contents.size(); index++) { + Contents c = this.contents.get(index); if (c == null) { - this.contents.set(j, new Contents(content)); - return j; + this.contents.set(index, new Contents(content)); + return index; } } return -1;