Troubles updating a plugin to 1.6.X

Discussion in 'Plugin Development' started by |Anthony|, Jul 8, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    |Anthony|

    I'm trying to update NoItem while the developer nala3 is mia but am getting compilation errors. I am not a java coder by any stretch of the imagination so this issue is beyond my capabilities. NoItem does use NMS/OBC code which i know is not desirable. It would be nice if in looking at the code someone is able to devise a reasonable alternative to using the nms/obc code. But nevertheless here is the issue... Compilation fails at this line here citing that it requires a boolean but found a java.lang.String. I've asked on irc and was told to look into MCP to get a look at what the methods have changed to, but seeing as i am not a java coder it won't do me any good, nor do i even know where to start with that. I turn now to the community for direct assistance and thank you all for your help :)
     
  2. Offline

    adam753

    Well, I can see one potential problem. Someone had the same issue earlier as it happens.
    Code:
    import net.minecraft.server.v1_6_R1.Item;
    import net.minecraft.server.v1_6_R1.PotionBrewer;
    import net.minecraft.server.v1_6_R1.ItemStack;
    
    You should always import things from bukkit, not minecraft.
    org.bukkit = good.
    net.minecraft = bad.

    (unless the minecraft ones are actually what you wanted for whatever reason? Personally I don't know what they're for.)
     
  3. Offline

    LinearLogic

    |Anthony|
    What version are you updating to 1.6.1 from?
     
  4. Offline

    |Anthony|

    From 1.5.2

    I've been looking on the bukkit/mcdev github and of the 2 java files (PotionBrewer and ItemStack) ItemStack is the only one that changed. Whether or not this is relevant i've no idea.
     
  5. Offline

    LinearLogic

    The w() method in question in 1.5.2 was changed to u() in 1.6.1. Let me know if issues persist.
     
    |Anthony| likes this.
  6. Offline

    |Anthony|

    Built without errors. :) Thank you very much LinearLogic

    I don't want to ask too much of you, but do you see any alternatives to such a heavy dependence on nms/obc code in NoItem?
     
  7. Offline

    LinearLogic

    Use the API-supported equivalents of the NMS classes used in the code. To determine which Bukkit methods to use, check out this tutorial on NMS/MCP --> Bukkit mappings.
     
  8. Offline

    Jogy34

    There is a lot of functionality that you can add to your plugins buy using NMS (net.minecraft.server) and Craftbukkit (non Bukkit API) code. For instance in my plugins I'm able to have player NPC's, completely custom merchant inventories, work with horses, NBTTags for other things, custom entities with custom behaviors and a bunch of other things that I couldn't do with the Bukkit API alone.
     
  9. Offline

    LinearLogic

    There's no question of NMS's usefulness, but Bukkit methods should invariably be used where they are available, as seems to be the case here (I'll double check the mappings). After all, the whole point of the API is to alleviate the necessity for hacking around in NMS in the first place. :)
     
  10. Offline

    |Anthony|

    I remember when nala3 was setting up the brewing mechanics he needed to use nms for some reason... Something about otherwise he had to work with the base potion and ingredients instead of just basing it on the resulting potion. I'd be interested to learn if there is a better way to achieve the end result.
     
  11. Offline

    adam753

    Ah, so that's what NMS is. I'll add 1 to my facepalm counter.
     
  12. Offline

    LinearLogic

    No need to waste a perfectly good facepalm. Each has its place, but around here it's encouraged to stay away from NMS and OBC unless you are completely sure of what you're doing and need functionality that Bukkit doesn't (yet) provide.
     
  13. Offline

    Jogy34

    What LinearLogic said. I was just telling you some of the things that I use it for. Unfortunately for me though since I use so much NMS/Craftbukkit code, since bukkit just released a new version I had to go through 28 different classes updating my package referances and now I have to find out what the blatently changed methods changed to and then I have to do a bunch of testing on my plugin to find out what else broke.
     
  14. Offline

    LinearLogic

    Jogy34
    You aren't alone in that struggle... I remember when updating plugins was something approaching bearable. :(
     
  15. Offline

    Jogy34

    Most of my plugins I haven't actually had to make an update for a few minecraft versions. Some are even still working completely fine back from 1.2.5. I only have 2 that I have to update to get to work with 1.6.2 one has a lot of NMS/Craftbukkit stuff which is the one I was mentioning, the other only uses NMS once or twice. The first one I also have to wait until I figure out why my custom projectiles are screwing up before I release the next version though.
     
Thread Status:
Not open for further replies.

Share This Page