org.bukkit.Keyed Java Examples
The following examples show how to use
org.bukkit.Keyed.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerListener.java From Transport-Pipes with MIT License | 6 votes |
@EventHandler public void onJoin(PlayerJoinEvent event) { if (generalConf.isCraftingEnabled()) { List<NamespacedKey> keys = new ArrayList<>(); for (BaseDuctType bdt : ductRegister.baseDuctTypes()) { for (Object type : bdt.ductTypes()) { DuctType dt = (DuctType) type; if (dt.getDuctRecipe() != null) { NamespacedKey key = ((Keyed) dt.getDuctRecipe()).getKey(); keys.add(key); } } if (bdt.is("pipe")) { keys.add(((PipeManager) bdt.getDuctManager()).getWrenchRecipe().getKey()); } } event.getPlayer().discoverRecipes(keys); } }
Example #2
Source File: ItemUtils.java From ProRecipes with GNU General Public License v2.0 | 5 votes |
public static String getRecipeKey(org.bukkit.inventory.Recipe rec, boolean dur){ if(rec instanceof Keyed){ return ((Keyed)rec).getKey().getKey(); }else{ return "nonkeyed:" + rec.getResult().getType().toString() + (dur ? rec.getResult().getDurability() : ""); } }