Skip to content

Creating a GraveProvider

Christian W. edited this page Sep 21, 2025 · 3 revisions

Modules Main Class

package dev.cwhead.GravesX.example;

import dev.cwhead.GravesX.api.provider.GraveProvider;
import dev.cwhead.GravesX.module.GravesXModule;
import dev.cwhead.GravesX.module.ModuleContext;

public final class ExampleModule extends GravesXModule {

    private ModuleContext ctx;
    private GraveProvider provider;

    @Override 
    public void onModuleLoad(ModuleContext ctx) {
        this.ctx = ctx;
        provider = new ExampleGraveProvider();
    }

    @Override 
    public void onModuleEnable() {
        ctx.registerService(GraveProvider.class, provider);
    }

    @Override 
    public void onModuleDisable() {
        ctx.unregisterService(GraveProvider.class, provider);
    }
}

Making Custom GraveProvider

package dev.cwhead.GravesX.example;

import com.ranull.graves.data.EntityData;
import com.ranull.graves.type.Grave;
import dev.cwhead.GravesX.api.provider.GraveProvider;
import org.bukkit.Location;

public final class ExampleGraveProvider implements GraveProvider {

    @Override 
    public String id() {
        return "example:demo";
    }

    @Override
    public int order() {
        // Sets the priority
        return 0;
    }

    @Override 
    public void place(Location location, Grave grave) {
        // Handle grave placement
    }

    @Override 
    public void remove(Grave grave) {
        // Handle grave removal
    }

    @Override 
    public boolean isPlaced(Grave grave) {
        // Handle to see if the grave is placed at that location
        return false;
    }

    @Override 
    public boolean supports(EntityData data) {
        // Check if there is supports
        return false;
    }

    @Override 
    public boolean removeEntityData(EntityData data) {
        // Handles Removing Entity Data (if provided)
        return false;
    }
}

Clone this wiki locally