Skip to content

Latest commit

 

History

History
46 lines (39 loc) · 1.11 KB

README.md

File metadata and controls

46 lines (39 loc) · 1.11 KB

DataComponentAPI

This is a simple API for data component!

Usage in library plugin

public class TestPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        var apply = DataComponentAPI.api().adapter(new ItemStack(Material.DIAMOND_SWORD));
        apply.set(NMS.nms().damage(), 3);
        apply.set(NMS.nms().repairCost(), 20);
        apply.set(NMS.nms().rarity(), Rarity.EPIC);
        getLogger().info(apply.serialize().toString());
    }
}

Usage in shade

public class TestPlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        DataComponentAPIBukkit.load();

        var apply = DataComponentAPI.api().adapter(new ItemStack(Material.DIAMOND_SWORD));
        apply.set(NMS.nms().damage(), 3);
        apply.set(NMS.nms().repairCost(), 20);
        apply.set(NMS.nms().rarity(), Rarity.EPIC);
        getLogger().info(apply.serialize().toString());
    }
}

How to use

repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.toxicity188:DataComponentAPI:master-SNAPSHOT")
}