Search in sources :

Example 1 with IItemDb

use of com.earth2me.essentials.api.IItemDb in project MagicPlugin by elBukkit.

the class MagicItemDb method register.

public static boolean register(final MagicController controller, final Plugin essentialsPlugin) throws Exception {
    IEssentials essentials = (IEssentials) essentialsPlugin;
    IItemDb itemDb = essentials.getItemDb();
    if (itemDb instanceof AbstractItemDb) {
        ((AbstractItemDb) itemDb).registerResolver(controller.getPlugin(), "Magic", new MagicItemDb(controller));
    } else {
        return false;
    }
    return true;
}
Also used : IItemDb(com.earth2me.essentials.api.IItemDb) AbstractItemDb(com.earth2me.essentials.items.AbstractItemDb) IEssentials(net.ess3.api.IEssentials)

Example 2 with IItemDb

use of com.earth2me.essentials.api.IItemDb in project Essentials by drtshock.

the class Settings method _getItemSpawnBlacklist.

private List<Material> _getItemSpawnBlacklist() {
    final List<Material> epItemSpwn = new ArrayList<>();
    // noinspection deprecation
    final IItemDb itemDb = ess.getItemDb();
    if (itemDb == null || !itemDb.isReady()) {
        logger.log(Level.FINE, "Skipping item spawn blacklist read; item DB not yet loaded.");
        return epItemSpwn;
    }
    for (String itemName : config.getString("item-spawn-blacklist", "").split(",")) {
        itemName = itemName.trim();
        if (itemName.isEmpty()) {
            continue;
        }
        try {
            final ItemStack iStack = itemDb.get(itemName);
            epItemSpwn.add(iStack.getType());
        } catch (final Exception ex) {
            logger.log(Level.SEVERE, tl("unknownItemInList", itemName, "item-spawn-blacklist"), ex);
        }
    }
    return epItemSpwn;
}
Also used : IItemDb(com.earth2me.essentials.api.IItemDb) ArrayList(java.util.ArrayList) Material(org.bukkit.Material) ItemStack(org.bukkit.inventory.ItemStack) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Example 3 with IItemDb

use of com.earth2me.essentials.api.IItemDb in project Essentials by EssentialsX.

the class Settings method _getItemSpawnBlacklist.

private List<Material> _getItemSpawnBlacklist() {
    final List<Material> epItemSpwn = new ArrayList<>();
    // noinspection deprecation
    final IItemDb itemDb = ess.getItemDb();
    if (itemDb == null || !itemDb.isReady()) {
        logger.log(Level.FINE, "Skipping item spawn blacklist read; item DB not yet loaded.");
        return epItemSpwn;
    }
    for (String itemName : config.getString("item-spawn-blacklist", "").split(",")) {
        itemName = itemName.trim();
        if (itemName.isEmpty()) {
            continue;
        }
        try {
            final ItemStack iStack = itemDb.get(itemName);
            epItemSpwn.add(iStack.getType());
        } catch (final Exception ex) {
            logger.log(Level.SEVERE, tl("unknownItemInList", itemName, "item-spawn-blacklist"), ex);
        }
    }
    return epItemSpwn;
}
Also used : IItemDb(com.earth2me.essentials.api.IItemDb) ArrayList(java.util.ArrayList) Material(org.bukkit.Material) ItemStack(org.bukkit.inventory.ItemStack) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Aggregations

IItemDb (com.earth2me.essentials.api.IItemDb)3 ArrayList (java.util.ArrayList)2 PatternSyntaxException (java.util.regex.PatternSyntaxException)2 Material (org.bukkit.Material)2 ItemStack (org.bukkit.inventory.ItemStack)2 AbstractItemDb (com.earth2me.essentials.items.AbstractItemDb)1 IEssentials (net.ess3.api.IEssentials)1