Skip to content

Groovy Format

Misat11 edited this page May 30, 2020 · 4 revisions

Groovy format

This library can use .groovy files for guis!

How to load .groovy? (For Developers)

Just load it with this simple structure!

import org.screamingsandals.simpleinventories.SimpleInventories;
import org.screamingsandals.simpleinventories.inventory.Options;

...
Options options = new Options(myAwesomePlugin);

// some configuration

SimpleInventories format = new SimpleInventories(options);

try {
  format.loadFromDataFolder(plugin.getDataFolder(), "gui.groovy");
} catch (Exception e) {
  e.printStackTrace();
}
...

Gui.groovy example (For Server Owners)

f you are not sure if your format is correct, just try it with SimpleInventories-Plugin and look at console! We don't know any online groovy checker.

inventory {
  category('DIAMOND_CHESTPLATE;1;Armor') {
    item('...') {
      /* use properties! We don't support custom variables in groovy shop (ok, it's possible via getItemMap().put('key', 'value')) */
      property 'myCustomProperty', [
        myCustomVariable: 'myCustomValue',
        myCustomVariable2: 'myCustomValue2'
      ]
    }
    category('...') {
      category('...') {
        item('...')
        item('...')
      }
      item('...')
    }
  }
}
Clone this wiki locally