mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-11 22:16: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>
|
<id>dmulloy2-repo</id>
|
||||||
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>papermc</id>
|
||||||
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<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.Command;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class BungeeTabCompleteListener implements Listener {
|
public class BungeeTabCompleteListener implements Listener {
|
||||||
|
|
||||||
@@ -23,21 +21,17 @@ public class BungeeTabCompleteListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> commandList = CommandsList.getCommands(player);
|
|
||||||
|
|
||||||
HashMap<String, Command> commandHashMap = new HashMap<>();
|
HashMap<String, Command> commandHashMap = new HashMap<>();
|
||||||
for (String s : commandList) {
|
CommandsList.getCommands(player).forEach(cmdName ->
|
||||||
for (Map.Entry<String, Command> command : CommandWhitelistBungee.getPlugin().getProxy().getPluginManager().getCommands()) {
|
CommandWhitelistBungee.getPlugin().getProxy().getPluginManager().getCommands()
|
||||||
if (s.equalsIgnoreCase(command.getValue().getName())) {
|
.stream()
|
||||||
commandHashMap.put(command.getKey(), command.getValue());
|
.filter(commandEntry -> cmdName.equalsIgnoreCase(commandEntry.getValue().getName()))
|
||||||
}
|
.forEach(commandEntry -> commandHashMap.put(commandEntry.getKey(), commandEntry.getValue())));
|
||||||
}
|
|
||||||
}
|
|
||||||
event.getCommands().values().removeIf((cmd) -> !commandHashMap.containsValue(cmd));
|
event.getCommands().values().removeIf((cmd) -> !commandHashMap.containsValue(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user