TheNewEconomy / EconomyCore

The core code powering TNE.
Other
11 stars 5 forks source link

[FEAT]: Sponge API 8 support #52

Closed mosemister closed 1 year ago

mosemister commented 1 year ago

Feature Description

Add the ability for TNE to be used on Sponge API 8 and newer

Reasoning

Sponge API 7 (what is currently supported by TNE) has been on community support for a year.

Currently there is only XConomy on Sponge API 8 and many users rather use something else. Hint hint nudge nudge

creatorfromhell commented 1 year ago

Feature Description

Add the ability for TNE to be used on Sponge API 8 and newer

Reasoning

Sponge API 7 (what is currently supported by TNE) has been on community support for a year.

Currently there is only XConomy on Sponge API 8 and many users rather use something else. Hint hint nudge nudge

Sponge 8 is something I'm looking at supporting. I just have to implement it into the libraries that TNE utilizes. IIRC, when I went looking at supporting it before their documentation was still on Sponge 7 classes, which was annoying.

mosemister commented 1 year ago

Im actually the only guy left working on the sponge docs for API 8 and I dont have a lot of free time to do so. But out of the 250odd pages we have got over 50 updated, this being the more important ones.

Ill tell you what, ill update the api 8 economy plugin next

creatorfromhell commented 1 year ago

Im actually the only guy left working on the sponge docs for API 8 and I dont have a lot of free time to do so. But out of the 250odd pages we have got over 50 updated, this being the more important ones.

Ill tell you what, ill update the api 8 economy plugin next

lol, the mains docs I look for on new implementations are things relating to inventories/item meta/player-related functions such as viewing different inventories as TNE uses TNIL for item stuff so I don't have to implement everything twice.

mosemister commented 1 year ago

Fair enough. The item stuff i have updated the docs for already, however its on hold due to a issue in sponge when it comes to getting item type data.

Inventories, the main logic has stayed the same and thats why i havent updated it myself. The main difference is InventoryMenus which have been documented.... If briefly (its on my todo list to update it further but low priority)

As for player stuff, we now support the client so the player got split into ClientPlayer and ServerPlayer, but method wise, its relatively the same.

My next priory is Data pages, as -in sponge- everything comes back to Keys and that should handle the basics of most things.

There are also example plugins and ive answered a lot of questions before i became part of the docs team on the forums, but i get waiting for the docs to be updated rather then going on a wild goose chase.

Inventory Menus https://docs.spongepowered.org/stable/en/plugin/inventory/menu.html

creatorfromhell commented 1 year ago

Fair enough. The item stuff i have updated the docs for already, however its on hold due to a issue in sponge when it comes to getting item type data.

Inventories, the main logic has stayed the same and thats why i havent updated it myself. The main difference is InventoryMenus which have been documented.... If briefly (its on my todo list to update it further but low priority)

As for player stuff, we now support the client so the player got split into ClientPlayer and ServerPlayer, but method wise, its relatively the same.

My next priory is Data pages, as -in sponge- everything comes back to Keys and that should handle the basics of most things.

There are also example plugins and ive answered a lot of questions before i became part of the docs team on the forums, but i get waiting for the docs to be updated rather then going on a wild goose chase.

Inventory Menus https://docs.spongepowered.org/stable/en/plugin/inventory/menu.html

The main thing I was looking for was there use to be a Plugin class (org.spongepowered.api.plugin.Plugin) was it replaced with something or? If I remember correctly, it was required for building inventories before.

mosemister commented 1 year ago

Yes and no.

So the @Plugin is still there, but we no longer use the main class as a reference to the plugin. Instead we use PluginContainer now which is received as a Inject field in your main class.

Plugin main class docs

https://docs.spongepowered.org/stable/en/plugin/plugin-class.html

Inventory creation docs (on my todo list to update futher)

https://docs.spongepowered.org/stable/en/plugin/inventory/creating.html

creatorfromhell commented 1 year ago

