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

@ -76,7 +76,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>

@ -29,8 +29,8 @@ class PlayerUtilsImpl implements PlayerUtils {
private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod( private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod(
PlayerAdvancements.class, PlayerAdvancements.class,
true, true,
"SRM(net.minecraft.server.PlayerAdvancements registerListeners)", "SRM(net.minecraft.server.PlayerAdvancements registerListeners)",
ServerAdvancementManager.class ServerAdvancementManager.class
); );

@ -76,7 +76,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>

@ -29,8 +29,8 @@ class PlayerUtilsImpl implements PlayerUtils {
private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod( private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod(
PlayerAdvancements.class, PlayerAdvancements.class,
true, true,
"SRM(net.minecraft.server.PlayerAdvancements registerListeners)", "SRM(net.minecraft.server.PlayerAdvancements registerListeners)",
ServerAdvancementManager.class ServerAdvancementManager.class
); );

@ -76,7 +76,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>

@ -29,8 +29,8 @@ class PlayerUtilsImpl implements PlayerUtils {
private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod( private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod(
PlayerAdvancements.class, PlayerAdvancements.class,
true, true,
"SRM(net.minecraft.server.PlayerAdvancements registerListeners)", "SRM(net.minecraft.server.PlayerAdvancements registerListeners)",
ServerAdvancementManager.class ServerAdvancementManager.class
); );

@ -29,8 +29,8 @@ class PlayerUtilsImpl implements PlayerUtils {
private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod( private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod(
PlayerAdvancements.class, PlayerAdvancements.class,
true, true,
"SRM(net.minecraft.server.PlayerAdvancements registerListeners)", "SRM(net.minecraft.server.PlayerAdvancements registerListeners)",
ServerAdvancementManager.class ServerAdvancementManager.class
); );

@ -76,7 +76,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>

@ -29,8 +29,8 @@ class PlayerUtilsImpl implements PlayerUtils {
private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod( private static final Method REGISTER_LISTENERS_METHOD = ReflectionUtils.getMethod(
PlayerAdvancements.class, PlayerAdvancements.class,
true, true,
"SRM(net.minecraft.server.PlayerAdvancements registerListeners)", "SRM(net.minecraft.server.PlayerAdvancements registerListeners)",
ServerAdvancementManager.class ServerAdvancementManager.class
); );

@ -23,7 +23,7 @@
<url>https://repo.papermc.io/repository/maven-public/</url> <url>https://repo.papermc.io/repository/maven-public/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>

@ -15,5 +15,5 @@ public class BaseComponentWrapper implements ComponentWrapper {
public String serializeToJson() { public String serializeToJson() {
return ComponentSerializer.toString(components); return ComponentSerializer.toString(components);
} }
} }

@ -6,7 +6,7 @@ import xyz.xenondevs.invui.item.Item
/** /**
* Gets the [SlotElement] placed on that slot. * Gets the [SlotElement] placed on that slot.
* *
* @param slot The slot index * @param slot The slot index
* @return The [SlotElement] placed on that slot or null if there is none * @return The [SlotElement] placed on that slot or null if there is none
*/ */
@ -14,7 +14,7 @@ operator fun Gui.get(slot: Int): SlotElement? = getSlotElement(slot)
/** /**
* Gets the [SlotElement] placed on these coordinates. * Gets the [SlotElement] placed on these coordinates.
* *
* @param x The x coordinate of the slot * @param x The x coordinate of the slot
* @param y The y coordinate of the slot * @param y The y coordinate of the slot
* @return The [SlotElement] placed on that slot or null if there is none * @return The [SlotElement] placed on that slot or null if there is none
@ -31,7 +31,7 @@ operator fun Gui.set(slot: Int, element: SlotElement?) = setSlotElement(slot, el
/** /**
* Sets the [SlotElement] on these coordinates. * Sets the [SlotElement] on these coordinates.
* *
* @param x The x coordinate of the slot * @param x The x coordinate of the slot
* @param y The y coordinate of the slot * @param y The y coordinate of the slot
* @param element The [SlotElement] to set or null to remove the current one * @param element The [SlotElement] to set or null to remove the current one
@ -40,7 +40,7 @@ operator fun Gui.set(x: Int, y: Int, element: SlotElement?) = setSlotElement(x,
/** /**
* Sets the [Item] on that slot. * Sets the [Item] on that slot.
* *
* @param slot The slot index * @param slot The slot index
* @param item The [Item] to set or null to remove the current one * @param item The [Item] to set or null to remove the current one
*/ */
@ -48,7 +48,7 @@ operator fun Gui.set(slot: Int, item: Item?) = setItem(slot, item)
/** /**
* Sets the [Item] on these coordinates. * Sets the [Item] on these coordinates.
* *
* @param x The x coordinate of the slot * @param x The x coordinate of the slot
* @param y The y coordinate of the slot * @param y The y coordinate of the slot
* @param item The [Item] to set or null to remove the current one * @param item The [Item] to set or null to remove the current one
@ -57,7 +57,7 @@ operator fun Gui.set(x: Int, y: Int, item: Item?) = setItem(x, y, item)
/** /**
* Adds the given [elements]. * Adds the given [elements].
* *
* @param elements The [SlotElements][SlotElement] to add. * @param elements The [SlotElements][SlotElement] to add.
*/ */
@JvmName("plusAssignSlotElements") @JvmName("plusAssignSlotElements")
@ -65,7 +65,7 @@ operator fun Gui.plusAssign(elements: Iterable<SlotElement>) = elements.forEach
/** /**
* Adds the given [items]. * Adds the given [items].
* *
* @param items The [Items][Item] to add. * @param items The [Items][Item] to add.
*/ */
@JvmName("plusAssignItems") @JvmName("plusAssignItems")

@ -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,10 +55,10 @@ 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));
} }
} }
@Override @Override
public boolean hasNextPage() { public boolean hasNextPage() {
return currentPage < getPageAmount() - 1 || infinitePages; return currentPage < getPageAmount() - 1 || infinitePages;

@ -37,7 +37,7 @@ public abstract class AbstractTabGui extends AbstractGui implements TabGui {
int previous = currentTab; int previous = currentTab;
currentTab = tab; currentTab = tab;
update(); update();
if (tabChangeHandlers != null) { if (tabChangeHandlers != null) {
tabChangeHandlers.forEach(handler -> handler.accept(previous, tab)); tabChangeHandlers.forEach(handler -> handler.accept(previous, tab));
} }

@ -243,8 +243,8 @@ public interface Gui {
/** /**
* Closes the open {@link Inventory} for all viewers of {@link Window Windows} * Closes the open {@link Inventory} for all viewers of {@link Window Windows}
* where this {@link Gui} is displayed. * where this {@link Gui} is displayed.
* <p> * <p>
* If the {@link Window Windows} are not marked as "retain", * If the {@link Window Windows} are not marked as "retain",
* they will be removed from the {@link WindowManager} automatically. * they will be removed from the {@link WindowManager} automatically.
*/ */

@ -27,10 +27,10 @@ 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.
*/ */

@ -52,7 +52,7 @@ public class WindowManager implements Listener {
public void addWindow(Window window) { public void addWindow(Window window) {
if (!(window instanceof AbstractWindow)) if (!(window instanceof AbstractWindow))
throw new IllegalArgumentException("Illegal window implementation"); throw new IllegalArgumentException("Illegal window implementation");
AbstractWindow abstractWindow = (AbstractWindow) window; AbstractWindow abstractWindow = (AbstractWindow) window;
windows.put(abstractWindow.getInventories()[0], abstractWindow); windows.put(abstractWindow.getInventories()[0], abstractWindow);
} }

@ -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);
} }