Creating Complex Placeholder

Introduction

ComplexPlaceholder allows you to make a list of entry to put into your Tablist Layout.

Using Built-In Library

There is already a premade library so you don't have to implement ComplexPlaceholder interface to your class.

public class ExamplePlugin extends JavaPlugin {
    public void onEnable() {
        ArrayListComplex<String> str = 
            new ArrayListComplex<>(
                "customList", // placeholder name
                ArrayListComplex.stringify() // converter
                );
        // overflow entry text
        str.setOverflowFormat("... and {overflowCount} more...");
        str.registerPlaceholder(); // register the placeholder
        ArrayList<String> list = str.getList();
        list.add("This is sample text");
        list.add("Another line");
        list.add("Multiline!");
        list.remove(0);
    }
}

/*
Usage in your global.yml
columns:
- items:
  - "{customList}"
*/

// USING CUSTOM CONVERTER
public class ExamplePlugin extends JavaPlugin {
    public void onEnable() {
        ArrayListComplex<Player> str = 
            new ArrayListComplex<>(
                "customList", // placeholder name
                ArrayListComplex.stringify() // converter
                );
        str.registerPlaceholder(); // register the placeholder
        ArrayList<Player> list = str.getList();
        list.add(getServer().getPlayer("Septogeddon"));
    }
}

public class ExampleConverter implements Function<Player, ExtraData> {

    public ExtraData apply(Player p) {
        return new Slot().display(p.getPlayerListName()).skin(p);
    }

}

Last updated