diff --git a/README.md b/README.md index 9e1690b..5c06616 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,49 @@ dependencies { } ``` ### Code -```kotlin -fun main() { +```java +public final class Plugin extends JavaPlugin { + + private final Frame frame = Frame.create(this) + .with(); + + @Override + public void onEnable() { + + } +} + +public final class View implements ViewHandler { + + @Override + public void onInit(@NotNull final ContextInit ctx) { + ctx.configBuilder().type(InvType.CHEST).cancelOnClick(); + } + + @Override + public void onOpen(@NotNull final ContextOpen ctx) { + final Viewer viewer = ctx.viewer(); + ctx + .modifyConfig() + .layout(new String[] { + "xxxxxxxxx", + "xxxxaxxxx", + "xxxxxxxxx" + }) + .title("Player: " + viewer.player().getName()); + } + + @Override + public void onFirstRender(@NotNull final ContextRender ctx) { + ctx.layoutSlot('x', new ItemStack(Material.GRAY_STAINED_GLASS_PANE)); + + ctx + .layoutSlot('a', new ItemStack(Material.DIAMOND)) + .cancelOnClick() + .onClick(context -> { + context.closeForViewer(); + context.clicker().sendMessage("You've clicked to a diamond!"); + }); + } } ```