Allow null as item

This commit is contained in:
GeorgH93 2020-02-15 03:35:51 +01:00
parent f1bdcbb71e
commit c78bd6d7cc
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks-API</artifactId>
<version>2.1-ALPHA-SNAPSHOTS</version>
<version>2.2-SNAPSHOT</version>
<scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>

View File

@ -19,15 +19,19 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@SuppressWarnings("unused")
public interface ItemFilter
{
/**
* @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);
@Contract("null->false")
boolean isItemBlocked(@Nullable ItemStack item);
/**
* @param player The player that should receive the message that the item is not allowed.
@ -40,7 +44,7 @@ public interface ItemFilter
* @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)
default boolean checkIsBlockedAndShowMessage(@NotNull Player player, @Nullable ItemStack itemStack)
{
if(isItemBlocked(itemStack))
{