-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix plugins with paper-plugin.yml not working on 1.21
- Loading branch information
1 parent
d6997f9
commit 510704b
Showing
15 changed files
with
450 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
IF/src/main/java/com/github/stefvanschie/inventoryframework/util/InventoryViewUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.github.stefvanschie.inventoryframework.util; | ||
|
||
import com.github.stefvanschie.inventoryframework.inventoryview.abstraction.AbstractInventoryViewUtil; | ||
import com.github.stefvanschie.inventoryframework.util.version.Version; | ||
import org.bukkit.inventory.InventoryView; | ||
import org.jetbrains.annotations.Contract; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* A utility class for working with {@link InventoryView}s across different definitions. | ||
* | ||
* @since 0.10.16 | ||
*/ | ||
public class InventoryViewUtil { | ||
|
||
/** | ||
* The underlying implementation. | ||
*/ | ||
@Nullable | ||
private static AbstractInventoryViewUtil IMPLEMENTATION; | ||
|
||
/** | ||
* Gets the instance of this class to use for the current version. | ||
* | ||
* @return an instance of a utility class | ||
* @since 0.10.16 | ||
*/ | ||
@NotNull | ||
@Contract(pure = true) | ||
public static AbstractInventoryViewUtil getInstance() { | ||
if (IMPLEMENTATION == null) { | ||
if (Version.getVersion().isInventoryViewInterface()) { | ||
IMPLEMENTATION = com.github.stefvanschie.inventoryframework.inventoryview.interface_.InventoryViewUtil.getInstance(); | ||
} else { | ||
IMPLEMENTATION = com.github.stefvanschie.inventoryframework.inventoryview.abstractclass.InventoryViewUtil.getInstance(); | ||
} | ||
} | ||
|
||
return IMPLEMENTATION; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.github.stefvanschie.inventoryframework</groupId> | ||
<artifactId>IF-parent</artifactId> | ||
<version>0.10.16-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>iv-abstract-class</artifactId> | ||
|
||
<properties> | ||
<maven.deploy.skip>true</maven.deploy.skip> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spigot-repo</id> | ||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.github.stefvanschie.inventoryframework</groupId> | ||
<artifactId>iv-abstraction</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>1.20.6-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
<exclusions> | ||
<!-- Provided, but not accessible --> | ||
<exclusion> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
77 changes: 77 additions & 0 deletions
77
...github/stefvanschie/inventoryframework/inventoryview/abstractclass/InventoryViewUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.github.stefvanschie.inventoryframework.inventoryview.abstractclass; | ||
|
||
import com.github.stefvanschie.inventoryframework.inventoryview.abstraction.AbstractInventoryViewUtil; | ||
import org.bukkit.event.inventory.InventoryType; | ||
import org.bukkit.inventory.Inventory; | ||
import org.bukkit.inventory.InventoryView; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.jetbrains.annotations.Contract; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* A wrapper for {@link InventoryView} methods that apply when {@link InventoryView} was an abstract class. | ||
* | ||
* @since 0.10.16 | ||
*/ | ||
public class InventoryViewUtil implements AbstractInventoryViewUtil { | ||
|
||
/** | ||
* Instance of this singleton class. | ||
*/ | ||
@NotNull | ||
private static final InventoryViewUtil INSTANCE = new InventoryViewUtil(); | ||
|
||
@NotNull | ||
@Override | ||
public Inventory getBottomInventory(@NotNull InventoryView view) { | ||
return view.getBottomInventory(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public ItemStack getCursor(@NotNull InventoryView view) { | ||
return view.getCursor(); | ||
} | ||
|
||
@Override | ||
public void setCursor(@NotNull InventoryView view, @Nullable ItemStack item) { | ||
view.setCursor(item); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public Inventory getInventory(@NotNull InventoryView view, int slot) { | ||
return view.getInventory(slot); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public InventoryType.SlotType getSlotType(@NotNull InventoryView view, int slot) { | ||
return view.getSlotType(slot); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getTitle(@NotNull InventoryView view) { | ||
return view.getTitle(); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Inventory getTopInventory(@NotNull InventoryView view) { | ||
return view.getTopInventory(); | ||
} | ||
|
||
/** | ||
* Gets the singleton instance of this class. | ||
* | ||
* @return the instance of this class | ||
* @since 0.10.16 | ||
*/ | ||
@NotNull | ||
@Contract(pure = true) | ||
public static InventoryViewUtil getInstance() { | ||
return INSTANCE; | ||
} | ||
} |
Oops, something went wrong.