Compare commits
10 Commits
49b3a74fc7
...
2c498eabe3
Author | SHA1 | Date | |
---|---|---|---|
|
2c498eabe3 | ||
|
0928e1f4d1 | ||
|
72a5639b2d | ||
|
954df03ea2 | ||
|
2d790314d3 | ||
|
51aff8fe96 | ||
|
f76896231c | ||
|
e4d24de018 | ||
|
02de62fca8 | ||
|
eb04148acb |
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 NichtStudioCode
|
Copyright (c) 2024 NichtStudioCode
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
# InvUI
|
# InvUI
|
||||||
|
|
||||||
An Inventory API for Minecraft Spigot servers.
|
An Inventory API for Minecraft Spigot servers.
|
||||||
Supports all versions from 1.14.0 to 1.20.2.
|
Supports all versions from 1.14.0 to 1.20.4.
|
||||||
|
|
||||||
[Documentation](https://xenondevs.xyz/docs/invui/)
|
[Documentation](https://xenondevs.xyz/docs/invui/)
|
||||||
|
|
||||||
@ -19,7 +19,6 @@ Supports all versions from 1.14.0 to 1.20.2.
|
|||||||
* Easily customizable (Create your own GUI types and Items)
|
* Easily customizable (Create your own GUI types and Items)
|
||||||
* VirtualInventory: Store real items inside GUIs, customize maximum stack size per slot, etc.
|
* VirtualInventory: Store real items inside GUIs, customize maximum stack size per slot, etc.
|
||||||
* Easy way to add localization using the ItemProvider system and the built-in ItemBuilder
|
* Easy way to add localization using the ItemProvider system and the built-in ItemBuilder
|
||||||
* Supports custom textures (forced resource pack system, compatible with AuthMe)
|
|
||||||
* Advanced ItemBuilder (Normal, Potion, Skull, Banner, Firework) with BaseComponent support
|
* Advanced ItemBuilder (Normal, Potion, Skull, Banner, Firework) with BaseComponent support
|
||||||
* Support for BaseComponents in inventory titles
|
* Support for BaseComponents in inventory titles
|
||||||
* Uncloseable inventories
|
* Uncloseable inventories
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
139
inventoryaccess/inventory-access-r18/pom.xml
Normal file
139
inventoryaccess/inventory-access-r18/pom.xml
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
|
<artifactId>invui-parent</artifactId>
|
||||||
|
<version>1.27</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>inventory-access-r18</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<spigot.version>1.20.4-R0.1-SNAPSHOT</spigot.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot</artifactId>
|
||||||
|
<version>${spigot.version}</version>
|
||||||
|
<classifier>remapped-mojang</classifier>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
|
<artifactId>inventory-access</artifactId>
|
||||||
|
<version>${project.parent.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>xyz.xenondevs.string-remapper</groupId>
|
||||||
|
<artifactId>string-remapper-maven-plugin</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>remap-spigot</id>
|
||||||
|
<goals>
|
||||||
|
<goal>remap</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<spigotVersion>${spigot.version}</spigotVersion>
|
||||||
|
<goal>spigot</goal>
|
||||||
|
<classesIn>${project.build.directory}/classes</classesIn>
|
||||||
|
<classesOut>${project.build.directory}/classes-spigot</classesOut>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
|
||||||
|
<execution>
|
||||||
|
<id>remap-mojang</id>
|
||||||
|
<goals>
|
||||||
|
<goal>remap</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<spigotVersion>${spigot.version}</spigotVersion>
|
||||||
|
<goal>mojang</goal>
|
||||||
|
<classesIn>${project.build.directory}/classes</classesIn>
|
||||||
|
<classesOut>${project.build.directory}/classes-mojang</classesOut>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-jar</id>
|
||||||
|
<phase>none</phase>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>spigot</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<classesDirectory>${project.build.directory}/classes-spigot</classesDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>mojang</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<classesDirectory>${project.build.directory}/classes-mojang</classesDirectory>
|
||||||
|
<classifier>remapped-mojang</classifier>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.md-5</groupId>
|
||||||
|
<artifactId>specialsource-maven-plugin</artifactId>
|
||||||
|
<version>1.2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>remap</goal>
|
||||||
|
</goals>
|
||||||
|
<id>remap-obf</id>
|
||||||
|
<configuration>
|
||||||
|
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:txt:maps-mojang</srgIn>
|
||||||
|
<reverse>true</reverse>
|
||||||
|
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-mojang</remappedDependencies>
|
||||||
|
<remappedArtifactAttached>false</remappedArtifactAttached>
|
||||||
|
<finalName>${project.artifactId}-${project.version}-remapped-obf</finalName>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>remap</goal>
|
||||||
|
</goals>
|
||||||
|
<id>remap-spigot</id>
|
||||||
|
<configuration>
|
||||||
|
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
|
||||||
|
<srgIn>org.spigotmc:minecraft-server:${spigot.version}:csrg:maps-spigot</srgIn>
|
||||||
|
<remappedDependencies>org.spigotmc:spigot:${spigot.version}:jar:remapped-obf</remappedDependencies>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -34,14 +34,14 @@ abstract class ComponentLocalizer<C> {
|
|||||||
var end = matcher.end();
|
var end = matcher.end();
|
||||||
|
|
||||||
// check for escaped %
|
// check for escaped %
|
||||||
var matchedStr = formatString.substring(i, start);
|
var matchedStr = formatString.substring(start, end);
|
||||||
if ("%%".equals(matchedStr)) {
|
if ("%%".equals(matchedStr)) {
|
||||||
sb.append('%');
|
sb.append('%');
|
||||||
} else {
|
} else {
|
||||||
// check for invalid format, only %s is supported
|
// check for invalid format, only %s is supported
|
||||||
var argType = matcher.group(2);
|
var argType = matcher.group(2);
|
||||||
if (!"s".equals(argType)) {
|
if (!"s".equals(argType)) {
|
||||||
throw new IllegalStateException("Unsupported format: '" + matchedStr + "'");
|
throw new IllegalStateException("Unsupported placeholder format: '" + matchedStr + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// retrieve argument index
|
// retrieve argument index
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class InvUI implements Listener {
|
|||||||
|
|
||||||
public @NotNull Plugin getPlugin() {
|
public @NotNull Plugin getPlugin() {
|
||||||
if (plugin == null) {
|
if (plugin == null) {
|
||||||
plugin = tryFindPlugin();
|
setPlugin(tryFindPlugin());
|
||||||
|
|
||||||
if (plugin == null)
|
if (plugin == null)
|
||||||
throw new IllegalStateException("Plugin is not set. Set it using InvUI.getInstance().setPlugin(plugin);");
|
throw new IllegalStateException("Plugin is not set. Set it using InvUI.getInstance().setPlugin(plugin);");
|
||||||
@ -60,6 +60,9 @@ public class InvUI implements Listener {
|
|||||||
if (this.plugin != null)
|
if (this.plugin != null)
|
||||||
throw new IllegalStateException("Plugin is already set");
|
throw new IllegalStateException("Plugin is already set");
|
||||||
|
|
||||||
|
if (plugin == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,17 @@ package xyz.xenondevs.invui.item;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public interface ItemProvider extends Supplier<ItemStack>, Cloneable {
|
public interface ItemProvider extends Supplier<@NotNull ItemStack>, Cloneable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link ItemProvider} for an {@link ItemStack}.
|
* An {@link ItemProvider} for an {@link ItemStack}.
|
||||||
*/
|
*/
|
||||||
ItemProvider EMPTY = new ItemWrapper(new ItemStack(Material.AIR));
|
@NotNull ItemProvider EMPTY = new ItemWrapper(new ItemStack(Material.AIR));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ItemStack} translated in the specified language.
|
* Gets the {@link ItemStack} translated in the specified language.
|
||||||
@ -19,14 +20,14 @@ public interface ItemProvider extends Supplier<ItemStack>, Cloneable {
|
|||||||
* @param lang The language to translate the item in.
|
* @param lang The language to translate the item in.
|
||||||
* @return The {@link ItemStack}
|
* @return The {@link ItemStack}
|
||||||
*/
|
*/
|
||||||
ItemStack get(@Nullable String lang);
|
@NotNull ItemStack get(@Nullable String lang);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ItemStack} without requesting a specific language.
|
* Gets the {@link ItemStack} without requesting a specific language.
|
||||||
*
|
*
|
||||||
* @return The {@link ItemStack}
|
* @return The {@link ItemStack}
|
||||||
*/
|
*/
|
||||||
default ItemStack get() {
|
default @NotNull ItemStack get() {
|
||||||
return get(null);
|
return get(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package xyz.xenondevs.invui.item;
|
package xyz.xenondevs.invui.item;
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ public class ItemWrapper implements ItemProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack get(String lang) {
|
public @NotNull ItemStack get(String lang) {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,6 @@ public abstract class AbstractMergedWindow extends AbstractDoubleWindow {
|
|||||||
public AbstractMergedWindow(Player player, ComponentWrapper title, AbstractGui gui, Inventory upperInventory, boolean closeable) {
|
public AbstractMergedWindow(Player player, ComponentWrapper title, AbstractGui gui, Inventory upperInventory, boolean closeable) {
|
||||||
super(player, title, gui.getSize(), upperInventory, closeable);
|
super(player, title, gui.getSize(), upperInventory, closeable);
|
||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
|
|
||||||
gui.addParent(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,8 +32,6 @@ public abstract class AbstractSingleWindow extends AbstractWindow {
|
|||||||
this.gui = gui;
|
this.gui = gui;
|
||||||
this.size = gui.getSize();
|
this.size = gui.getSize();
|
||||||
this.inventory = inventory;
|
this.inventory = inventory;
|
||||||
|
|
||||||
gui.addParent(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,9 +27,6 @@ public abstract class AbstractSplitWindow extends AbstractDoubleWindow {
|
|||||||
super(player, title, upperGui.getSize() + lowerGui.getSize(), upperInventory, closeable);
|
super(player, title, upperGui.getSize() + lowerGui.getSize(), upperInventory, closeable);
|
||||||
this.upperGui = upperGui;
|
this.upperGui = upperGui;
|
||||||
this.lowerGui = lowerGui;
|
this.lowerGui = lowerGui;
|
||||||
|
|
||||||
upperGui.addParent(this);
|
|
||||||
lowerGui.addParent(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -261,6 +261,7 @@ public abstract class AbstractWindow implements Window, GuiParent {
|
|||||||
hasHandledClose = false;
|
hasHandledClose = false;
|
||||||
initItems();
|
initItems();
|
||||||
WindowManager.getInstance().addWindow(this);
|
WindowManager.getInstance().addWindow(this);
|
||||||
|
for (AbstractGui gui : getGuis()) gui.addParent(this);
|
||||||
openInventory(viewer);
|
openInventory(viewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,8 +332,7 @@ public abstract class AbstractWindow implements Window, GuiParent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Arrays.stream(getGuis())
|
for (AbstractGui gui : getGuis()) gui.removeParent(this);
|
||||||
.forEach(gui -> gui.removeParent(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>invui-kotlin</artifactId>
|
<artifactId>invui-kotlin</artifactId>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>invui</artifactId>
|
<artifactId>invui</artifactId>
|
||||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>xyz.xenondevs.invui</groupId>
|
<groupId>xyz.xenondevs.invui</groupId>
|
||||||
<artifactId>invui-parent</artifactId>
|
<artifactId>invui-parent</artifactId>
|
||||||
<version>1.23</version>
|
<version>1.27</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
Loading…
Reference in New Issue
Block a user