parent
c2ab3deee7
commit
c2bad88008
3 changed files with 53 additions and 2 deletions
@ -0,0 +1,46 @@ |
||||
package xyz.mineconomia.mineconomiacore.BookHandler; |
||||
|
||||
import org.bukkit.Material; |
||||
import org.bukkit.command.Command; |
||||
import org.bukkit.command.CommandExecutor; |
||||
import org.bukkit.command.CommandSender; |
||||
import org.bukkit.entity.Player; |
||||
import org.bukkit.inventory.ItemStack; |
||||
import org.bukkit.inventory.meta.BookMeta; |
||||
|
||||
public class BookCommand implements CommandExecutor { |
||||
@Override |
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { |
||||
if (sender instanceof Player) { |
||||
Player player = (Player) sender; |
||||
|
||||
//Create a Book
|
||||
ItemStack book = new ItemStack(Material.WRITTEN_BOOK); |
||||
BookMeta bookMeta = (BookMeta) book.getItemMeta(); |
||||
|
||||
//Book Info (irrelevant)
|
||||
bookMeta.setTitle("POMOC"); |
||||
bookMeta.setAuthor("SERVER"); |
||||
|
||||
//PG1
|
||||
bookMeta.addPage("§l§11text\n" + |
||||
"§o§21text text\n" + |
||||
"§l§31text:text\n" + |
||||
"§o§41texttexttexttext.\n" + |
||||
"§l§51text -- text\n" + |
||||
"§o§61text x text"); |
||||
|
||||
//PG2
|
||||
bookMeta.addPage("§l§72text\n" + |
||||
"§o§82text text\n" + |
||||
"§l§92text:text\n" + |
||||
"§o§02texttexttexttext.\n" + |
||||
"§l§12text -- text\n" + |
||||
"§o§22text x text"); |
||||
|
||||
book.setItemMeta(bookMeta); //Gluing The Book Together
|
||||
player.openBook(book); //Opening Book After Typing Command
|
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue