MMOItems - API

Apr 17, 2018 at 12:25 PM
MMOItems - API
  • Here are all the API classes you can use to manualy manipulate some parts of MMOItems.

    ItemManager
    #getItem(Type, String) returns the corresponding custom item (ItemStack) depending on the item type and ID.
    Code (Text):
    player.getInventory().addItem(ItemManager.getItem(Type.SWORD, "STEEL_SWORD"));


    PlayerAbilities
    #castAbility(Player, Ability, ItemStack, ValueCouple...) makes a player cast an ability. The ItemStack represents the item the player is clicking when casting the ability. The ValueCouple... are the ability modifiers.
    Code (Text):
    PlayerAbilities.castAbility(player, Ability.FIREBOLT, player.getInventory().getItemInMainHand(), new ValueCouple("damage", 5.6), new ValueCouple("cooldown", 10.3));
    player.sendMessage(ChatColor.YELLOW + "You successfully cast " + ChatColor.GOLD + "Firebolt" + ChatColor.YELLOW + "!");

    Accessing the item database
    To access the configuration files where the items are saved, use the method from the MIUtils class:
    Code (Text):
    MIUtils#getConfigFromType(Type)
    This method will return the config file of the corresponding item type.

    To save the config file, use:
    Code (Text):
    MIUtils#saveConfig(FileConfiguration, Type)
    You can also manually load the file configurations using the default YamlConfiguration util, but you'll need the MMOItems plugin class, which you can access with this:
    Code (Text):
    MIUtils#getPlugin()

    AdvancedRecipes
    #openInv(Player) opens the advanced workbench to a player.
    Code (Text):
    AdvancedRecipes.openInv(Bukkit.getPlayer("YeaBoiii"));
  • Loading...
  • Loading...