Updates PermissionSigns for 1.19

This commit is contained in:
Kristian Knarvik 2022-07-10 14:08:14 +02:00
parent 42f82e2357
commit f9fd999a7f
3 changed files with 6 additions and 5 deletions

View File

@ -59,7 +59,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -1,11 +1,12 @@
package net.knarcraft.permissionsigns.command;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
/**
* The main command for this plugin
*/
@ -15,7 +16,7 @@ public class PermissionSignsCommand implements CommandExecutor {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("create")) {
String[] subArgs = (String[]) ArrayUtils.remove(args, 0);
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
return new CreateCommand().onCommand(sender, command, label, subArgs);
} else if (args[0].equalsIgnoreCase("cancel")) {
return new CancelCommand().onCommand(sender, command, label, args);

View File

@ -1,6 +1,5 @@
package net.knarcraft.permissionsigns.command;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
@ -8,6 +7,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@ -27,7 +27,7 @@ public class PermissionSignsTabCompleter implements TabCompleter {
}
return matchingCommands;
} else if (args.length > 1 && args[0].equalsIgnoreCase("create")) {
String[] subArgs = (String[]) ArrayUtils.remove(args, 0);
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
return new CreateTabCompleter().onTabComplete(sender, command, alias, subArgs);
} else {
return new ArrayList<>();