Prepare for 1.14
To continue providing renamed ender chests/player inventories we can no longer just provide an Inventory, a full InventoryView is required. To avoid confusion the old method has been removed entirely, leading to a major API revision bump.
This commit is contained in:
@@ -18,6 +18,7 @@ package com.lishid.openinv.internal;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface IAnySilentContainer {
|
||||
|
||||
@@ -26,19 +27,19 @@ public interface IAnySilentContainer {
|
||||
* containers to open, be sure to check {@link #isAnyContainerNeeded(Player, Block)}
|
||||
* first.
|
||||
*
|
||||
* @param player the Player opening the container
|
||||
* @param silentchest whether the container's noise is to be silenced
|
||||
* @param block the Block
|
||||
* @param player the Player opening the container
|
||||
* @param silent whether the container's noise is to be silenced
|
||||
* @param block the Block
|
||||
* @return true if the container can be opened
|
||||
*/
|
||||
boolean activateContainer(Player player, boolean silentchest, Block block);
|
||||
boolean activateContainer(@NotNull Player player, boolean silent, @NotNull Block block);
|
||||
|
||||
/**
|
||||
* Closes the Player's currently open container silently, if necessary.
|
||||
*
|
||||
* @param player the Player closing a container
|
||||
*/
|
||||
void deactivateContainer(Player player);
|
||||
void deactivateContainer(@NotNull Player player);
|
||||
|
||||
/**
|
||||
* Checks if the container at the given coordinates is blocked.
|
||||
@@ -47,7 +48,7 @@ public interface IAnySilentContainer {
|
||||
* @param block the Block
|
||||
* @return true if the container is blocked
|
||||
*/
|
||||
boolean isAnyContainerNeeded(Player player, Block block);
|
||||
boolean isAnyContainerNeeded(@NotNull Player player, @NotNull Block block);
|
||||
|
||||
/**
|
||||
* Checks if the given block is a container which can be unblocked or silenced.
|
||||
@@ -55,6 +56,6 @@ public interface IAnySilentContainer {
|
||||
* @param block the BlockState
|
||||
* @return true if the Block is a supported container
|
||||
*/
|
||||
boolean isAnySilentContainer(Block block);
|
||||
boolean isAnySilentContainer(@NotNull Block block);
|
||||
|
||||
}
|
||||
|
@@ -16,9 +16,9 @@
|
||||
|
||||
package com.lishid.openinv.internal;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface IInventoryAccess {
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface IInventoryAccess {
|
||||
* @return the ISpecialEnderChest or null
|
||||
*/
|
||||
@Nullable
|
||||
ISpecialEnderChest getSpecialEnderChest(Inventory inventory);
|
||||
ISpecialEnderChest getSpecialEnderChest(@NotNull Inventory inventory);
|
||||
|
||||
/**
|
||||
* Gets an ISpecialPlayerInventory from an Inventory or null if the Inventory is not backed by
|
||||
@@ -40,7 +40,7 @@ public interface IInventoryAccess {
|
||||
* @return the ISpecialPlayerInventory or null
|
||||
*/
|
||||
@Nullable
|
||||
ISpecialPlayerInventory getSpecialPlayerInventory(Inventory inventory);
|
||||
ISpecialPlayerInventory getSpecialPlayerInventory(@NotNull Inventory inventory);
|
||||
|
||||
/**
|
||||
* Check if an Inventory is an ISpecialEnderChest implementation.
|
||||
@@ -48,7 +48,7 @@ public interface IInventoryAccess {
|
||||
* @param inventory the Inventory
|
||||
* @return true if the Inventory is backed by an ISpecialEnderChest
|
||||
*/
|
||||
boolean isSpecialEnderChest(Inventory inventory);
|
||||
boolean isSpecialEnderChest(@NotNull Inventory inventory);
|
||||
|
||||
/**
|
||||
* Check if an Inventory is an ISpecialPlayerInventory implementation.
|
||||
@@ -56,6 +56,6 @@ public interface IInventoryAccess {
|
||||
* @param inventory the Inventory
|
||||
* @return true if the Inventory is backed by an ISpecialPlayerInventory
|
||||
*/
|
||||
boolean isSpecialPlayerInventory(Inventory inventory);
|
||||
boolean isSpecialPlayerInventory(@NotNull Inventory inventory);
|
||||
|
||||
}
|
||||
|
@@ -17,23 +17,27 @@
|
||||
package com.lishid.openinv.internal;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface ISpecialEnderChest {
|
||||
|
||||
/**
|
||||
* Gets the Inventory associated with this ISpecialEnderChest.
|
||||
* Gets the InventoryView associated with this ISpecialEnderChest.
|
||||
*
|
||||
* @return the Inventory
|
||||
* @param viewer the Player opening the ISpecialEnderChest
|
||||
* @return the InventoryView
|
||||
*/
|
||||
Inventory getBukkitInventory();
|
||||
@NotNull
|
||||
InventoryView getBukkitView(@Nullable Player viewer);
|
||||
|
||||
/**
|
||||
* Sets the Player associated with this ISpecialEnderChest online.
|
||||
*
|
||||
* @param player the Player coming online
|
||||
*/
|
||||
void setPlayerOnline(Player player);
|
||||
void setPlayerOnline(@NotNull Player player);
|
||||
|
||||
/**
|
||||
* Sets the Player associated with this ISpecialEnderChest offline.
|
||||
|
@@ -17,23 +17,27 @@
|
||||
package com.lishid.openinv.internal;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface ISpecialPlayerInventory {
|
||||
|
||||
/**
|
||||
* Gets the Inventory associated with this ISpecialPlayerInventory.
|
||||
* Gets the InventoryView associated with this ISpecialPlayerInventory.
|
||||
*
|
||||
* @return the Inventory
|
||||
* @param viewer the Player opening the ISpecialPlayerInventory
|
||||
* @return the InventoryView
|
||||
*/
|
||||
Inventory getBukkitInventory();
|
||||
@NotNull
|
||||
InventoryView getBukkitView(@Nullable Player viewer);
|
||||
|
||||
/**
|
||||
* Sets the Player associated with this ISpecialPlayerInventory online.
|
||||
*
|
||||
* @param player the Player coming online
|
||||
*/
|
||||
void setPlayerOnline(Player player);
|
||||
void setPlayerOnline(@NotNull Player player);
|
||||
|
||||
/**
|
||||
* Sets the Player associated with this ISpecialPlayerInventory offline.
|
||||
|
Reference in New Issue
Block a user