Updates to Minecraft 1.18 and Java 17
This commit is contained in:
parent
240ff0c869
commit
94589faba0
16
pom.xml
16
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.knarcraft</groupId>
|
<groupId>net.knarcraft</groupId>
|
||||||
<artifactId>BooksWithoutBorders</artifactId>
|
<artifactId>BooksWithoutBorders</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<description>A continuation of the original Books Without Borders</description>
|
<description>A continuation of the original Books Without Borders</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>16</java.version>
|
<java.version>17</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>17</source>
|
||||||
<target>${java.version}</target>
|
<target>17</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
<version>1.18.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -84,5 +84,11 @@
|
|||||||
<version>1.7</version>
|
<version>1.7</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>23.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -24,7 +25,7 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
|||||||
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
sender.sendMessage(getCommandColor() + "[] denote optional parameters");
|
sender.sendMessage(getCommandColor() + "[] denote optional parameters");
|
||||||
sender.sendMessage(getCommandColor() + "<> denote required parameters");
|
sender.sendMessage(getCommandColor() + "<> denote required parameters");
|
||||||
sender.sendMessage(getCommandColor() + "In some cases, commands with required parameters can be called with no parameters");
|
sender.sendMessage(getCommandColor() + "In some cases, commands with required parameters can be called with no parameters");
|
||||||
@ -107,7 +108,7 @@ public class CommandBooksWithoutBorders implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -24,7 +25,7 @@ public class CommandCopy implements TabExecutor {
|
|||||||
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -46,9 +47,10 @@ public class CommandCopy implements TabExecutor {
|
|||||||
int copies = Integer.parseInt(args[0]);
|
int copies = Integer.parseInt(args[0]);
|
||||||
if (copies > 0) {
|
if (copies > 0) {
|
||||||
if (BooksWithoutBorders.getAuthorOnlyCopy() && !player.hasPermission("bookswithoutborders.bypassAuthorOnlyCopy")) {
|
if (BooksWithoutBorders.getAuthorOnlyCopy() && !player.hasPermission("bookswithoutborders.bypassAuthorOnlyCopy")) {
|
||||||
if (!isAuthor(player, (BookMeta) Objects.requireNonNull(heldBook.getItemMeta())))
|
if (!isAuthor(player, (BookMeta) Objects.requireNonNull(heldBook.getItemMeta()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (booksWithoutBorders.booksHavePrice() &&
|
if (booksWithoutBorders.booksHavePrice() &&
|
||||||
!player.hasPermission("bookswithoutborders.bypassBookPrice") &&
|
!player.hasPermission("bookswithoutborders.bypassBookPrice") &&
|
||||||
@ -86,7 +88,7 @@ public class CommandCopy implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
int argumentCount = args.length;
|
int argumentCount = args.length;
|
||||||
if (argumentCount == 1) {
|
if (argumentCount == 1) {
|
||||||
return TabCompletionHelper.getNumbers(1, 20);
|
return TabCompletionHelper.getNumbers(1, 20);
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -23,7 +24,7 @@ import static net.knarcraft.bookswithoutborders.BooksWithoutBordersSettings.getS
|
|||||||
public class CommandDecrypt implements TabExecutor {
|
public class CommandDecrypt implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -102,7 +103,7 @@ public class CommandDecrypt implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
int argumentCount = args.length;
|
int argumentCount = args.length;
|
||||||
if (argumentCount == 1) {
|
if (argumentCount == 1) {
|
||||||
List<String> info = new ArrayList<>();
|
List<String> info = new ArrayList<>();
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -21,7 +22,7 @@ import static net.knarcraft.bookswithoutborders.BooksWithoutBordersSettings.getS
|
|||||||
public class CommandDelete implements TabExecutor {
|
public class CommandDelete implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -107,12 +108,13 @@ public class CommandDelete implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return doTabCompletion(sender, args, false);
|
return doTabCompletion(sender, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs tab completion
|
* Performs tab completion
|
||||||
|
*
|
||||||
* @param sender <p>The sender of the command</p>
|
* @param sender <p>The sender of the command</p>
|
||||||
* @param args <p>The arguments given</p>
|
* @param args <p>The arguments given</p>
|
||||||
* @param deletePublic <p>Whether to delete a public book</p>
|
* @param deletePublic <p>Whether to delete a public book</p>
|
||||||
|
@ -3,6 +3,7 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -12,12 +13,12 @@ import java.util.List;
|
|||||||
public class CommandDeletePublic extends CommandDelete implements TabExecutor {
|
public class CommandDeletePublic extends CommandDelete implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
return deleteBook(sender, args, true);
|
return deleteBook(sender, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
return doTabCompletion(sender, args, true);
|
return doTabCompletion(sender, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,7 +22,7 @@ import java.util.List;
|
|||||||
public class CommandEncrypt implements TabExecutor {
|
public class CommandEncrypt implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (performPreChecks(sender, args, 1, "You must specify a key to encrypt a book!") == null) {
|
if (performPreChecks(sender, args, 1, "You must specify a key to encrypt a book!") == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -96,12 +97,13 @@ public class CommandEncrypt implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
return doTabCompletion(args, false);
|
return doTabCompletion(args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of string for tab completions
|
* Gets a list of string for tab completions
|
||||||
|
*
|
||||||
* @param args <p>The arguments given</p>
|
* @param args <p>The arguments given</p>
|
||||||
* @param groupEncrypt <p>Whether to auto-complete for group encryption</p>
|
* @param groupEncrypt <p>Whether to auto-complete for group encryption</p>
|
||||||
* @return <p>The strings to auto-complete</p>
|
* @return <p>The strings to auto-complete</p>
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -22,7 +23,7 @@ public class CommandGive implements TabExecutor {
|
|||||||
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -104,12 +105,13 @@ public class CommandGive implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return doTabCompletion(sender, args, false);
|
return doTabCompletion(sender, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the actual tab completion
|
* Performs the actual tab completion
|
||||||
|
*
|
||||||
* @param sender <p>The sender of the command</p>
|
* @param sender <p>The sender of the command</p>
|
||||||
* @param args <p>The arguments given</p>
|
* @param args <p>The arguments given</p>
|
||||||
* @param listPublic <p>Whether to list public files or player files</p>
|
* @param listPublic <p>Whether to list public files or player files</p>
|
||||||
|
@ -3,6 +3,7 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -12,12 +13,12 @@ import java.util.List;
|
|||||||
public class CommandGivePublic extends CommandGive implements TabExecutor {
|
public class CommandGivePublic extends CommandGive implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
return giveBook(sender, args, true, "public");
|
return giveBook(sender, args, true, "public");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
return doTabCompletion(sender, args, true);
|
return doTabCompletion(sender, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ import java.util.List;
|
|||||||
public class CommandGroupEncrypt extends CommandEncrypt implements TabExecutor {
|
public class CommandGroupEncrypt extends CommandEncrypt implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
BookMeta bookMetadata = performPreChecks(sender, args, 2,
|
BookMeta bookMetadata = performPreChecks(sender, args, 2,
|
||||||
"You must specify a group name and key to encrypt a book!");
|
"You must specify a group name and key to encrypt a book!");
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ public class CommandGroupEncrypt extends CommandEncrypt implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
return doTabCompletion(args, true);
|
return doTabCompletion(args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,7 +22,7 @@ public class CommandLoad implements TabExecutor {
|
|||||||
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
return loadBook(sender, args, "player", false);
|
return loadBook(sender, args, "player", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,12 +95,13 @@ public class CommandLoad implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return doTabCompletion(sender, args, false);
|
return doTabCompletion(sender, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the actual tab completion
|
* Performs the actual tab completion
|
||||||
|
*
|
||||||
* @param sender <p>The sender of the command</p>
|
* @param sender <p>The sender of the command</p>
|
||||||
* @param args <p>The arguments given</p>
|
* @param args <p>The arguments given</p>
|
||||||
* @param loadPublic <p>Whether to list public files or player files</p>
|
* @param loadPublic <p>Whether to list public files or player files</p>
|
||||||
|
@ -3,6 +3,7 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -12,12 +13,12 @@ import java.util.List;
|
|||||||
public class CommandLoadPublic extends CommandLoad implements CommandExecutor {
|
public class CommandLoadPublic extends CommandLoad implements CommandExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
return loadBook(sender, args, "public", true);
|
return loadBook(sender, args, "public", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
return doTabCompletion(sender, args, true);
|
return doTabCompletion(sender, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import net.knarcraft.bookswithoutborders.BooksWithoutBorders;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -16,7 +17,7 @@ public class CommandReload implements TabExecutor {
|
|||||||
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (booksWithoutBorders.loadConfig()) {
|
if (booksWithoutBorders.loadConfig()) {
|
||||||
BooksWithoutBorders.sendSuccessMessage(sender, "BooksWithoutBorders configuration reloaded!");
|
BooksWithoutBorders.sendSuccessMessage(sender, "BooksWithoutBorders configuration reloaded!");
|
||||||
} else {
|
} else {
|
||||||
@ -27,7 +28,7 @@ public class CommandReload implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -31,7 +32,7 @@ import static net.knarcraft.bookswithoutborders.utility.InputCleaningHelper.fixN
|
|||||||
public class CommandSave implements TabExecutor {
|
public class CommandSave implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
return saveHeldBook(sender, args, false);
|
return saveHeldBook(sender, args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ public class CommandSave implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package net.knarcraft.bookswithoutborders.command;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command executor for the save public command
|
* Command executor for the save public command
|
||||||
@ -10,7 +11,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
public class CommandSavePublic extends CommandSave implements TabExecutor {
|
public class CommandSavePublic extends CommandSave implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
return saveHeldBook(sender, args, true);
|
return saveHeldBook(sender, args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,7 +20,7 @@ import java.util.List;
|
|||||||
public class CommandSetAuthor implements TabExecutor {
|
public class CommandSetAuthor implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -49,7 +50,7 @@ public class CommandSetAuthor implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.command.TabExecutor;
|
import org.bukkit.command.TabExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -22,7 +23,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
private final BooksWithoutBorders booksWithoutBorders = BooksWithoutBorders.getInstance();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
//Clear the current price
|
//Clear the current price
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
clearItemPrice(sender);
|
clearItemPrice(sender);
|
||||||
@ -132,7 +133,7 @@ public class CommandSetBookPrice implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
int argumentCount = args.length;
|
int argumentCount = args.length;
|
||||||
if (argumentCount == 1) {
|
if (argumentCount == 1) {
|
||||||
List<String> paymentTypes = new ArrayList<>();
|
List<String> paymentTypes = new ArrayList<>();
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -21,7 +22,7 @@ import java.util.List;
|
|||||||
public class CommandSetLore implements TabExecutor {
|
public class CommandSetLore implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -59,7 +60,7 @@ public class CommandSetLore implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
//TODO: Figure out if there is a better way to display that an argument is required
|
//TODO: Figure out if there is a better way to display that an argument is required
|
||||||
List<String> options = new ArrayList<>();
|
List<String> options = new ArrayList<>();
|
||||||
options.add("<new lore>");
|
options.add("<new lore>");
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,7 +22,7 @@ import java.util.List;
|
|||||||
public class CommandSetTitle implements TabExecutor {
|
public class CommandSetTitle implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -65,7 +66,7 @@ public class CommandSetTitle implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
List<String> options = new ArrayList<>();
|
List<String> options = new ArrayList<>();
|
||||||
options.add("<new title>");
|
options.add("<new title>");
|
||||||
return options;
|
return options;
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.command.TabExecutor;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -20,7 +21,7 @@ import java.util.List;
|
|||||||
public class CommandUnSign implements TabExecutor {
|
public class CommandUnSign implements TabExecutor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
BooksWithoutBorders.sendErrorMessage(sender, "This command can only be used by a player!");
|
||||||
return false;
|
return false;
|
||||||
@ -55,7 +56,7 @@ public class CommandUnSign implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
name: BooksWithoutBorders
|
name: BooksWithoutBorders
|
||||||
version: '${project.version}'
|
version: '${project.version}'
|
||||||
main: net.knarcraft.bookswithoutborders.BooksWithoutBorders
|
main: net.knarcraft.bookswithoutborders.BooksWithoutBorders
|
||||||
api-version: 1.17
|
api-version: 1.18
|
||||||
prefix: Books Without Borders
|
prefix: Books Without Borders
|
||||||
authors: [ EpicKnarvik97, AkiraAkiba ]
|
authors: [ EpicKnarvik97, AkiraAkiba ]
|
||||||
description: A continuation of the original Books Without Borders
|
description: A continuation of the original Books Without Borders
|
||||||
softdepend: [ Vault ]
|
softdepend: [ Vault ]
|
||||||
website: ????
|
website: https://www.spigotmc.org/resources/books-without-borders-updated.96069/
|
||||||
dev-url: https://git.knarcraft.net/EpicKnarvik97/Books-Without-Borders
|
dev-url: https://git.knarcraft.net/EpicKnarvik97/Books-Without-Borders
|
||||||
commands:
|
commands:
|
||||||
bookswithoutborders:
|
bookswithoutborders:
|
||||||
@ -85,6 +85,10 @@ commands:
|
|||||||
description: Reloads BwB's configuration file
|
description: Reloads BwB's configuration file
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
permission: bookswithoutborders.admin
|
permission: bookswithoutborders.admin
|
||||||
|
formatbook:
|
||||||
|
description: Replaces color/formatting codes in a book with formatted text
|
||||||
|
usage: /<command>
|
||||||
|
permission: bookswithoutborders.format
|
||||||
permissions:
|
permissions:
|
||||||
bookswithoutborders.*:
|
bookswithoutborders.*:
|
||||||
description: Grants all permissions
|
description: Grants all permissions
|
||||||
@ -112,12 +116,15 @@ permissions:
|
|||||||
bookswithoutborders.bypassbookprice: true
|
bookswithoutborders.bypassbookprice: true
|
||||||
bookswithoutborders.groupencrypt: true
|
bookswithoutborders.groupencrypt: true
|
||||||
bookswithoutborders.setbookprice: true
|
bookswithoutborders.setbookprice: true
|
||||||
|
bookswithoutborders.format: true
|
||||||
bookswithoutborders.use:
|
bookswithoutborders.use:
|
||||||
description: Allows player to use commands and to save/load/delete in their personal directory
|
description: Allows player to use commands and to save/load/delete in their personal directory
|
||||||
children:
|
children:
|
||||||
bookswithoutborders.save: true
|
bookswithoutborders.save: true
|
||||||
bookswithoutborders.load: true
|
bookswithoutborders.load: true
|
||||||
bookswithoutborders.delete: true
|
bookswithoutborders.delete: true
|
||||||
|
bookswithoutborders.format:
|
||||||
|
description: Allows a player to format a book
|
||||||
bookswithoutborders.save:
|
bookswithoutborders.save:
|
||||||
description: Allows player to save books to their personal directory
|
description: Allows player to save books to their personal directory
|
||||||
bookswithoutborders.load:
|
bookswithoutborders.load:
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.knarcraft.bookswithoutborders.encryption;
|
package net.knarcraft.bookswithoutborders.encryption;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
|
|
||||||
public class AESTest {
|
public class AESTest {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public class AESTest {
|
|||||||
AES aes = new AES(AES.generateIV(), AES.generateIV());
|
AES aes = new AES(AES.generateIV(), AES.generateIV());
|
||||||
|
|
||||||
String encrypted = aes.encryptDecryptText(plainText, password, true);
|
String encrypted = aes.encryptDecryptText(plainText, password, true);
|
||||||
assertFalse(encrypted.equals(plainText));
|
Assert.assertNotSame(encrypted, plainText);
|
||||||
String decrypted = aes.encryptDecryptText(encrypted, password, false);
|
String decrypted = aes.encryptDecryptText(encrypted, password, false);
|
||||||
assertEquals(plainText, decrypted);
|
assertEquals(plainText, decrypted);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user