Add new methods for not allowed message

This commit is contained in:
GeorgH93 2019-11-22 17:03:20 +01:00
parent 02e1b478a5
commit 4075de4e59
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8

View File

@ -17,9 +17,36 @@
package at.pcgamingfreaks.Minepacks.Bukkit.API;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
public interface ItemFilter
{
boolean isItemBlocked(ItemStack item);
/**
* @param item The item that should be checked.
* @return True if the item is not allowed. False if the item is allowed.
*/
boolean isItemBlocked(@NotNull ItemStack item);
/**
* @param player The player that should receive the message that the item is not allowed.
* @param itemStack The item that is not allowed. Will be used for the name.
*/
void sendNotAllowedMessage(@NotNull Player player, @NotNull ItemStack itemStack);
/**
* @param player The player that should receive the message if the item is not allowed.
* @param itemStack The item that should be checked.
* @return True if the item is not allowed. False if the item is allowed.
*/
default boolean checkIsBlockedAndShowMessage(@NotNull Player player, @NotNull ItemStack itemStack)
{
if(isItemBlocked(itemStack))
{
sendNotAllowedMessage(player, itemStack);
return true;
}
return false;
}
}