πFull Example
These are examples! They should not be solutions that can simply be copied!
Did you know? You can also use all methods for the AnvilGUI that are available in the RyseInventory Builder. E.g. You want to be able to take out the item on the left? Say in the builder .ignoredSlots(0).
Code
We give the Anvil a title. In this case "Anvil test".
We define the inventory as ANVIL.
We override the "anvil" method.
In the slot 0 (left item) we put a paper.
If we change the input above and click on the output, Bukkit.broadcastMessage(completion.getText()) will show us our input that we made.
After that we set our input to "a".
RyseInventory.builder()
.title("Anvil test")
.type(InventoryOpenerType.ANVIL)
.provider(new InventoryProvider() {
@Override
public void anvil(Player player, RyseAnvil anvil) {
anvil.itemLeft(IntelligentItem.empty(new ItemStack(Material.PAPER)));
anvil.onComplete(completion -> {
Bukkit.broadcastMessage(completion.getText());
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("a"));
});
}
})
.build(this)
.openAll();
Result
Last updated