BookFiles – Easy to use API to create Custom Books for GameModes.
If you ever have created a Minigame, you know how hard it is to create instruction books. You need to write every single page in your java code, and honestly – it looks horrible.
Well, that’s why I created BookFiles!
BookFiles allows you to create your Book ingame, save it as a file, and load it in another plugin afterwards as Book!
This saves a lot of time for a work, which has mostly just cosmetical fixes to do.
How to save a book and load it afterwards:
- Load the BookFiles.jar, and save it on your server.
- Type /bookfile new , use the book and write your content!
- Type /bookfile save <optional filename> and press enter.
Example Screenshot:
After you have saved your file, you can load it from your custom plugin via:
//Loads the .book File as ItemStack from the Folder: /server/plugins/BookFiles/books
BookFiles.getBook(String filename,String title,String author)
Or
//Loads the .book File from a custom Folder.
BookFiles.getBookFromExtern(File folder, String filename, String title,String author)
These methods will create an ItemStack from the given File which you can use however you want!
Example Plugin
package com.horizon.test;
import com.horizon.books.BookFiles;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Test extends JavaPlugin implements Listener {
public void onEnable(){
if(!this.getDataFolder().exists())
this.getDataFolder().mkdirs();
Bukkit.getPluginManager().registerEvents(this,this);
}
@EventHandler
void onJoin(PlayerJoinEvent e){
e.getPlayer().getInventory().clear();
ItemStack book = BookFiles.getBookFromExtern(this.getDataFolder(),"Testbuch","§6Anleitung TRM","TheSilentHorizon");
e.getPlayer().setItemInHand(book);
}
}
Commands and their permissions
/bookfile help - Shows you all commands useable with bookfile.
Permission: book.help
/bookfile new - Creates a new Book and Quill
Permission: book.new
/bookfile save <optional filename> - Saves the Book as .book
Permission: book.save
Any questions?
Feel free to pm me! If you have questions or tips for this API, write them in the comments!
--------------------------------------------------------------------------------------------------
Uses CommandFramework by minnymin3:
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta