BowWarfare porting from Bukkit

I believe It’s a plugin with an API.

The API is platform agnostic.

I opened an issue on github :wink:

bye, hitech95

You might want to use Sponge’s build in SqlService instead of a third party API. Just keep in mind that the SQL you are writing needs to work with various databases, not just with SQLite or MySQL.

Yup only standard Mysql…
DBMS that I have to support?

Do you have an example? Or something other than the javadocs?

Bye, hitech95

SqlService is documented at

1 Like

After some time, I’m here.
I have a question: all the annotations (Inject, defaultconfig, Subscribe, etc …) must be in the main class?

Not all, @Inject (and the config injection annotations @DefaultConfig, @ConfigDir) can only be used in the main plugin class, but @Subscribe can be used from and class, as long as it’s registered with the EventManager. Also note that StateEvents can only be subscribed from the main class.

Too bad, the main class will be a mix of things …

Is there a better way to read an array from the configuration?

this.authors = Iterables.toArray(Iterables.transform(sqlNode.getNode("authors").getChildrenMap().keySet(), Functions.toStringFunction()), String.class);

My solution seems quite inefficient.

Does anyone have any idea on how to save array of custom objects?

Serialize each field and put it in a String list. Unsure if Sponge provides something else.

@zml Made configurate so he will know best.
Look into ObjectMapper

There is getList which takes a Function<Object, T> which will transform the objects into the list with the generic List<T>

I had seen, but I did not understand how to use…
Do you have an example?

Simple question: how do I make a mandatory parameter of a command if the previous is specified?

webconsole/ at master · zml2008/webconsole · GitHub is an example object-mapped class
webconsole/ at master · zml2008/webconsole · GitHub is the line that loads the config itself

To make an argument required based on previous arguments, you’ll want to use the firstParsing() element – each argument to firstParsing is a change of arguments for each different format possibility.

Now I give it a look. There is also a way to save directly the obj?

Do you have an example?

My command is:
/bw say you to type /bw help for help, but you have also to specify the page of help:
/bw help staff

EDIT: my code: → This is a custom OBJ. I wish it could be read and saved directly.

It would also be useful to know how to read an enum from the configuration.
It 'a shame that it is documented that bad.