public final class NmsBookHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NmsBookHelper.UnsupportedVersionException
An error thrown when this NMS-helper class doesn't support the running MC version
|
| Constructor and Description |
|---|
NmsBookHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getNmsClass(String className) |
static Class<?> |
getNmsClass(String className,
boolean log) |
static net.md_5.bungee.api.chat.BaseComponent[] |
itemToComponents(org.bukkit.inventory.ItemStack item)
Translates an ItemStack to his Chat-Component equivalent
|
static net.md_5.bungee.api.chat.BaseComponent[] |
jsonToComponents(String json)
Translates a json string to his Chat-Component equivalent
|
static Object |
nmsCopy(org.bukkit.inventory.ItemStack item)
Creates a NMS copy of the parameter
|
static void |
openBook(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack book,
boolean offHand)
Opens the book to a player (the player needs to have the book in one of his hands)
|
static void |
setPages(org.bukkit.inventory.meta.BookMeta meta,
net.md_5.bungee.api.chat.BaseComponent[][] components)
Sets the pages of the book to the components json equivalent
|
static Object |
toNms(org.bukkit.entity.Player player)
Gets the EntityPlayer handled by the argument
|
public static void setPages(org.bukkit.inventory.meta.BookMeta meta,
net.md_5.bungee.api.chat.BaseComponent[][] components)
meta - the book meta to changecomponents - the pages of the bookpublic static void openBook(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack book,
boolean offHand)
player - the playerbook - the book to openoffHand - false if the book is in the right hand, true otherwisepublic static net.md_5.bungee.api.chat.BaseComponent[] itemToComponents(org.bukkit.inventory.ItemStack item)
item - the item to be convertedpublic static net.md_5.bungee.api.chat.BaseComponent[] jsonToComponents(String json)
json - the json string to be convertedpublic static Object toNms(org.bukkit.entity.Player player) throws InvocationTargetException, IllegalAccessException
player - the Player handlerInvocationTargetException - when some problems are found with the reflectionIllegalAccessException - when some problems are found with the reflectionpublic static Object nmsCopy(org.bukkit.inventory.ItemStack item) throws InvocationTargetException, IllegalAccessException
item - the ItemStack to be nms-copiedInvocationTargetException - when some problems are found with the reflectionIllegalAccessException - when some problems are found with the reflectionCopyright © 2017. All rights reserved.