Yes and no.

So the @Plugin is still there, but we no longer use the main class as a reference to the plugin. Instead we use PluginContainer now which is received as a Inject field in your main class.

Plugin main class docs

https://docs.spongepowered.org/stable/en/plugin/plugin-class.html

Inventory creation docs (on my todo list to update futher)

https://docs.spongepowered.org/stable/en/plugin/inventory/creating.html

👍 I think I got it. Suppose we'll figure it out after I update my last library.

creatorfromhell commented 1 year ago

Currently in the testing phase for this. The current unsupported stuff is anything to do with items, as that's mainly where most of the questions are. I'm hoping the command framework update I did works as intended xD

creatorfromhell commented 1 year ago

https://cdn.discordapp.com/attachments/995859452232220793/1132646975980970064/image.png Works on Sponge minus the item stuff currently, and some annoying tab completion errors from the command framework.

mosemister commented 1 year ago

Currently in the testing phase for this. The current unsupported stuff is anything to do with items, as that's mainly where most of the questions are. I'm hoping the command framework update I did works as intended xD

What item stuff is unsupported? If your refering to the blocker in docs, you can bypass it by using the getters on ItemStacks. Its just not good for docs

creatorfromhell commented 1 year ago

Currently in the testing phase for this. The current unsupported stuff is anything to do with items, as that's mainly where most of the questions are. I'm hoping the command framework update I did works as intended xD

What item stuff is unsupported? If your refering to the blocker in docs, you can bypass it by using the getters on ItemStacks. Its just not good for docs

The item stuff is from the library I use to abstract off platforms. Not that it's unsupported by Sponge, just inside TNE currently. It's more or less me figuring out the sponge alternative to Bukkit's Meta Data, which I'm assuming is tied to the keys. so now it's just getting all of that and compiling it together. (https://github.com/TheNewEconomy/TheNewItemLibrary)

mosemister commented 1 year ago

Ah lol fair. Yeah your right.

All itemstack data is contained in a single object and access typically by keys (in api 8 you can also be done by method ... But the methods just modify the keys)

creatorfromhell commented 1 year ago

Will Keep a list of what needs to update here for the item lib:

TODO:

creatorfromhell commented 1 year ago

image We can now receive item currency. It just doesn't calculate it properly yet.

creatorfromhell commented 1 year ago

Fixed. equalTo, I forgot, takes into account quantity.

creatorfromhell commented 1 year ago

https://cdn.discordapp.com/attachments/1121927366961279046/1132856160697995353/Sponge8Core-0.1.2.0-Pre-16.jar

So everything is working from what I've seen minus tab completion, and I think command permissions are slightly messed up. (so this build is for testing only really). Also, the above item data I still need to find the relevant keys for them so that'll be a WIP too.

mosemister commented 1 year ago

Nice quick build. I love it :)

creatorfromhell commented 1 year ago

Nice quick build. I love it :)

Indeed, once I get the command stuff sorted should get a more realistic viewpoint, interested to start testing more of the item stuff too once I get the commands sorted to see all the key data that may have been missed.

Also, out of curiosity is Sponge7 worth supporting? Is it still widely used? And then also 9/11?

mosemister commented 1 year ago

Nice quick build. I love it :)

Indeed, once I get the command stuff sorted should get a more realistic viewpoint, interested to start testing more of the item stuff too once I get the commands sorted to see all the key data that may have been missed.

Also, out of curiosity is Sponge7 worth supporting? Is it still widely used? And then also 9/11?

Do you need help with commands?

Sponge 7, it has its users, you will find comments about it in the forums or discord (got a comment this morning asking for plugin recommendations on it). But its user base is slowly transfering to sponge 8+. So personally i wouldnt bother.

As for 9+, as it doesn't have a forge version (yet - development has started for 10) so its userbase is even smaller. BUT code wise, unless your api 8 code does some interesting things (such as world generation, or Tag manipulation outside checking if a item/block is within a tag, or chat messages (thanks to 1.19.x report system)) then your api 8 code should work on 9-11. That being said, do check.

