[Glofal] Economy and ConfigurationAPI Plugin

We want to make a simple economy plugin for the sponge-api.


If you want to help us, you can go to the following links and push your ideas to make the plugin more awesome and plain.

We want to reach, into mentality, the vault plugin from bukkit.


API Example

EconomyPlugin.getEconomyService().setBalance( player, amount );
EconomyPlugin.getEconomyService().getBalance( player ); //return the player's balance!

The plan for this plugin is to make a local json database to save the money balance for any player-user.

{"players":[
    {
        "f3c17b91-2e7f-4361-bc94-25d4aea06933": 0.2
    }
]}

Database-Configuration API

The database-configuration api based to gson.

First step:

Create the ExampleConfig class with the Configuration annotation!

@Configuration( "config" )
public class ExampleConfig
{
    public boolean        enabled         = true;
    public long           announcersDelay = 600;
    public List< String > announcers      = new ArrayList<>();
}

Second step:

Create a new ConfigurationDriver at your plugin class!


@Plugin( id = "example", name = "Example", version = "1.0.1" )
public class Example
{
    protected ConfigurationDriver<ExampleConfig> configurationDriver;
    @Inject
    @DefaultConfig( sharedRoot = true )
    protected File configuration;
    
    @Subscribe
    public void onPreInitialization( PreInitializationEvent event )
    {
        configurationDriver = new ConfigurationDriver<>(ExampleConfig.class, Paths.get(configuration.getParent() );
        configurationDriver.load().save();
    }
}

Preview

  • command: /money

  • command: ‘/setmoney’ with database file

Glofal?

The glofal intend for the multi-plugins package (Only for SpongeAPI)!

2 Likes

A bit more information in this topic would be nice. :smile:

2 Likes

Glofal? Is this intended?

Glofal, which glofal? :trollface:

I thought lapisblue was also working on something like this. I think the plugin is called LapisCommon.