mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-25 22:12:16 +01:00
Add new methods for not allowed message
This commit is contained in:
parent
02e1b478a5
commit
4075de4e59
@ -17,9 +17,36 @@
|
|||||||
|
|
||||||
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
package at.pcgamingfreaks.Minepacks.Bukkit.API;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public interface ItemFilter
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user