Moves some code to the Economy helper, and fixes code formatting
This commit is contained in:
@@ -87,8 +87,9 @@ public class CommandBooksWithoutBorders implements CommandExecutor {
|
||||
|
||||
/**
|
||||
* Shows information about the given command
|
||||
*
|
||||
* @param command <p>The command to get information about</p>
|
||||
* @param sender <p>The sender asking to see command info</p>
|
||||
* @param sender <p>The sender asking to see command info</p>
|
||||
*/
|
||||
private void showCommandInfo(String command, CommandSender sender) {
|
||||
PluginCommand pluginCommand = BooksWithoutBorders.getInstance().getCommand(command);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package net.knarcraft.bookswithoutborders.command;
|
||||
|
||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||
import net.knarcraft.bookswithoutborders.utility.EconomyHelper;
|
||||
import net.knarcraft.bookswithoutborders.utility.InputCleaningHelper;
|
||||
import net.knarcraft.bookswithoutborders.utility.InventoryHelper;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -48,23 +49,19 @@ public class CommandCopy implements CommandExecutor {
|
||||
|
||||
if (booksWithoutBorders.booksHavePrice() &&
|
||||
!player.hasPermission("bookswithoutborders.bypassBookPrice") &&
|
||||
booksWithoutBorders.cannotPayForBookPrinting(player, copies)) {
|
||||
EconomyHelper.cannotPayForBookPrinting(player, copies)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
heldBook.setAmount(heldBook.getAmount() + copies);
|
||||
BooksWithoutBorders.sendSuccessMessage(player, "Book copied!");
|
||||
} else {
|
||||
BooksWithoutBorders.sendErrorMessage(player, "Book not copied!");
|
||||
BooksWithoutBorders.sendErrorMessage(player, "Number specified was invalid!");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
BooksWithoutBorders.sendErrorMessage(player, "Book not copied!");
|
||||
BooksWithoutBorders.sendErrorMessage(player, "Number specified was invalid!");
|
||||
return false;
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
return true;
|
||||
BooksWithoutBorders.sendErrorMessage(player, "Book not copied!");
|
||||
BooksWithoutBorders.sendErrorMessage(player, "Number specified was invalid!");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -28,10 +28,11 @@ public class CommandGive implements CommandExecutor {
|
||||
|
||||
/**
|
||||
* Gives a book to another player
|
||||
* @param sender <p>The sender trying to give a book</p>
|
||||
* @param args <p>The arguments given</p>
|
||||
*
|
||||
* @param sender <p>The sender trying to give a book</p>
|
||||
* @param args <p>The arguments given</p>
|
||||
* @param givePublic <p>Whether to give a public book</p>
|
||||
* @param folder <p>The folder containing the book to load</p>
|
||||
* @param folder <p>The folder containing the book to load</p>
|
||||
* @return <p>True if the book was given successfully</p>
|
||||
*/
|
||||
boolean giveBook(CommandSender sender, String[] args, boolean givePublic, String folder) {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package net.knarcraft.bookswithoutborders.command;
|
||||
|
||||
import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
||||
import net.knarcraft.bookswithoutborders.utility.FileHelper;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
Reference in New Issue
Block a user