Magic

Magic

190k Downloads

#getMage Deprecated

Shilodabing opened this issue ยท 2 comments

commented

Hi nathan ,
I hope you are doing well today :D
I was trying to do a plugin using Magic API and I have a deprecated method. Here my code:

String rune = args[0];
BookMeta bm = (BookMeta) is.getItemMeta();
String autor = bm.getAuthor();
Player name = Bukkit.getPlayer(autor);
@SuppressWarnings("deprecation")
Mage neko = main.api.getMage(name);
neko.addSkillPoints(((Integer) myMap.get(rune)).intValue());

Currently my code works fine but I really want to update the code and remove that deprecated. I didnt find some method not deprecated :C

Regards!

commented

I think it's mostly that all of the MageAPI methods except getController are deprecated, to try to persuade devs to use the MageController interface, keeping the main API in one place. All of the methods in MageAPI just pass through to MageController, and it got a little cumbersome.

So I would recommend instead of storing a main.api reference to MageAPI, I'd maybe make main.magic and make it a MageController (api.getController). Then getMage should work fine!

Please let me know if you have any trouble, I'm hoping that's a relatively easy refactor for you :)

commented

Changed, tested and works! , Thank you so much. The change was super easy ^^
Regards!