diff --git a/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/ForceResourcePack.java b/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/ForceResourcePack.java index 7d1f429..2acc9e9 100644 --- a/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/ForceResourcePack.java +++ b/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/ForceResourcePack.java @@ -11,7 +11,6 @@ import org.jetbrains.annotations.Nullable; import xyz.xenondevs.inventoryaccess.InventoryAccess; import xyz.xenondevs.inventoryaccess.component.BungeeComponentWrapper; import xyz.xenondevs.inventoryaccess.component.ComponentWrapper; -import xyz.xenondevs.inventoryaccess.util.ReflectionRegistry; import xyz.xenondevs.inventoryaccess.util.VersionUtils; import xyz.xenondevs.invui.InvUI; import xyz.xenondevs.invui.resourcepack.auth.AuthenticationServiceManager; @@ -25,24 +24,17 @@ import java.util.HashMap; import static org.bukkit.event.player.PlayerResourcePackStatusEvent.Status.DECLINED; /** - * Forces {@link Player}s to use a custom ResourcePack and kicks them if they don't accept it. + * Forces {@link Player Players} to use a custom resource pack. */ public class ForceResourcePack implements Listener { - private static final String RP_VERSION = "v0.8"; private static final ForceResourcePack INSTANCE = new ForceResourcePack(); - public static final String RESOURCE_PACK_URL = - "https://github.com/NichtStudioCode/InvUIRP/releases/download/" - + RP_VERSION + (ReflectionRegistry.VERSION > 14 ? "" : "-legacy") + "/InvUIRP.zip"; - private final HashMap tasks = new HashMap<>(); - private boolean forced = true; private String forceBypassPermission; private String promptBypassPermission; private ComponentWrapper prompt; - private String resourcePackUrl; private byte[] hash; @@ -54,11 +46,20 @@ public class ForceResourcePack implements Listener { }); } + /** + * Gets the instance of this class. + * @return The instance of this class. + */ public static ForceResourcePack getInstance() { return INSTANCE; } - public String getResourcePackUrl() { + /** + * Gets the configured resource pack URL. + * + * @return The resource pack URL or null if no resource pack is configured. + */ + public @Nullable String getResourcePackUrl() { return resourcePackUrl; } diff --git a/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/Icon.java b/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/Icon.java deleted file mode 100644 index 853435f..0000000 --- a/invui-resourcepack/src/main/java/xyz/xenondevs/invui/resourcepack/Icon.java +++ /dev/null @@ -1,113 +0,0 @@ -package xyz.xenondevs.invui.resourcepack; - -import net.md_5.bungee.api.chat.BaseComponent; -import org.bukkit.Material; -import xyz.xenondevs.invui.item.Item; -import xyz.xenondevs.invui.item.builder.ItemBuilder; -import xyz.xenondevs.invui.item.impl.SimpleItem; - -/** - * Custom-textured Items that look like they are a part of the inventory. - * Needs the resource pack to work, activate ResourcePack forcing and - * choose between the lightweight or complete version using - * {@link ForceResourcePack#setResourcePack(String, BaseComponent[])}. - */ -public enum Icon { - - BACKGROUND(10000000), - ARROW_1_UP(10000001), - ARROW_1_RIGHT(10000002), - ARROW_1_DOWN(10000003), - ARROW_1_LEFT(10000004), - LIGHT_ARROW_1_UP(10000005), - LIGHT_ARROW_1_RIGHT(10000006), - LIGHT_ARROW_1_DOWN(10000007), - LIGHT_ARROW_1_LEFT(10000008), - ARROW_2_UP(10000009), - ARROW_2_RIGHT(10000010), - ARROW_2_DOWN(10000011), - ARROW_2_LEFT(10000012), - LIGHT_ARROW_2_UP(10000013), - LIGHT_ARROW_2_RIGHT(10000014), - LIGHT_ARROW_2_DOWN(10000015), - LIGHT_ARROW_2_LEFT(10000016), - HORIZONTAL_LINE(10000017), - VERTICAL_LINE(10000018), - LIGHT_HORIZONTAL_LINE(10000019), - LIGHT_VERTICAL_LINE(10000020), - CORNER_TOP_LEFT(10000021), - CORNER_TOP_RIGHT(10000022), - CORNER_BOTTOM_LEFT(10000023), - CORNER_BOTTOM_RIGHT(10000024), - LIGHT_CORNER_TOP_LEFT(10000025), - LIGHT_CORNER_TOP_RIGHT(10000026), - LIGHT_CORNER_BOTTOM_LEFT(10000027), - LIGHT_CORNER_BOTTOM_RIGHT(10000028), - HORIZONTAL_DOWN(10000029), - HORIZONTAL_UP(10000030), - VERTICAL_LEFT(10000031), - VERTICAL_RIGHT(10000032), - LIGHT_HORIZONTAL_DOWN(10000033), - LIGHT_HORIZONTAL_UP(10000034), - LIGHT_VERTICAL_LEFT(10000035), - LIGHT_VERTICAL_RIGHT(10000036), - VERTICAL_HORIZONTAL(10000037), - LIGHT_VERTICAL_HORIZONTAL(10000038), - X(10000039), - LIGHT_X(10000040), - RED_X(10000041), - CHECKMARK(10000042), - LIGHT_CHECKMARK(10000043), - GREEN_CHECKMARK(10000044), - ANVIL_OVERLAY_PLUS(10000045), - ANVIL_OVERLAY_ARROW(10000046), - ANVIL_OVERLAY_ARROW_LEFT(10000047), - LENS(10000048), - LIGHT_LENS(10000049), - CHECKBOX(10000050), - CHECKBOX_CHECKED(10000051), - LIGHT_CHECKBOX(10000052), - LIGHT_CHECKBOX_CHECKED(10000053), - HORIZONTAL_DOTS(10000054), - LIGHT_HORIZONTAL_DOTS(10000055), - VERTICAL_DOTS(10000056), - LIGHT_VERTICAL_DOTS(10000057), - CIRCLE(10000058), - LIGHT_CIRCLE(10000059), - BOX(10000060), - LIGHT_BOX(10000061), - REFRESH(10000062), - LIGHT_REFRESH(10000063), - REFRESH_ANIMATED(10000064), - LIGHT_REFRESH_ANIMATED(10000065); - - private final ItemBuilder itemBuilder; - private final Item item; - - Icon(int customModelData) { - this.itemBuilder = new ItemBuilder(Material.POPPY) - .setCustomModelData(customModelData) - .setDisplayName("ยง0"); - - this.item = new SimpleItem(itemBuilder); - } - - /** - * Gets a copy of the {@link ItemBuilder} for this {@link Icon}. - * - * @return A copy of the {@link ItemBuilder} - */ - public ItemBuilder getItemBuilder() { - return itemBuilder.clone(); - } - - /** - * Gets a non-clickable {@link Item} with this texture. - * - * @return A non-clickable {@link Item} with this texture. - */ - public Item getItem() { - return item; - } - -}