Compare commits

...

1 Commits

Author SHA1 Message Date
YouHaveTrouble fd5bccc985 fix NoSuchMethodError while tabcompleting /cw on spigot 2022-03-13 15:09:25 +01:00
6 changed files with 24 additions and 11 deletions
+4 -4
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.2.5</version> <version>2.2.6</version>
</parent> </parent>
<artifactId>Bukkit</artifactId> <artifactId>Bukkit</artifactId>
@@ -34,7 +34,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.3.0-SNAPSHOT</version> <version>3.2.4</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@@ -92,7 +92,7 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId> <artifactId>adventure-platform-bukkit</artifactId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@@ -110,7 +110,7 @@
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId> <artifactId>bstats-bukkit</artifactId>
<version>2.2.1</version> <version>3.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@@ -9,8 +9,10 @@ import org.bukkit.Bukkit;
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.bukkit.help.HelpTopic;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
public class MainCommandExecutor implements TabExecutor { public class MainCommandExecutor implements TabExecutor {
@@ -72,7 +74,18 @@ public class MainCommandExecutor implements TabExecutor {
@Override @Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
List<String> serverCommands = new ArrayList<>(Bukkit.getCommandMap().getKnownCommands().keySet()); List<String> serverCommands;
try {
serverCommands = new ArrayList<>(Bukkit.getCommandMap().getKnownCommands().keySet());
} catch (NoSuchMethodError error) {
HashSet<String> commands = new HashSet<>();
for (HelpTopic topic : Bukkit.getHelpMap().getHelpTopics()) {
String cmd = topic.getName();
if (Character.isUpperCase(cmd.charAt(0))) continue;
commands.add(topic.getName());
}
serverCommands = new ArrayList<>(commands);
}
return CWCommand.commandSuggestions(CommandWhitelistBukkit.getConfigCache(), serverCommands, args, sender.hasPermission(CWPermission.RELOAD.permission()), sender.hasPermission(CWPermission.ADMIN.permission()), CWCommand.ImplementationType.BUKKIT); return CWCommand.commandSuggestions(CommandWhitelistBukkit.getConfigCache(), serverCommands, args, sender.hasPermission(CWPermission.RELOAD.permission()), sender.hasPermission(CWPermission.ADMIN.permission()), CWCommand.ImplementationType.BUKKIT);
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.2.5</version> <version>2.2.6</version>
</parent> </parent>
<artifactId>Common</artifactId> <artifactId>Common</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.2.5</version> <version>2.2.6</version>
</parent> </parent>
<artifactId>Velocity</artifactId> <artifactId>Velocity</artifactId>
+3 -3
View File
@@ -6,7 +6,7 @@
<parent> <parent>
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.2.5</version> <version>2.2.6</version>
</parent> </parent>
<artifactId>Waterfall</artifactId> <artifactId>Waterfall</artifactId>
@@ -94,13 +94,13 @@
<dependency> <dependency>
<groupId>net.kyori</groupId> <groupId>net.kyori</groupId>
<artifactId>adventure-platform-bungeecord</artifactId> <artifactId>adventure-platform-bungeecord</artifactId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bstats</groupId> <groupId>org.bstats</groupId>
<artifactId>bstats-bungeecord</artifactId> <artifactId>bstats-bungeecord</artifactId>
<version>2.2.1</version> <version>3.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>eu.endermite.commandwhitelist</groupId> <groupId>eu.endermite.commandwhitelist</groupId>
<artifactId>CommandWhitelist</artifactId> <artifactId>CommandWhitelist</artifactId>
<version>2.2.5</version> <version>2.2.6</version>
<modules> <modules>
<module>CommandWhitelistCommon</module> <module>CommandWhitelistCommon</module>
<module>CommandWhitelistBukkit</module> <module>CommandWhitelistBukkit</module>