PlanLite API

Jan 16, 2017
PlanLite API
  • API Code on Github

    Importing PlanAPI:
    Code (Text):
    import com.djrapitops.planlite.api.API
    import com.djrapitops.planlite.api.DataPoint
    import com.djrapitops.planlite.api.DataType
    import static;

    API api = getPlugin(PlanLite.class).getAPI();
    Adding datahooks to PlanLite:
    You need a class that implements Hook:
    Code (Text):
    import java.util.HashMap;

    public interface Hook {

        public HashMap<String, DataPoint> getData(String player) throws Exception;
        public HashMap<String, DataPoint> getAllData(String player) throws Exception;

    Please note that data in the returned HashMap<String, DataPoint> should be format:
    Code (Text):
    data.put("XXX-DATA POINT NAME", new DataPoint(yourDataString, DataType.TYPE);
    where XXX is a plugin identifier given by you. Only text after the identifier is shown to players.

    After you have your class, you can use the API during your plugins start-up to register the hook:
    Code (Text):
    Hook hook = new YourHookClass();
    api.addExtraHook("YourPluginName", hook);
  • Loading...
  • Loading...