Custom inventory titles for 1.14

This commit is contained in:
Jikoo
2019-05-05 15:15:17 -04:00
parent 185f037254
commit 0f266c8a64
34 changed files with 420 additions and 239 deletions

View File

@@ -19,9 +19,11 @@ package com.lishid.openinv;
import com.lishid.openinv.internal.IAnySilentContainer;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialInventory;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryView;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -49,8 +51,7 @@ public interface IOpenInv {
* @return the ISilentContainer
* @throws IllegalStateException if the server version is unsupported
*/
@NotNull
IAnySilentContainer getAnySilentContainer();
@NotNull IAnySilentContainer getAnySilentContainer();
/**
* Gets the active IInventoryAccess implementation.
@@ -58,8 +59,7 @@ public interface IOpenInv {
* @return the IInventoryAccess
* @throws IllegalStateException if the server version is unsupported
*/
@NotNull
IInventoryAccess getInventoryAccess();
@NotNull IInventoryAccess getInventoryAccess();
/**
* Gets the provided player's AnyChest setting.
@@ -78,8 +78,7 @@ public interface IOpenInv {
* @return the identifier
* @throws IllegalStateException if the server version is unsupported
*/
@NotNull
String getPlayerID(@NotNull OfflinePlayer offline);
@NotNull String getPlayerID(@NotNull OfflinePlayer offline);
/**
* Gets a player's SilentChest setting.
@@ -99,8 +98,7 @@ public interface IOpenInv {
* @throws IllegalStateException if the server version is unsupported
* @throws InstantiationException if the ISpecialEnderChest could not be instantiated
*/
@NotNull
ISpecialEnderChest getSpecialEnderChest(@NotNull Player player, boolean online) throws InstantiationException;
@NotNull ISpecialEnderChest getSpecialEnderChest(@NotNull Player player, boolean online) throws InstantiationException;
/**
* Gets an ISpecialPlayerInventory for the given Player.
@@ -111,8 +109,7 @@ public interface IOpenInv {
* @throws IllegalStateException if the server version is unsupported
* @throws InstantiationException if the ISpecialPlayerInventory could not be instantiated
*/
@NotNull
ISpecialPlayerInventory getSpecialInventory(@NotNull Player player, boolean online) throws InstantiationException;
@NotNull ISpecialPlayerInventory getSpecialInventory(@NotNull Player player, boolean online) throws InstantiationException;
/**
* Checks if the server version is supported by OpenInv.
@@ -128,8 +125,7 @@ public interface IOpenInv {
* @return the Player, or null
* @throws IllegalStateException if the server version is unsupported
*/
@Nullable
Player loadPlayer(@NotNull final OfflinePlayer offline);
@Nullable Player loadPlayer(@NotNull final OfflinePlayer offline);
/**
* Get an OfflinePlayer by name.
@@ -141,8 +137,16 @@ public interface IOpenInv {
* @param name the name of the Player
* @return the OfflinePlayer with the closest matching name or null if no players have ever logged in
*/
@Nullable
OfflinePlayer matchPlayer(@NotNull String name);
@Nullable OfflinePlayer matchPlayer(@NotNull String name);
/**
* Open an ISpecialInventory for a Player.
*
* @param player the Player
* @param inventory the ISpecialInventory
* @return the InventoryView for the opened ISpecialInventory
*/
@Nullable InventoryView openInventory(@NotNull Player player, @NotNull ISpecialInventory inventory);
/**
* Check the configuration value for whether or not OpenInv displays a notification to the user

View File

@@ -29,8 +29,7 @@ public interface IInventoryAccess {
* @param inventory the Inventory
* @return the ISpecialEnderChest or null
*/
@Nullable
ISpecialEnderChest getSpecialEnderChest(@NotNull Inventory inventory);
@Nullable ISpecialEnderChest getSpecialEnderChest(@NotNull Inventory inventory);
/**
* Gets an ISpecialPlayerInventory from an Inventory or null if the Inventory is not backed by
@@ -39,8 +38,7 @@ public interface IInventoryAccess {
* @param inventory the Inventory
* @return the ISpecialPlayerInventory or null
*/
@Nullable
ISpecialPlayerInventory getSpecialPlayerInventory(@NotNull Inventory inventory);
@Nullable ISpecialPlayerInventory getSpecialPlayerInventory(@NotNull Inventory inventory);
/**
* Check if an Inventory is an ISpecialEnderChest implementation.

View File

@@ -16,37 +16,6 @@
package com.lishid.openinv.internal;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.jetbrains.annotations.NotNull;
public interface ISpecialEnderChest {
/**
* Gets the Inventory associated with this ISpecialEnderChest.
*
* @return the Inventory
*/
@NotNull
Inventory getBukkitInventory();
/**
* Sets the Player associated with this ISpecialEnderChest online.
*
* @param player the Player coming online
*/
void setPlayerOnline(@NotNull Player player);
/**
* Sets the Player associated with this ISpecialEnderChest offline.
*/
void setPlayerOffline();
/**
* Gets whether or not this ISpecialEnderChest is in use.
*
* @return true if the ISpecialEnderChest is in use
*/
boolean isInUse();
public interface ISpecialEnderChest extends ISpecialInventory {
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2011-2019 lishid. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.lishid.openinv.internal;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.jetbrains.annotations.NotNull;
public interface ISpecialInventory {
/**
* Gets the Inventory associated with this ISpecialEnderChest.
*
* @return the Inventory
*/
@NotNull Inventory getBukkitInventory();
/**
* Sets the Player associated with this ISpecialEnderChest online.
*
* @param player the Player coming online
*/
void setPlayerOnline(@NotNull Player player);
/**
* Sets the Player associated with this ISpecialEnderChest offline.
*/
void setPlayerOffline();
/**
* Gets whether or not this ISpecialEnderChest is in use.
*
* @return true if the ISpecialEnderChest is in use
*/
boolean isInUse();
}

View File

@@ -16,37 +16,6 @@
package com.lishid.openinv.internal;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.jetbrains.annotations.NotNull;
public interface ISpecialPlayerInventory {
/**
* Gets the Inventory associated with this ISpecialPlayerInventory.
*
* @return the Inventory
*/
@NotNull
Inventory getBukkitInventory();
/**
* Sets the Player associated with this ISpecialPlayerInventory online.
*
* @param player the Player coming online
*/
void setPlayerOnline(@NotNull Player player);
/**
* Sets the Player associated with this ISpecialPlayerInventory offline.
*/
void setPlayerOffline();
/**
* Gets whether or not this ISpecialPlayerInventory is in use.
*
* @return true if the ISpecialPlayerInventory is in use
*/
boolean isInUse();
public interface ISpecialPlayerInventory extends ISpecialInventory {
}