-
Notifications
You must be signed in to change notification settings - Fork 0
NMSUtils
Fulminazzo edited this page Oct 2, 2023
·
1 revision
NMSUtils is a utility class containing several functions to help work with the Minecraft and CraftBukkit source codes. Most of the time you will not be using this class, as it is already used by many other utilities discussed in this plugin (actionbars, sending packets and more). However, it could be useful to at least know some shortcuts in case of working with it:
public class NMSUtils {
/**
* As the name suggests, this function tries to convert a CraftBukkit class
* to its corresponding Spigot class.
* An example would be the CraftPlayer that corresponds to Player.
* @param craftClass: the CraftBukkit class.
* @return Spigot class (if found).
*/
public static Class<?> convertCraftClassToSpigotClass(Class<?> craftClass);
/**
* Returns the corresponding "org.bukkit." + className Bukkit class.
* @param className: the name or path of the class.
* @return the class (if found).
*/
public static Class<?> getBukkitClass(String className);
/**
* Returns the corresponding NMS class.
* @param className: the name of the class.
* @return the class (if found).
*/
public static Class<?> getNMSClass(String className);
/**
* Returns the corresponding NMS class.
* @param className: the name of the class.
* @param className117: the name of the class if the server is in 1.17 or above.
* @return the class (if found).
*/
public static Class<?> getNMSClass(String className, String className117);
/**
* Returns the corresponding "org.bukkit.craftbukkit." + version + "." + className CraftBukkit class.
* @param className: the name of the class.
* @return the class(if found).
*/
public static Class<?> getCraftBukkitClass(String className);
/**
* Returns the current CraftBukkit path according to the server version.
* @return the path.
*/
public static String getCraftBukkitPath();
/**
* Returns the version of the server.
* (For better precision, you should check VersionsUtils).
* @return the version.
*/
private static String getVersion();
/**
* Returns a ChatSerializer object, useful in utilities like Actionbars.
* @param text: the text to be serialized.
* @return a ReflObject containing the serialized text.
*/
public static ReflObject<?> getChatSerializerObject(String text);
}
- Home
- How to start a plugin
- Work with Configuration Files
- Work with Enums
- Work with Commands
- Work with Custom Players
- Work with Messaging Channels
- Creating custom SavableObjects
- Timers
- General Utils
- Placeholders
- Bukkit Utils
- Velocity Utils