Setup
Once you have the plugin in your plugins/ folder, you need to add the books and the relevant chapters to the plugin directory.
Everything is dependent on file structure. Every folder under Library will be displayed as a book. Every text file under a book will be a chapter, except the information.txt file. As seen below.
plugins/
├─ Library/
│ ├─ Odyssey/
│ │ ├─ 1_1.txt
│ │ ├─ 2_2.txt
│ │ ├─ 3_3.txt
│ │ ├─ 4_4.txt
│ │ ├─ 5.txt
│ │ ├─ 5_ending.txt
│ │ ├─ information.txt
├─ Library.jar
The number before the underscore in the text file name denotes placement when listing off chapters in the book. The second number is just the name of the chapter. As such '<placement>_<name>.txt'
Note that without the placement number and underscore, the placement of chapters when displayed to the player will be completely unpredictable, and items with placement numbers will always come before those without.
Finally, information.txt has to look like the following...
author: Homer
description: The Odyssey is an epic poem in 24 books traditionally attributed to the ancient Greek poet Homer.
So when calling '/read Odyssey', the output will look something like this...
The Odyssey is an epic poem in 24 books traditionally attributed to the ancient Greek poet Homer.
Type `/read Odyssey <chapter>` to view chapters for the book.
Below is a list of currently available chapters...
1, 2, 3, 4, ending, 5
Do note that the largest size of a book is 100 pages, so if you have any books that need to be larger, split the chapters into 2.
Additionally, be cognizant that too many books in one chunk can cause players in that chunk to crash (blame 2b2t for that).
Permissions
Five permissions come by default
- library.read: Needed to use the '/read' command
- library.read.books: Needed to use the '/read <bookname>'
- library.read.books.chapter: Needed to use the '/read <bookname> <chapter>' and get book
- library.library: Needed to use the '/library' command
- library.library.book: Needed to use the '/library <bookname>' command
Then there are permissions which are created upon making a book. It will be in the format 'library.<bookname>' to be able to read the description of the book and get all chapters of the book. Then there is the permission 'library.<bookname>.<chapter>' which allows the user to only read that chapter from the book.