Package me.mrCookieSlime.Slimefun.api
Class Slimefun
- java.lang.Object
-
- me.mrCookieSlime.Slimefun.api.Slimefun
-
public final class Slimefun extends Object
Provides a few convenience methods.- Since:
- 4.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Logger
getLogger()
static boolean
hasPermission(Player p, SlimefunItem item, boolean message)
Checks if this player has the permission to use this item.static boolean
hasUnlocked(Player p, SlimefunItem sfItem, boolean message)
Checks if this player can use this item.static boolean
hasUnlocked(Player p, ItemStack item, boolean message)
Checks if this player can use this item.static boolean
isEnabled(Player p, SlimefunItem sfItem, boolean message)
Checks if this item is enabled in the world this player is in.static boolean
isEnabled(Player p, ItemStack item, boolean message)
Checks if this item is enabled in the world this player is in.static void
registerResearch(Research research, ItemStack... items)
Registers this Research and automatically binds these ItemStacks to it.static void
registerResearch(NamespacedKey key, int id, String name, int cost, ItemStack... items)
static BukkitTask
runSync(Runnable r)
static BukkitTask
runSync(Runnable r, long delay)
-
-
-
Method Detail
-
getLogger
public static Logger getLogger()
-
registerResearch
public static void registerResearch(Research research, ItemStack... items)
Registers this Research and automatically binds these ItemStacks to it.This convenience method spares from doing the code below:
Research r = new Research(7, "Glowstone Armor", 3); r.addItems(SlimefunItem.getByItem(SlimefunItems.GLOWSTONE_HELMET), SlimefunItem.getByItem(SlimefunItems.GLOWSTONE_CHESTPLATE), SlimefunItem.getByItem(SlimefunItems.GLOWSTONE_LEGGINGS), SlimefunItem.getByItem(SlimefunItems.GLOWSTONE_BOOTS)); r.register();
*- Parameters:
research
- the research to register, not nullitems
- the items to bind, not null
-
registerResearch
public static void registerResearch(NamespacedKey key, int id, String name, int cost, ItemStack... items)
-
hasUnlocked
public static boolean hasUnlocked(Player p, ItemStack item, boolean message)
Checks if this player can use this item.- Parameters:
p
- the player to check, not nullitem
- the item to check, not nullmessage
- whether a message should be sent to the player or not- Returns:
true
if the item is a SlimefunItem, enabled, researched and if the player has the permission to use it,false
otherwise.
-
hasUnlocked
public static boolean hasUnlocked(Player p, SlimefunItem sfItem, boolean message)
Checks if this player can use this item.- Parameters:
p
- the player to check, not nullsfItem
- the item to check, not nullmessage
- whether a message should be sent to the player or not- Returns:
true
if the item is enabled, researched and the player has the permission to use it,false
otherwise.
-
hasPermission
public static boolean hasPermission(Player p, SlimefunItem item, boolean message)
Checks if this player has the permission to use this item.- Parameters:
p
- the player to check, not nullitem
- the item to check, null returnstrue
message
- whether a message should be sent to the player or not- Returns:
true
if the item is not null and if the player has the permission to use it,false
otherwise.
-
isEnabled
public static boolean isEnabled(Player p, ItemStack item, boolean message)
Checks if this item is enabled in the world this player is in.- Parameters:
p
- the player to get the world he is in, not nullitem
- the item to check, not nullmessage
- whether a message should be sent to the player or not- Returns:
true
if the item is a SlimefunItem and is enabled in the world the player is in,false
otherwise.
-
isEnabled
public static boolean isEnabled(Player p, SlimefunItem sfItem, boolean message)
Checks if this item is enabled in the world this player is in.- Parameters:
p
- the player to get the world he is in, not nullsfItem
- the item to check, not nullmessage
- whether a message should be sent to the player or not- Returns:
true
if the item is enabled in the world the player is in,false
otherwise.
-
runSync
public static BukkitTask runSync(Runnable r)
-
runSync
public static BukkitTask runSync(Runnable r, long delay)
-
-