Library Books

Library-Books

A simple plugin, which allows you to easily add books into your Minecraft server.

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).

Commands

20fd2e023b12a67d50d55b4a19cee9cf52ecabb9

Type /read to list off books contained within the plugins/Library directory on your server.

Type /read <bookname> to list off chapters and description of book contained within plugins/Library/<bookname> directory.

Type /read <bookname> <chapter> to get the Minecraft book with the chapter's text of the full book contained within /plugins/Library/<bookname>/<chapter>.txt file.

20fd2e023b12a67d50d55b4a19cee9cf52ecabb9

Type /library to view an interactive inventory with every book and their information.

Type /library <bookname> to view an interactive inventory with every chapter from the book.

Screenshot 2023-02-21 at 5 44 41 PM

Screenshot 2023-02-21 at 5 44 58 PM

Permissions

Five permissions come by default

  1. library.read: Needed to use the /read command
  2. library.read.books: Needed to use the /read <bookname>
  3. library.read.books.chapter: Needed to use the /read <bookname> <chapter> and get book
  4. library.library: Needed to use the /library command
  5. 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.

 

Source Code

The source code is hosted on GitHub under the MIT license, located at github.com/BjornTheProgrammer/Library-Books/


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    827766
  • Created
    Feb 17, 2023
  • Last Released File
    Never
  • Total Downloads
    387
  • License

Categories

Members

Recent Files

Bukkit