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>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>

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

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

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

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

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

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

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

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

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

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

@ -6,7 +6,7 @@ import xyz.xenondevs.invui.item.Item
/**
* Gets the [SlotElement] placed on that slot.
*
*
* @param slot The slot index
* @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.
*
*
* @param x The x 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
@ -31,7 +31,7 @@ operator fun Gui.set(slot: Int, element: SlotElement?) = setSlotElement(slot, el
/**
* Sets the [SlotElement] on these coordinates.
*
*
* @param x The x 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
@ -40,7 +40,7 @@ operator fun Gui.set(x: Int, y: Int, element: SlotElement?) = setSlotElement(x,
/**
* Sets the [Item] on that slot.
*
*
* @param slot The slot index
* @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.
*
*
* @param x The x 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
@ -57,7 +57,7 @@ operator fun Gui.set(x: Int, y: Int, item: Item?) = setItem(x, y, item)
/**
* Adds the given [elements].
*
*
* @param elements The [SlotElements][SlotElement] to add.
*/
@JvmName("plusAssignSlotElements")
@ -65,7 +65,7 @@ operator fun Gui.plusAssign(elements: Iterable<SlotElement>) = elements.forEach
/**
* Adds the given [items].
*
*
* @param items The [Items][Item] to add.
*/
@JvmName("plusAssignItems")

@ -5,12 +5,8 @@ package xyz.xenondevs.invui.window.type
import xyz.xenondevs.invui.window.Window
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()
ctx.contextConsumer()
return createWindow(ctx)
}
fun main() {
WindowType.NORMAL.create { }
}

@ -506,7 +506,7 @@ public abstract class AbstractGui implements Gui, GuiParent {
@Override
@Nullable
public SlotElement @NotNull[] getSlotElements() {
public SlotElement @NotNull [] getSlotElements() {
return slotElements.clone();
}
@ -533,7 +533,8 @@ public abstract class AbstractGui implements Gui, GuiParent {
return ((SlotElement.ItemSlotElement) slotElement).getItem();
} else if (slotElement instanceof SlotElement.LinkedSlotElement) {
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;

@ -55,10 +55,10 @@ public abstract class AbstractPagedGui<C> extends AbstractGui implements PagedGu
currentPage = page;
update();
if (previous != currentPage) {
pageChangeHandlers.forEach(handler -> handler.accept(previous, page));
pageChangeHandlers.forEach(handler -> handler.accept(previous, page));
}
}
@Override
public boolean hasNextPage() {
return currentPage < getPageAmount() - 1 || infinitePages;

@ -37,7 +37,7 @@ public abstract class AbstractTabGui extends AbstractGui implements TabGui {
int previous = currentTab;
currentTab = tab;
update();
if (tabChangeHandlers != null) {
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}
* where this {@link Gui} is displayed.
* <p>
* where this {@link Gui} is displayed.
* <p>
* If the {@link Window Windows} are not marked as "retain",
* 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}.
*
* @param width The width of this Gui.
* @param height The height of this Gui.
* @param guis The {@link Gui Guis} to use as pages.
*
* @param width The width of this Gui.
* @param height The height of this Gui.
* @param guis The {@link Gui Guis} to use as pages.
* @param contentListSlots The slots where content should be displayed.
* @deprecated Use {@link PagedGui#ofGuis(int, int, List, int...)} instead.
*/

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

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