Most people who use 9+ do understand that api 8 is what most developers are targetting and that most of the time, they can run api 8 plugins without hassle.

So personally i would focus on api 8, if it works on api 9+ then great, but i wouldnt officially support it until the forge edition comes or your plugin is so stable on api 8 that you want to support more

creatorfromhell commented 1 year ago

Nice quick build. I love it :)

Indeed, once I get the command stuff sorted should get a more realistic viewpoint, interested to start testing more of the item stuff too once I get the commands sorted to see all the key data that may have been missed. Also, out of curiosity is Sponge7 worth supporting? Is it still widely used? And then also 9/11?

Do you need help with commands?

Sponge 7, it has its users, you will find comments about it in the forums or discord (got a comment this morning asking for plugin recommendations on it). But its user base is slowly transfering to sponge 8+. So personally i wouldnt bother.

As for 9+, as it doesn't have a forge version (yet - development has started for 10) so its userbase is even smaller. BUT code wise, unless your api 8 code does some interesting things (such as world generation, or Tag manipulation outside checking if a item/block is within a tag, or chat messages (thanks to 1.19.x report system)) then your api 8 code should work on 9-11. That being said, do check.

Most people who use 9+ do understand that api 8 is what most developers are targetting and that most of the time, they can run api 8 plugins without hassle.

So personally i would focus on api 8, if it works on api 9+ then great, but i wouldnt officially support it until the forge edition comes or your plugin is so stable on api 8 that you want to support more

Commands is mainly the framework doesn't support sponge 8. I may switch everything to cloud framework, if you have something in mind that works I would accept a PR if you wanted to. Mainly looking for something that supports a lot of platforms. After Sponge, fabric will probably be the next platform I look at so preferably something with fabric support too.

mosemister commented 1 year ago

The only platform i know that supports a lot of platforms (not all) is the minecraft official brigider. I know its lacking api support on the bukkit side of things (i think paper has a pr for it) but it can run

creatorfromhell commented 1 year ago

The only platform i know that supports a lot of platforms (not all) is the minecraft official brigider. I know its lacking api support on the bukkit side of things (i think paper has a pr for it) but it can run

Indeed, I know cloud has fabric support and sponge 8 in a pr

mosemister commented 1 year ago

Not sure what you have done currently but you can register your commands under Raw command which is similar to bukkit API's default command system if that helps

creatorfromhell commented 1 year ago

Not sure what you have done currently but you can register your commands under Raw command which is similar to bukkit API's default command system if that helps

I saw that aspect. My main concern was with registration, is that solely through the event or is there a way to register commands outside of the event?

mosemister commented 1 year ago

So thanks to how 1.13+ treats datapacks, commands should be registered during the datapacks initiation.

Bukkit gets around this issue by rewriting the vanilla code (but it does also register commands on initiation using the commands in the plugin.yml). Sponge, due to the forge connection as well as the ease of custom implementations does not have this option.

So long story short, offically though the Sponge API, yes its the only way to register commands.

Unofficially, you can register commands outside this event and then send the command packet back to the player (in sponge we have a updateCommands method for a server player - this is meant to be for permission updates) however this may lead to compatibility issues with forge mods and maybe some data packs

creatorfromhell commented 1 year ago

So thanks to how 1.13+ treats datapacks, commands should be registered during the datapacks initiation.

Bukkit gets around this issue by rewriting the vanilla code (but it does also register commands on initiation using the commands in the plugin.yml). Sponge, due to the forge connection as well as the ease of custom implementations does not have this option.

So long story short, offically though the Sponge API, yes its the only way to register commands.

Unofficially, you can register commands outside this event and then send the command packet back to the player (in sponge we have a updateCommands method for a server player - this is meant to be for permission updates) however this may lead to compatibility issues with forge mods and maybe some data packs

