Merge branch 'master' into knarlib
This commit is contained in:
commit
16954f22e3
142
README.md
142
README.md
@ -40,64 +40,64 @@ Books without Borders has got your back!
|
|||||||
|
|
||||||
An in-game description of available commands is available through the /bwb command.
|
An in-game description of available commands is available through the /bwb command.
|
||||||
|
|
||||||
| Command | Arguments | Description |
|
| Command | Arguments | Description |
|
||||||
| --- | --- | --- |
|
|----------------------|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| /bookswithoutborders | None | Displays information about commands (and permissions if the user has bookswithoutborders.admin) |
|
| /bookswithoutborders | None | Displays information about commands (and permissions if the user has bookswithoutborders.admin) |
|
||||||
| /copybook | \<# of copies> | Copies the book the player is holding |
|
| /copybook | \<# of copies> | Copies the book the player is holding |
|
||||||
| /decryptbook | \<key> | Decrypts the book the player is holding. "key" is required and MUST be IDENTICAL to the key used to encrypt the held book |
|
| /decryptbook | \<key> | Decrypts the book the player is holding. "key" is required and MUST be IDENTICAL to the key used to encrypt the held book |
|
||||||
| /deletebook | \<file name or number> | Deletes the specified file in the player's directory |
|
| /deletebook | \<file name or number> | Deletes the specified file in the player's directory |
|
||||||
| /deletepublicbook | \<file name or number> | Same as deletebook, but deletes files in the public directory |
|
| /deletepublicbook | \<file name or number> | Same as deletebook, but deletes files in the public directory |
|
||||||
| /encryptbook | \<key> \[encryption style] | Encrypts the book the player is holding. "key" is required and can be any phrase or number excluding spaces. "style" is not required. Possible values are "DNA" or "" |
|
| /encryptbook | \<key> \[encryption style] | Encrypts the book the player is holding. "key" is required and can be any phrase or number excluding spaces. "style" is not required. Possible values are "DNA" or "" |
|
||||||
| /formatbook | None | Formats the held written book (converts color and formatting codes to the corresponding formatted text) |
|
| /formatbook | None | Formats the held written book (converts color and formatting codes to the corresponding formatted text) |
|
||||||
| /givebook | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | Gives the selected player a book from your personal directory |
|
| /givebook | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | Gives the selected player a book from your personal directory |
|
||||||
| /givepublicbook | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | Same as givebook, but uses books from the public directory |
|
| /givepublicbook | \<file name or number> \<playername> \[# of copies (num)] \[signed (true/false)] | Same as givebook, but uses books from the public directory |
|
||||||
| /loadbook | \<file name or number> \[# of copies] \[signed (true/false)] | Creates a book from the specified file and gives it to the player. If no file is specified, a list of available files is returned. If true is specified, the book will be signed, if false it will be unsigned |
|
| /loadbook | \<file name or number> \[# of copies] \[signed (true/false)] | Creates a book from the specified file and gives it to the player. If no file is specified, a list of available files is returned. If true is specified, the book will be signed, if false it will be unsigned |
|
||||||
| /loadpublicbook | \<file name or number> \[# of copies] \[signed (true/false)] | Same as loadbook, but views files in the public directory |
|
| /loadpublicbook | \<file name or number> \[# of copies] \[signed (true/false)] | Same as loadbook, but views files in the public directory |
|
||||||
| /reload | None | Reloads BwB's configuration file |
|
| /reload | None | Reloads BwB's configuration file |
|
||||||
| /savebook | \[overwrite (true/false)] | Saves the book the player is holding to a text file in a private directory. If true is specified, a book of the same name by the same author will be overwritten by the new book |
|
| /savebook | \[overwrite (true/false)] | Saves the book the player is holding to a text file in a private directory. If true is specified, a book of the same name by the same author will be overwritten by the new book |
|
||||||
| /savepublicbook | \[overwrite (true/false)] | Same as savebook, but saves files in the public directory |
|
| /savepublicbook | \[overwrite (true/false)] | Same as savebook, but saves files in the public directory |
|
||||||
| /setbookauthor | \<author> | Sets the author of the book the player is holding |
|
| /setbookauthor | \<author> | Sets the author of the book the player is holding |
|
||||||
| /setbookgeneration | \<generation> | Sets the generation of the held book (ORIGINAL, COPY_OF_ORIGINAL, COPY_OF_COPY, TATTERED) |
|
| /setbookgeneration | \<generation> | Sets the generation of the held book (ORIGINAL, COPY_OF_ORIGINAL, COPY_OF_COPY, TATTERED) |
|
||||||
| /setbookprice | \<item/eco> \<quantity> | Sets the per-book price to create a book via commands. If "Item", the item in the player's hand in the amount of \<quantity> will be the price. If "Eco", a Vault based economy will be used for price. If neither \<Item/Eco> nor \<quantity> are specified, the current price to create books will be removed. |
|
| /setbookprice | \<item/eco> \<quantity> | Sets the per-book price to create a book via commands. If "Item", the item in the player's hand in the amount of \<quantity> will be the price. If "Eco", a Vault based economy will be used for price. If neither \<Item/Eco> nor \<quantity> are specified, the current price to create books will be removed. |
|
||||||
| /setlore | \<new lore> | Sets the lore of the item the player is holding. Insert the lore_line_separator character to force a new line ("~" by default) |
|
| /setlore | \<new lore> | Sets the lore of the item the player is holding. Insert the lore_line_separator character to force a new line ("~" by default) |
|
||||||
| /settitle | \<title> | Sets the title of the book/item the player is holding |
|
| /settitle | \<title> | Sets the title of the book/item the player is holding |
|
||||||
| /unsignbook | None | Un-signs the book the player is holding |
|
| /unsignbook | None | Un-signs the book the player is holding |
|
||||||
| /clearbook | None | Removes all text from the held un-signed book |
|
| /clearbook | None | Removes all text from the held un-signed book |
|
||||||
|
|
||||||
### Permissions:
|
### Permissions:
|
||||||
|
|
||||||
| Node | Description |
|
| Node | Description |
|
||||||
| --- | --- |
|
|--------------------------------------------|----------------------------------------------------------------------------------------------------------|
|
||||||
| bookswithoutborders.* | Grants all permissions |
|
| bookswithoutborders.* | Grants all permissions |
|
||||||
| bookswithoutborders.admin | Grants all permissions |
|
| bookswithoutborders.admin | Grants all permissions |
|
||||||
| bookswithoutborders.use | Allows player to use commands to save/load/delete in their personal directory |
|
| bookswithoutborders.use | Allows player to use commands to save/load/delete in their personal directory |
|
||||||
| bookswithoutborders.alterbooks | Allows player to change books' data such as lore/title/author/generation/formatting and un-signing books |
|
| bookswithoutborders.alterbooks | Allows player to change books' data such as lore/title/author/generation/formatting and un-signing books |
|
||||||
| bookswithoutborders.reload | Allows player to reload this plugin |
|
| bookswithoutborders.reload | Allows player to reload this plugin |
|
||||||
| bookswithoutborders.format | Allows a player to format a book |
|
| bookswithoutborders.format | Allows a player to format a book |
|
||||||
| bookswithoutborders.save | Allows a player to save books to their personal directory |
|
| bookswithoutborders.save | Allows a player to save books to their personal directory |
|
||||||
| bookswithoutborders.load | Allows player to load books from their personal directory |
|
| bookswithoutborders.load | Allows player to load books from their personal directory |
|
||||||
| bookswithoutborders.delete | Allows player to delete books from their personal directory |
|
| bookswithoutborders.delete | Allows player to delete books from their personal directory |
|
||||||
| bookswithoutborders.unsign | Allows player to un-sign books |
|
| bookswithoutborders.unsign | Allows player to un-sign books |
|
||||||
| bookswithoutborders.copy | Allows player to copy books |
|
| bookswithoutborders.copy | Allows player to copy books |
|
||||||
| bookswithoutborders.loadpublic | Allows player to load from the public directory |
|
| bookswithoutborders.loadpublic | Allows player to load from the public directory |
|
||||||
| bookswithoutborders.savepublic | Allows player to save to the public directory |
|
| bookswithoutborders.savepublic | Allows player to save to the public directory |
|
||||||
| bookswithoutborders.encrypt | Allows player to encrypt books |
|
| bookswithoutborders.encrypt | Allows player to encrypt books |
|
||||||
| bookswithoutborders.groupencrypt | Allows player to use group-based encryption |
|
| bookswithoutborders.groupencrypt | Allows player to use group-based encryption |
|
||||||
| bookswithoutborders.decrypt | Allows player to decrypt books |
|
| bookswithoutborders.decrypt | Allows player to decrypt books |
|
||||||
| bookswithoutborders.decrypt.agroup | Allows player to decrypt books group-encrypted for group "agroup" |
|
| bookswithoutborders.decrypt.agroup | Allows player to decrypt books group-encrypted for group "agroup" |
|
||||||
| bookswithoutborders.signs | Allows player to create signs that give/encrypt/decrypt books |
|
| bookswithoutborders.signs | Allows player to create signs that give/encrypt/decrypt books |
|
||||||
| bookswithoutborders.give | Allows player to give another player one of their privately saved books |
|
| bookswithoutborders.give | Allows player to give another player one of their privately saved books |
|
||||||
| bookswithoutborders.givepublic | Allows a player to give another player a book from the public directory |
|
| bookswithoutborders.givepublic | Allows a player to give another player a book from the public directory |
|
||||||
| bookswithoutborders.settitle | Allows player to set the title of the currently held book |
|
| bookswithoutborders.settitle | Allows player to set the title of the currently held book |
|
||||||
| bookswithoutborders.setauthor | Allows player to set the author of the currently held book |
|
| bookswithoutborders.setauthor | Allows player to set the author of the currently held book |
|
||||||
| bookswithoutborders.setlore | Allows player to set the lore of the currently held item |
|
| bookswithoutborders.setlore | Allows player to set the lore of the currently held item |
|
||||||
| bookswithoutborders.bypassauthoronlycopy | Allows player to ignore Author_Only_Copy config setting |
|
| bookswithoutborders.bypassauthoronlycopy | Allows player to ignore Author_Only_Copy config setting |
|
||||||
| bookswithoutborders.bypassauthoronlyunsign | Allows player to ignore Author_Only_Unsign config setting |
|
| bookswithoutborders.bypassauthoronlyunsign | Allows player to ignore Author_Only_Unsign config setting |
|
||||||
| bookswithoutborders.bypassauthoronlysave | Allows player to ignore Author_Only_Save config setting |
|
| bookswithoutborders.bypassauthoronlysave | Allows player to ignore Author_Only_Save config setting |
|
||||||
| bookswithoutborders.bypassbookprice | Allows player to ignore Price_to_create_book config setting |
|
| bookswithoutborders.bypassbookprice | Allows player to ignore Price_to_create_book config setting |
|
||||||
| bookswithoutborders.setbookprice | Allows player to set the cost of creating a book |
|
| bookswithoutborders.setbookprice | Allows player to set the cost of creating a book |
|
||||||
| bookswithoutborders.setgeneration | Allows player to change the generation of a book (Original, Copy, Copy of Copy) |
|
| bookswithoutborders.setgeneration | Allows player to change the generation of a book (Original, Copy, Copy of Copy) |
|
||||||
| bookswithoutborders.clear | Allows player to clear the contents of the held writable book |
|
| bookswithoutborders.clear | Allows player to clear the contents of the held writable book |
|
||||||
|
|
||||||
### Signs
|
### Signs
|
||||||
|
|
||||||
@ -121,19 +121,19 @@ The **_decrypt_** sign must have **\[Decrypt]** on its second line. The third li
|
|||||||
|
|
||||||
### Configuration options:
|
### Configuration options:
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
| --- | --- |
|
|----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| Save_Books_in_Yaml_Format | Whether to use YAML for saved books instead of just storing them as text |
|
| Save_Books_in_Yaml_Format | Whether to use YAML for saved books instead of just storing them as text |
|
||||||
| Max_Number_of_Duplicates | The maximum number of duplicates of a saved book allowed |
|
| Max_Number_of_Duplicates | The maximum number of duplicates of a saved book allowed |
|
||||||
| Author_Separator | The separator used to separate the book title and the book author |
|
| Author_Separator | The separator used to separate the book title and the book author |
|
||||||
| Lore_line_separator | The separator used to denote a new line in the book/item lore |
|
| Lore_line_separator | The separator used to denote a new line in the book/item lore |
|
||||||
| Books_for_new_players | A list of books given to new players the first time they join the server |
|
| Books_for_new_players | A list of books given to new players the first time they join the server |
|
||||||
| Message_for_new_players | An optional message displayed to new players the first time they join the server |
|
| Message_for_new_players | An optional message displayed to new players the first time they join the server |
|
||||||
| Price_to_create_book.Item_type | The item type used as currency for copying books. Use "Economy" to use money instead of items |
|
| Price_to_create_book.Item_type | The item type used as currency for copying books. Use "Economy" to use money instead of items |
|
||||||
| Price_to_create_book.Required_quantity | The quantity of currency required to pay for each book produced |
|
| Price_to_create_book.Required_quantity | The quantity of currency required to pay for each book produced |
|
||||||
| Admin_Auto_Decrypt | Whether any admin can decrypt any book regardless of the group it was encrypted for |
|
| Admin_Auto_Decrypt | Whether any admin can decrypt any book regardless of the group it was encrypted for |
|
||||||
| Author_Only_Copy | Whether to only allow the author of a book to create copies |
|
| Author_Only_Copy | Whether to only allow the author of a book to create copies |
|
||||||
| Author_Only_Unsign | Whether to only allow the author of a book to unsign it |
|
| Author_Only_Unsign | Whether to only allow the author of a book to unsign it |
|
||||||
| Author_Only_Save | Whether to only allow saving a player's own books with /savebook |
|
| Author_Only_Save | Whether to only allow saving a player's own books with /savebook |
|
||||||
| Format_Book_After_Signing | Whether to automatically format every book when it's signed |
|
| Format_Book_After_Signing | Whether to automatically format every book when it's signed |
|
||||||
| Change_Generation_On_Copy | Whether to display "COPY" or "COPY_OF_COPY" instead of "ORIGINAL" when a book is copied. This also uses the vanilla behavior where a copy of a copy or tattered book cannot be copied further. |
|
| Change_Generation_On_Copy | Whether to display "COPY" or "COPY_OF_COPY" instead of "ORIGINAL" when a book is copied. This also uses the vanilla behavior where a copy of a copy or tattered book cannot be copied further. |
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.knarcraft</groupId>
|
<groupId>net.knarcraft</groupId>
|
||||||
<artifactId>BooksWithoutBorders</artifactId>
|
<artifactId>BooksWithoutBorders</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>1.3.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
@ -158,9 +158,8 @@ public final class BookFileHelper {
|
|||||||
String userName = data[1].substring(0, data[1].length() - 4);
|
String userName = data[1].substring(0, data[1].length() - 4);
|
||||||
data[1] = BookHelper.authorFromUUID(userName) + extension;
|
data[1] = BookHelper.authorFromUUID(userName) + extension;
|
||||||
fileList.add(String.join(separator, data));
|
fileList.add(String.join(separator, data));
|
||||||
} else {
|
|
||||||
fileList.add(fileName);
|
|
||||||
}
|
}
|
||||||
|
fileList.add(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileList;
|
return fileList;
|
||||||
|
@ -3,6 +3,7 @@ package net.knarcraft.bookswithoutborders.utility;
|
|||||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||||
import net.knarcraft.bookswithoutborders.config.BooksWithoutBordersConfig;
|
import net.knarcraft.bookswithoutborders.config.BooksWithoutBordersConfig;
|
||||||
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
import net.knarcraft.bookswithoutborders.state.BookDirectory;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -60,7 +61,22 @@ public final class BookLoader {
|
|||||||
//Get the full path of the book to load
|
//Get the full path of the book to load
|
||||||
File file = getFullPath(sender, fileName, bookDirectory, directory);
|
File file = getFullPath(sender, fileName, bookDirectory, directory);
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return null;
|
//Try converting the username to UUID
|
||||||
|
String titleAuthorSeparator = BooksWithoutBordersConfig.getTitleAuthorSeparator();
|
||||||
|
String[] data = fileName.split(titleAuthorSeparator);
|
||||||
|
String extension = data[1].substring(data[1].length() - 4);
|
||||||
|
String userName = data[1].substring(0, data[1].length() - 4);
|
||||||
|
Player player = Bukkit.getPlayer(userName);
|
||||||
|
if (player != null) {
|
||||||
|
data[1] = player.getUniqueId() + extension;
|
||||||
|
file = getFullPath(sender, String.join(titleAuthorSeparator, data), bookDirectory, directory);
|
||||||
|
if (file == null) {
|
||||||
|
BooksWithoutBorders.sendErrorMessage(sender, "Incorrect file name!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Make sure the player can pay for the book
|
//Make sure the player can pay for the book
|
||||||
@ -124,9 +140,7 @@ public final class BookLoader {
|
|||||||
} else {
|
} else {
|
||||||
file = BookFileHelper.getBookFile(BookHelper.getBookDirectoryPathString(bookDirectory, sender) + fileName);
|
file = BookFileHelper.getBookFile(BookHelper.getBookDirectoryPathString(bookDirectory, sender) + fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file == null || !file.isFile()) {
|
if (file == null || !file.isFile()) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "Incorrect file name!");
|
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return file;
|
return file;
|
||||||
|
Loading…
Reference in New Issue
Block a user