Adds book reloading, and fixes a RegEx expression
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
All checks were successful
EpicKnarvik97/Books-Without-Borders/pipeline/head This commit looks good
This commit is contained in:
@@ -139,6 +139,14 @@ public class BooksWithoutBorders extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears book data such as per-player lists and per-player character indexes
|
||||||
|
*/
|
||||||
|
public static void clearBookData() {
|
||||||
|
playerBooksList = new HashMap<>();
|
||||||
|
playerLetterIndex = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@@ -23,6 +23,10 @@ public class CommandReload implements TabExecutor {
|
|||||||
BooksWithoutBorders.sendErrorMessage(sender, "Reload Failed!");
|
BooksWithoutBorders.sendErrorMessage(sender, "Reload Failed!");
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "See console for details");
|
BooksWithoutBorders.sendErrorMessage(sender, "See console for details");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reload books
|
||||||
|
BooksWithoutBorders.updateBooks(sender, true);
|
||||||
|
BooksWithoutBorders.clearBookData();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ public final class InputCleaningHelper {
|
|||||||
*/
|
*/
|
||||||
public static int parsePageNumber(@NotNull String input) {
|
public static int parsePageNumber(@NotNull String input) {
|
||||||
try {
|
try {
|
||||||
Pattern pattern = Pattern.compile("page([0-9])+");
|
Pattern pattern = Pattern.compile("page([0-9]+)");
|
||||||
Matcher matcher = pattern.matcher(input);
|
Matcher matcher = pattern.matcher(input);
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
return Integer.parseInt(matcher.group(1));
|
return Integer.parseInt(matcher.group(1));
|
||||||
|
Reference in New Issue
Block a user