Reformat code

This commit is contained in:
NichtStudioCode 2023-10-12 16:06:22 +02:00
parent 785854f4a8
commit f12ccf6fc8
43 changed files with 31 additions and 65 deletions

@ -27,12 +27,14 @@ Supports all versions from 1.14.0 to 1.20.2.
* GUI Builder
## Maven
```xml
<repository>
<id>xenondevs</id>
<url>https://repo.xenondevs.xyz/releases</url>
</repository>
```
```xml
<dependency>
<groupId>xyz.xenondevs.invui</groupId>

@ -167,5 +167,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.
@ -186,5 +185,4 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
// empty
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r10;
import com.mojang.authlib.GameProfile;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.world.item.ItemStack;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.
@ -186,5 +185,4 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
// empty
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r11;
import com.mojang.authlib.GameProfile;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.world.item.ItemStack;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.
@ -186,5 +185,4 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
// empty
}
}

@ -16,7 +16,7 @@ import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.

@ -16,7 +16,7 @@ import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.

@ -21,7 +21,7 @@ class ItemUtilsImpl implements ItemUtils {
private static final Method CRAFT_META_SKULL_SET_PROFILE_METHOD = ReflectionUtils.getMethod(
ReflectionRegistry.CB_CRAFT_META_SKULL_CLASS, true, "setProfile", GameProfile.class
);
);
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.

@ -16,7 +16,7 @@ import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -165,7 +165,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.

@ -8,6 +8,7 @@ import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.*;
import net.minecraft.world.item.ItemStack;
import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
@ -20,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
import xyz.xenondevs.inventoryaccess.abstraction.inventory.CartographyInventory;
import xyz.xenondevs.inventoryaccess.component.ComponentWrapper;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import net.minecraft.world.entity.player.Player;
import java.lang.reflect.Field;

@ -16,7 +16,7 @@ import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -165,7 +165,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.

@ -8,6 +8,7 @@ import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.Container;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.*;
import net.minecraft.world.item.ItemStack;
import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
@ -20,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
import xyz.xenondevs.inventoryaccess.abstraction.inventory.CartographyInventory;
import xyz.xenondevs.inventoryaccess.component.ComponentWrapper;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import net.minecraft.world.entity.player.Player;
import java.lang.reflect.Field;

@ -21,7 +21,7 @@ class ItemUtilsImpl implements ItemUtils {
private static final Method CRAFT_META_SKULL_SET_PROFILE_METHOD = ReflectionUtils.getMethod(
ReflectionRegistry.CB_CRAFT_META_SKULL_CLASS, true, "setProfile", GameProfile.class
);
);
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {

@ -167,5 +167,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -167,5 +167,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -167,5 +167,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r4;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_15_R1.ItemStack;
import net.minecraft.server.v1_15_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_15_R1.NBTTagCompound;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -154,5 +154,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r5;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_16_R1.ItemStack;
import net.minecraft.server.v1_16_R1.NBTCompressedStreamTools;
import net.minecraft.server.v1_16_R1.NBTTagCompound;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -154,5 +154,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r6;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_16_R2.ItemStack;
import net.minecraft.server.v1_16_R2.NBTCompressedStreamTools;
import net.minecraft.server.v1_16_R2.NBTTagCompound;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -154,5 +154,4 @@ class AnvilInventoryImpl extends ContainerAnvil implements AnvilInventory {
// no
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r7;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_16_R3.ItemStack;
import net.minecraft.server.v1_16_R3.NBTCompressedStreamTools;
import net.minecraft.server.v1_16_R3.NBTTagCompound;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -158,7 +158,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.
@ -180,5 +179,4 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
// empty
}
}

@ -21,7 +21,7 @@ class ItemUtilsImpl implements ItemUtils {
private static final Method CRAFT_META_SKULL_SET_PROFILE_METHOD = ReflectionUtils.getMethod(
ReflectionRegistry.CB_CRAFT_META_SKULL_CLASS, true, "setProfile", GameProfile.class
);
);
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {

@ -164,7 +164,6 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
open = false;
}
/**
* Called when the container gets closed to put items back into a players
* inventory or drop them in the world.
@ -186,5 +185,4 @@ class AnvilInventoryImpl extends AnvilMenu implements AnvilInventory {
// empty
}
}

@ -1,6 +1,5 @@
package xyz.xenondevs.inventoryaccess.r9;
import com.mojang.authlib.GameProfile;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.world.item.ItemStack;
@ -13,12 +12,11 @@ import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry;
import xyz.xenondevs.inventoryaccess.util.ReflectionUtils;
import java.io.*;
import java.lang.reflect.Method;
import java.util.List;
import java.util.stream.Collectors;
class ItemUtilsImpl implements ItemUtils {
@Override
public byte[] serializeItemStack(org.bukkit.inventory.@NotNull ItemStack itemStack, boolean compressed) {
ByteArrayOutputStream out = new ByteArrayOutputStream();

@ -63,8 +63,8 @@ public class InventoryAccess {
/**
* Creates a new {@link AnvilInventory}.
*
* @param player The {@link Player} that should see this {@link AnvilInventory}
* @param title The inventory title
* @param player The {@link Player} that should see this {@link AnvilInventory}
* @param title The inventory title
* @param renameHandlers A list of {@link Consumer}s that are called whenever the {@link Player}
* types something in the renaming section of the anvil.
* @return The {@link AnvilInventory}

@ -49,7 +49,7 @@ public class ReflectionUtils {
}
}
public static <T> @NotNull Constructor<T> getConstructor(@NotNull Class<T> clazz, boolean declared, @NotNull Class<?> @NotNull... parameterTypes) {
public static <T> @NotNull Constructor<T> getConstructor(@NotNull Class<T> clazz, boolean declared, @NotNull Class<?> @NotNull ... parameterTypes) {
try {
Constructor<T> constructor = declared ? clazz.getDeclaredConstructor(parameterTypes) : clazz.getConstructor(parameterTypes);
if (declared) constructor.setAccessible(true);
@ -67,7 +67,7 @@ public class ReflectionUtils {
}
}
public static <T> @NotNull T construct(@NotNull Constructor<T> constructor, @Nullable Object @Nullable... args) {
public static <T> @NotNull T construct(@NotNull Constructor<T> constructor, @Nullable Object @Nullable ... args) {
try {
return constructor.newInstance(args);
} catch (Throwable t) {
@ -75,7 +75,7 @@ public class ReflectionUtils {
}
}
public static @NotNull Method getMethod(@NotNull Class<?> clazz, boolean declared, @NotNull String name, @NotNull Class<?>@NotNull ... parameterTypes) {
public static @NotNull Method getMethod(@NotNull Class<?> clazz, boolean declared, @NotNull String name, @NotNull Class<?> @NotNull ... parameterTypes) {
try {
Method method = declared ? clazz.getDeclaredMethod(name, parameterTypes) : clazz.getMethod(name, parameterTypes);
if (declared) method.setAccessible(true);
@ -85,7 +85,7 @@ public class ReflectionUtils {
}
}
public static @Nullable Method getMethodOrNull(@NotNull Class<?> clazz, boolean declared, @NotNull String name, @NotNull Class<?> @NotNull... parameterTypes) {
public static @Nullable Method getMethodOrNull(@NotNull Class<?> clazz, boolean declared, @NotNull String name, @NotNull Class<?> @NotNull ... parameterTypes) {
try {
Method method = declared ? clazz.getDeclaredMethod(name, parameterTypes) : clazz.getMethod(name, parameterTypes);
if (declared) method.setAccessible(true);
@ -95,7 +95,7 @@ public class ReflectionUtils {
}
}
public static <T> T invokeMethod(@NotNull Method method, @Nullable Object obj, @Nullable Object @Nullable... args) {
public static <T> T invokeMethod(@NotNull Method method, @Nullable Object obj, @Nullable Object @Nullable ... args) {
try {
return (T) method.invoke(obj, args);
} catch (Throwable t) {

@ -71,7 +71,6 @@ public abstract class AbstractTabGui extends AbstractGui implements TabGui {
return currentTab;
}
@Override
public @Nullable List<@NotNull BiConsumer<Integer, Integer>> getTabChangeHandlers() {
return tabChangeHandlers;

@ -66,5 +66,4 @@ final class ScrollNestedGuiImpl extends AbstractScrollGui<Gui> {
}
}

@ -59,7 +59,6 @@ public class IngredientList extends ArrayList<Ingredient> {
return indices;
}
private List<Integer> findIndicesOfVerticalMarker(Marker marker) {
List<Integer> indices = new ArrayList<>();
for (int x = 0; x < width; x++) {

@ -95,5 +95,4 @@ final class CartographySplitWindowImpl extends AbstractSplitWindow implements Ca
}
}

@ -8,7 +8,10 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.*;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.Inventory;

@ -9,7 +9,7 @@ import xyz.xenondevs.invui.window.Window
/**
* Sets the title of the window.
*
*
* @param title the new title
* @return This Window Builder
*/

@ -48,6 +48,7 @@ public class ForceResourcePack implements Listener {
/**
* Gets the instance of this class.
*
* @return The instance of this class.
*/
public static ForceResourcePack getInstance() {