mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-28 03:01:21 +01:00
Workaround for a paper-bug causing an error when tab-completing sometimes
This commit is contained in:
parent
6b2e845654
commit
baa1653753
@ -32,6 +32,7 @@
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
@ -88,8 +89,16 @@ public void onTabComplete(TabCompleteEvent evt) {
|
||||
}
|
||||
|
||||
if (!completions.isEmpty()) {
|
||||
completions.sort((s1, s2) -> s1.compareToIgnoreCase(s2));
|
||||
evt.getCompletions().addAll(completions);
|
||||
completions.sort(String::compareToIgnoreCase);
|
||||
|
||||
try {
|
||||
evt.getCompletions().addAll(completions);
|
||||
} catch (UnsupportedOperationException ex){
|
||||
// fix for a bug with paper where the completion-Collection is not mutable for some reason
|
||||
List<String> mutableCompletions = new ArrayList<>(evt.getCompletions());
|
||||
mutableCompletions.addAll(completions);
|
||||
evt.setCompletions(mutableCompletions);
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ignore) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
Loading…
Reference in New Issue
Block a user