@Command(aliases = "poke", description = "Poke someone.")
publicvoidpoke(@SenderPlayerplayer, @Argument("player") Playerother) {
other.playSound(other.getLocation(), Sound.GLASS, 100, 50);
player.sendMessage(color("&eYou have poked &a" + other.getName() + "&e."));
other.sendMessage(color("&eYou have been poked by &a" + player.getName() + "&e!"));
}
3. Menu
@MenuMeta(aliases = "example", title = "&lTesting")
publicclassExampleMenuimplementsMenu {
@OverridepublicTable<Integer, ItemStack, MenuAction> render(Playerplayer) {
Table<Integer, ItemStack, MenuAction> table = HashBasedTable.create();
/* Fill bedrock around the inventory. */Menus.fill(table, newItemStack(Material.BEDROCK), 3, RowType.AROUND);
/* Set a nether star in the middle. */table.put(13, newItemStack(Material.NETHER_STAR), clickType -> {
player.closeInventory();
player.sendMessage(ChatColor.GOLD + "You just clicked a star!");
returntrue;
});
returntable;
}
}