Fair enough, I'm already planning on switching to Cloud if I can't correct the permissions and tab completion in the current framework(not that I tried that much to figure it out), then everything should work as intended.

mosemister commented 1 year ago

Fair enough. As far as my testing the sponge command system does work permissions wise and gives off the correct argument suggestions. Not sure what you have done to break it ;)

creatorfromhell commented 1 year ago

Fair enough. As far as my testing the sponge command system does work permissions wise and gives off the correct argument suggestions. Not sure what you have done to break it ;)

It's not broke on the sponge side, it's on the command framework library side.

creatorfromhell commented 1 year ago

Fair enough. As far as my testing the sponge command system does work permissions wise and gives off the correct argument suggestions. Not sure what you have done to break it ;)

image nvm, updated the current command library myself xD

sponge 8 should now be on par with the paper/bukkit builds.

https://discord.com/channels/267902896970924036/1121927366961279046/1133188112034578453

EDIT: Apparently I forgot to implement the Sponge EconomyService so I'll do that now.

mosemister commented 1 year ago

When implementing the economy service dont forget about the economy event (Xconomy doesnt fire it and its caused a lot of confusion to developers)

creatorfromhell commented 1 year ago

When implementing the economy service dont forget about the economy event (Xconomy doesnt fire it and its caused a lot of confusion to developers)

Are you talking about the EconomyTransactionEvent? Does that have to be thrown by the economy service manually during the transaction methods?

mosemister commented 1 year ago

To be honest, i havent looked too much into the economy service for api 8, just know that xconomy doesnt throw it, so my guess is your plugin implementing the economy service should throw the event.

When i get some time ill look into the Economy service myself and double check

creatorfromhell commented 1 year ago

To be honest, i havent looked too much into the economy service for api 8, just know that xconomy doesnt throw it, so my guess is your plugin implementing the economy service should throw the event.

When i get some time ill look into the Economy service myself and double check

Cheers, thank you for all the assistance.

creatorfromhell commented 1 year ago

@mosemister https://cdn.discordapp.com/attachments/1121927366961279046/1133562259600322651/Sponge8Core-0.1.2.0-Pre-16.jar

Service provider is implemented now. Should make this ticket complete. Good to know new platform implementation time is 4 days. I'll close this issue tomorrow to make sure nothing major pops up.

image

mosemister commented 1 year ago

Nice. Thanks

creatorfromhell commented 1 year ago

Nice. Thanks

You're welcome, I'll have to get an Order page ready, just have to notate it's a beta build.

mosemister commented 1 year ago

Cool. Yeah you can mark builds as pre-release as well as put labels on the download

creatorfromhell commented 1 year ago

Marking as closed, as further bugs will be new issues.

creatorfromhell commented 12 months ago

Cool. Yeah you can mark builds as pre-release as well as put labels on the download

https://ore.spongepowered.org/TheNewEconomy/TheNewEconomy

creatorfromhell commented 11 months ago

@mosemister, not to necro this(I noticed you weren't in the discord), but I was wondering if you've tried the Sponge build, and if so, have there been any issues?

mosemister commented 11 months ago

I havent tried it yet. Going to be writing the eco docs soon and at that point ill be using your plugin

mosemister commented 11 months ago

@creatorfromhell

Finally got round to updating the Economy docs and with the testing I did with your plugin, it holds up.

I do also have a bukkit translation layer being developed and im going to be including a vault to sponge economy translation so Ill be using your plugin to test that too. So if I have any issues from that, ill make a issue here ;)

Great work and thank you for supporting Sponge

creatorfromhell commented 11 months ago

@creatorfromhell

Finally got round to updating the Economy docs and with the testing I did with your plugin, it holds up.

I do also have a bukkit translation layer being developed and im going to be including a vault to sponge economy translation so Ill be using your plugin to test that too. So if I have any issues from that, ill make a issue here ;)

Great work and thank you for supporting Sponge

Cheers. Just keep me updated with any issues.