Class Slimefun



  • public final class Slimefun
    extends Object
    Provides a few convenience methods.
    Since:
    4.0
    • 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 null
        items - the items to bind, not null
      • 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 null
        item - the item to check, not null
        message - 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 null
        sfItem - the item to check, not null
        message - 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 null
        item - the item to check, null returns true
        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 null
        item - the item to check, not null
        message - 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 null
        sfItem - the item to check, not null
        message - 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.