Reformat code

This commit is contained in:
NichtStudioCode 2023-01-28 16:09:05 +01:00
parent 9b03a9a2db
commit b6c09de2bc
20 changed files with 38 additions and 41 deletions

@ -5,12 +5,8 @@ package xyz.xenondevs.invui.window.type
import xyz.xenondevs.invui.window.Window import xyz.xenondevs.invui.window.Window
import xyz.xenondevs.invui.window.type.context.WindowContext import xyz.xenondevs.invui.window.type.context.WindowContext
fun <W: Window, C : WindowContext> WindowType<W, C>.create(contextConsumer: C.() -> Unit): W { fun <W : Window, C : WindowContext> WindowType<W, C>.create(contextConsumer: C.() -> Unit): W {
val ctx = createContext() val ctx = createContext()
ctx.contextConsumer() ctx.contextConsumer()
return createWindow(ctx) return createWindow(ctx)
} }
fun main() {
WindowType.NORMAL.create { }
}

@ -506,7 +506,7 @@ public abstract class AbstractGui implements Gui, GuiParent {
@Override @Override
@Nullable @Nullable
public SlotElement @NotNull[] getSlotElements() { public SlotElement @NotNull [] getSlotElements() {
return slotElements.clone(); return slotElements.clone();
} }
@ -533,7 +533,8 @@ public abstract class AbstractGui implements Gui, GuiParent {
return ((SlotElement.ItemSlotElement) slotElement).getItem(); return ((SlotElement.ItemSlotElement) slotElement).getItem();
} else if (slotElement instanceof SlotElement.LinkedSlotElement) { } else if (slotElement instanceof SlotElement.LinkedSlotElement) {
SlotElement holdingElement = slotElement.getHoldingElement(); SlotElement holdingElement = slotElement.getHoldingElement();
if (holdingElement instanceof SlotElement.ItemSlotElement) return ((SlotElement.ItemSlotElement) holdingElement).getItem(); if (holdingElement instanceof SlotElement.ItemSlotElement)
return ((SlotElement.ItemSlotElement) holdingElement).getItem();
} }
return null; return null;

@ -55,7 +55,7 @@ public abstract class AbstractPagedGui<C> extends AbstractGui implements PagedGu
currentPage = page; currentPage = page;
update(); update();
if (previous != currentPage) { if (previous != currentPage) {
pageChangeHandlers.forEach(handler -> handler.accept(previous, page)); pageChangeHandlers.forEach(handler -> handler.accept(previous, page));
} }
} }

@ -28,9 +28,9 @@ public final class PagedNestedGuiImpl extends AbstractPagedGui<Gui> {
/** /**
* Creates a new {@link PagedNestedGuiImpl}. * Creates a new {@link PagedNestedGuiImpl}.
* *
* @param width The width of this Gui. * @param width The width of this Gui.
* @param height The height of this Gui. * @param height The height of this Gui.
* @param guis The {@link Gui Guis} to use as pages. * @param guis The {@link Gui Guis} to use as pages.
* @param contentListSlots The slots where content should be displayed. * @param contentListSlots The slots where content should be displayed.
* @deprecated Use {@link PagedGui#ofGuis(int, int, List, int...)} instead. * @deprecated Use {@link PagedGui#ofGuis(int, int, List, int...)} instead.
*/ */

@ -39,7 +39,7 @@ public abstract class AbstractWindowContext<V> implements WindowContext {
this.title = title; this.title = title;
} }
public void setTitle(@NotNull BaseComponent @NotNull[] title) { public void setTitle(@NotNull BaseComponent @NotNull [] title) {
this.title = new BaseComponentWrapper(title); this.title = new BaseComponentWrapper(title);
} }