Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
portlek committed Oct 5, 2024
1 parent 6367ab2 commit 212cccc
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
});
}
}
```

0 comments on commit 212cccc

Please sign in to comment.