Fixes an inconsistency where "," is always used as separator for unsigned books
This commit is contained in:
parent
5e85dfd3e4
commit
542cd03bdc
@ -44,14 +44,16 @@ public class CommandDecrypt implements TabExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String authorSeparator = BooksWithoutBordersConfig.getTitleAuthorSeparator();
|
||||||
|
|
||||||
//Warning: admin decrypt only allows decrypting files created by the same player. Not sure if intended
|
//Warning: admin decrypt only allows decrypting files created by the same player. Not sure if intended
|
||||||
if (args.length == 0 && BooksWithoutBordersConfig.getAdminDecrypt() && player.hasPermission("bookswithoutborders.admin")) {
|
if (args.length == 0 && BooksWithoutBordersConfig.getAdminDecrypt() && player.hasPermission("bookswithoutborders.admin")) {
|
||||||
String path = getBookFolder() + "Encrypted" + getSlash();
|
String path = getBookFolder() + "Encrypted" + getSlash();
|
||||||
String fileName;
|
String fileName;
|
||||||
if (bookMetadata.hasTitle()) {
|
if (bookMetadata.hasTitle()) {
|
||||||
fileName = bookMetadata.getTitle() + BooksWithoutBordersConfig.getTitleAuthorSeparator() + bookMetadata.getAuthor();
|
fileName = bookMetadata.getTitle() + authorSeparator + bookMetadata.getAuthor();
|
||||||
} else {
|
} else {
|
||||||
fileName = "Untitled," + player.getName();
|
fileName = "Untitled" + authorSeparator + player.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
File encryptedDirectory = new File(path);
|
File encryptedDirectory = new File(path);
|
||||||
|
@ -85,11 +85,12 @@ public class CommandSave implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Generate book filename
|
//Generate book filename
|
||||||
|
String authorSeparator = BooksWithoutBordersConfig.getTitleAuthorSeparator();
|
||||||
String fileName;
|
String fileName;
|
||||||
if (!book.hasTitle()) {
|
if (!book.hasTitle()) {
|
||||||
fileName = "Untitled," + player.getName();
|
fileName = "Untitled" + authorSeparator + player.getName();
|
||||||
} else {
|
} else {
|
||||||
fileName = book.getTitle() + BooksWithoutBordersConfig.getTitleAuthorSeparator() + book.getAuthor();
|
fileName = book.getTitle() + authorSeparator + book.getAuthor();
|
||||||
}
|
}
|
||||||
fileName = cleanString(fileName);
|
fileName = cleanString(fileName);
|
||||||
fileName = fixName(fileName, false);
|
fileName = fixName(fileName, false);
|
||||||
|
@ -198,8 +198,9 @@ public final class EncryptionHelper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileName = (!bookMetadata.hasTitle()) ? "Untitled," + player.getName() : bookMetadata.getTitle() +
|
String authorSeparator = BooksWithoutBordersConfig.getTitleAuthorSeparator();
|
||||||
BooksWithoutBordersConfig.getTitleAuthorSeparator() + bookMetadata.getAuthor();
|
String fileName = (!bookMetadata.hasTitle()) ? "Untitled" + authorSeparator + player.getName() :
|
||||||
|
bookMetadata.getTitle() + authorSeparator + bookMetadata.getAuthor();
|
||||||
fileName = "[" + key + "]" + fileName;
|
fileName = "[" + key + "]" + fileName;
|
||||||
fileName = cleanString(fileName);
|
fileName = cleanString(fileName);
|
||||||
fileName = fixName(fileName, false);
|
fileName = fixName(fileName, false);
|
||||||
@ -264,8 +265,9 @@ public final class EncryptionHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Creates file
|
//Creates file
|
||||||
String fileName = (!bookMetadata.hasTitle()) ? "Untitled," + player.getName() :
|
String authorSeparator = BooksWithoutBordersConfig.getTitleAuthorSeparator();
|
||||||
bookMetadata.getTitle() + BooksWithoutBordersConfig.getTitleAuthorSeparator() + bookMetadata.getAuthor();
|
String fileName = (!bookMetadata.hasTitle()) ? "Untitled" + authorSeparator + player.getName() :
|
||||||
|
bookMetadata.getTitle() + authorSeparator + bookMetadata.getAuthor();
|
||||||
|
|
||||||
fileName = cleanString(fileName);
|
fileName = cleanString(fileName);
|
||||||
fileName = fixName(fileName, false);
|
fileName = fixName(fileName, false);
|
||||||
@ -305,8 +307,9 @@ public final class EncryptionHelper {
|
|||||||
*/
|
*/
|
||||||
private static Boolean saveEncryptedBook(Player player, BookMeta bookMetaData, String key) {
|
private static Boolean saveEncryptedBook(Player player, BookMeta bookMetaData, String key) {
|
||||||
String path = getBookFolder() + "Encrypted" + getSlash();
|
String path = getBookFolder() + "Encrypted" + getSlash();
|
||||||
String fileName = (!bookMetaData.hasTitle()) ? "Untitled," + player.getName() :
|
String authorSeparator = BooksWithoutBordersConfig.getTitleAuthorSeparator();
|
||||||
bookMetaData.getTitle() + BooksWithoutBordersConfig.getTitleAuthorSeparator() + bookMetaData.getAuthor();
|
String fileName = (!bookMetaData.hasTitle()) ? "Untitled" + authorSeparator + player.getName() :
|
||||||
|
bookMetaData.getTitle() + authorSeparator + bookMetaData.getAuthor();
|
||||||
|
|
||||||
fileName = "[" + key + "]" + fileName;
|
fileName = "[" + key + "]" + fileName;
|
||||||
fileName = cleanString(fileName);
|
fileName = cleanString(fileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user