NMS ?

Discussion in 'Spigot Plugin Development' started by chunza2542, Apr 15, 2017.

  1. What is nms ? How can I used for? thx
     
    #1 chunza2542, Apr 15, 2017
    Last edited: Apr 16, 2017
  2. I'm assuming you mean NMS (as the title says)?

    NMS stands for net.minecraft.server, the package name of the original minecraft server jar file. This package including all its contents is included in the spigot and bukkit builds and is used by craftbukkit to access the core minecraft server files. It can be used by developers to get access to stuff that isn't in the API. Most of the time you don't need to use NMS and as it's package names changes every version I wouldn't use it unless you need it. It's quite fun to play around with it by just changing values and seeing what happens, though; perhaps you discover something that might be useful and you'll get a better understanding how the minecraft code works.
     
    • Agree Agree x 1
  3. He means net.minecraft.penis.


    Duh.
     
  4. Well, actually it's a software used for managing packages and is used when node.js is installed.
     
    • Winner Winner x 1
  5. OMFG, guppy. Remember me? From SimpleHG name mc this: xHawke_
     
  6. It's the underlying code for the Spigot implementation of the Minecraft server ( the original Mojang code). It's mainly used to access or implement fuctionality far from the reach of the current Spigot API and even the Craftbukkit api. However It is a much harsh code to trasnverse and apply and many times it requeries the use of reflection which is costly to the JVM if used frequently and adviced against by standard convention.

    If you have thoroughly looking up and down Spigot and Craftbukkit API and you still don't find the required access to the internals then go for it, else I wouldn't recommend dwelling in that mess.
     
    • Agree Agree x 1
  7. You do realize that Bukkit, Craftbukkit, and Spigot are all wrappers for NMS, and use reflection. So no, accessing NMS directly wouldn't be more costly to the JVM. Yes, it is more messy, this is why we have the existing wrappers.
     
  8. Not more costly than it is for Bukki/craftbukkit/spigot but more costly than other operations yes. It is way more effective to find a solution using either design patter or good hierarchy planning to accomplish a goal than just to jump into NMS and reflection.

    I didn't mean to say it is forbidden but to be used only in special times and tread with care (as Reflection should be in all cases).
     
    • Winner Winner x 1
  9. Bukkit does not use reflection for very much. It uses the CraftBukkit classes (which change every version) hidden behind the interface of Bukkit classes.
    Basically, that bukkit World object is actually a CraftWorld, you just cant tell because none of the bukkit classes have normal constructors, they have methods that make a CraftWhatever and only show you the Whatever interface.
    Using NMS does not require reflection either, nor does using it add version-independence in most cases. NMS tends to perform much better (and gives greater control) than bukkit in some areas, like manipulating blocks.
     
    • Agree Agree x 2
  10. Oh GG Sorry I mean nms. haha
     
    • Winner Winner x 2