Communication mod with plugin

Hello, I have a question related to the plugin “Economyelite (2.15.1)” and the mod “Custom NPCs_1. 12. 2”. I write here to learn about the ways of communication of the mod and the plugin. Is it possible to make a reward for the quest by adding money to the balance of “Economy elite”?

Both plugins and mods are ran on the same class loader. This means that communication between a mod and plugin will be perfect. It would be like a plugin talking to another plugin.

The issue is how well the plugins take on the concept of OOP. If the plugin (s) don’t take on this concept its very challenging to talk to the plugins

1 Like

Solved the problem by writing the command /econ adm @dp “amount” in the “console” field immediately after the “reward” field in the custom NPC mod

If you ever wanted to go the CustomNPC scripting route; i made this:

var UUID = Java.type("java.util.UUID"); //loads Java UUID
var BigDecimal = Java.type("java.math.BigDecimal"); //loads Java BigDecimal
var Sponge = Java.type("org.spongepowered.api.Sponge"); //loads Sponge API
var EconomyService = Sponge.getServiceManager().provideUnchecked(Java.type("org.spongepowered.api.service.economy.EconomyService").class) //gets Economy Service from Sponge API.

function interact(event){
    var uuid = event.player.getUUID();
    var account = EconomyService.getOrCreateAccount(UUID.fromString(uuid)) //gets Economy Account for the Player.
    var value = new BigDecimal(5) //value in () is value to be deposited. must be integer; in this example 5
    var currency = EconomyService.getDefaultCurrency() //gets DefaultCurrency of the Economy Plugin
    var cause = Sponge.getCauseStackManager().getCurrentCause() //gets the Cause Manager from Sponge

        account.get().deposit(currency,value,cause) //deposit amount of value into players account.
}

when you click on an NPC this will deposit 5 of the default sponge econ to your account.

1 Like