Mod develops and invokes economic API

I’m currently developing a mod. Note! Mod is not a plug-in
Now the economic API is invoked in this mod.
This API is currently available to obtain account balances.
But there are difficulties in modifying account balances.

This is the official method, but what should I fill in for the variable mod (plugin Container) that I developed?
I tried to fill in “null” on the red line, but it didn’t work.

I already answered this:

Hello! I’ve read this, but I don’t have this package in my api. I use 7.0.0.
Is the 7.1.0 version of the API required?

You don’t need any of that, I was just showing that we make a ModContainer into a PluginContainer. I said:

You need to get the ModContainer for your mod, (one way is Loader.instance().getIndexedModList().get(your mod ID);) and then cast it (so

PluginContainer container = (PluginContainer) (Loader.instance().getIndexedModList().get(your mod ID));

You might be able to get the Sponge PluginContainer through Sponge too:

Sponge.getPluginManager().fromInstance(`your class annotated with @Mod`);

but I don’t know if that will work.

Thank you very much for your patience. Thank you.

1 Like