Linking WhatIsIt

WhatIsIt contains a number of public static functions to retrieve friendly names of entities, items, and more.

If you are relying on this plugin, and haven't written any fallback routines, you will want to disable your plugin in your onEnable if WhatIsIt isn't found. You probably want to add a log entry as well.

if (getServer().getPluginManager().getPlugin("WhatIsIt") == null) {
    log.log(Level.SEVERE, String.format("[%s] - Disabled due to no WhatIsIt dependency found!", getDescription().getName()));
    getServer().getPluginManager().disablePlugin(this);
    return;
}

NOTICE: Don't Forget To add softdepend: [WhatIsIt] or depend: [WhatIsIt] to your plugin.yml

Include the WhatIsIt class on any file using this functionality:

import com.flobi.WhatIsIt.WhatIsIt;

And reference the static methods directly, for example:

String itemName = WhatIsIt.itemName(itemStack);
String entityName = WhatIsIt.entityName(entityObject);

The specific public static function headers are as follows (I'm looking into a luadoc, but here is for the mean time):

public static String enchantmentName(Entry<Enchantment, Integer> enchantment) {}
public static String enchantmentName(Enchantment enchantment, Integer level) {}
public static String enchantmentName(Enchantment enchantment) {}
public static String enchantmentLevelName(Integer level) {}
public static String blockName(Block block) {}
public static String entityName(Entity entity) {}
public static String itemName(ItemStack item) {}

Return to overview.