mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
Merge pull request #3 from ThatDashiell/master
I dunno what that changes but ok
This commit is contained in:
@@ -70,6 +70,10 @@
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
||||
+7
-13
@@ -6,10 +6,8 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BungeeTabCompleteListener implements Listener {
|
||||
|
||||
@@ -23,21 +21,17 @@ public class BungeeTabCompleteListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> commandList = CommandsList.getCommands(player);
|
||||
|
||||
HashMap<String, Command> commandHashMap = new HashMap<>();
|
||||
for (String s : commandList) {
|
||||
for (Map.Entry<String, Command> command : CommandWhitelistBungee.getPlugin().getProxy().getPluginManager().getCommands()) {
|
||||
if (s.equalsIgnoreCase(command.getValue().getName())) {
|
||||
commandHashMap.put(command.getKey(), command.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
CommandsList.getCommands(player).forEach(cmdName ->
|
||||
CommandWhitelistBungee.getPlugin().getProxy().getPluginManager().getCommands()
|
||||
.stream()
|
||||
.filter(commandEntry -> cmdName.equalsIgnoreCase(commandEntry.getValue().getName()))
|
||||
.forEach(commandEntry -> commandHashMap.put(commandEntry.getKey(), commandEntry.getValue())));
|
||||
|
||||
event.getCommands().values().removeIf((cmd) -> !commandHashMap.containsValue(cmd));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user