Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PackageType(path: String) {
- def this(parent: PackageType, path: String) {
- this (parent.path + "." + path)
- }
- }
- /**
- * Represents an enumeration of dynamic packages of NMS and CraftBukkit
- *
- * This class is part of the '''ReflectionUtils''' and follows the same usage conditions
- *
- * ''Rewritten in Scala by TheReturningVoid''
- *
- * @author DarkBlade12, TheReturningVoid
- * @since 1.0
- */
- object PackageType {
- val MINECRAFT_SERVER = new PackageType("net.minecraft.server." + getServerVersion)
- val CRAFTBUKKIT = new PackageType("org.bukkit.craftbukkit." + getServerVersion)
- val CRAFTBUKKIT_BLOCK = new PackageType(CRAFTBUKKIT, "block")
- val CRAFTBUKKIT_CHUNKIO = new PackageType(CRAFTBUKKIT, "chunkio")
- val CRAFTBUKKIT_COMMAND = new PackageType(CRAFTBUKKIT, "command")
- val CRAFTBUKKIT_CONVERSATIONS = new PackageType(CRAFTBUKKIT, "conversations")
- val CRAFTBUKKIT_ENCHANTMENTS = new PackageType(CRAFTBUKKIT, "enchantments")
- val CRAFTBUKKIT_ENTITY = new PackageType(CRAFTBUKKIT, "entity")
- val CRAFTBUKKIT_EVENT = new PackageType(CRAFTBUKKIT, "event")
- val CRAFTBUKKIT_GENERATOR = new PackageType(CRAFTBUKKIT, "generator")
- val CRAFTBUKKIT_HELP = new PackageType(CRAFTBUKKIT, "help")
- val CRAFTBUKKIT_INVENTORY = new PackageType(CRAFTBUKKIT, "inventory")
- val CRAFTBUKKIT_MAP = new PackageType(CRAFTBUKKIT, "map")
- val CRAFTBUKKIT_METADATA = new PackageType(CRAFTBUKKIT, "metadata")
- val CRAFTBUKKIT_POTION = new PackageType(CRAFTBUKKIT, "potion")
- val CRAFTBUKKIT_PROJECTILES = new PackageType(CRAFTBUKKIT, "projectiles")
- val CRAFTBUKKIT_SCHEDULER = new PackageType(CRAFTBUKKIT, "scheduler")
- val CRAFTBUKKIT_SCOREBOARD = new PackageType(CRAFTBUKKIT, "scoreboard")
- val CRAFTBUKKIT_UPDATER = new PackageType(CRAFTBUKKIT, "updater")
- val CRAFTBUKKIT_UTIL = new PackageType(CRAFTBUKKIT, "util")
- /**
- * Returns the class of the given name
- *
- * @param classname Name of the desired class
- * @throws java.lang.ClassNotFoundException If the desired class with the specified name and package cannot be found
- * @return The class with the specified name
- */
- @throws(classOf[ClassNotFoundException])
- def getClass(classname: String): Class[_] = Class.forName(this + "." + classname)
- /**
- * Returns the version of your server
- *
- * @return The server version
- */
- def getServerVersion = Bukkit.getServer.getClass.getPackage.getName substring 23
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement