Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
BlueTree242 committed Aug 1, 2022
2 parents fdff10b + b2d1f70 commit 4fbb419
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void onPlayerCommand(PlayerCommandPreprocessEvent e) {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
if (e.getPlayer().hasPermission("plhide.updatechecker")) {
Bukkit.getScheduler().runTask(core, () -> {
Bukkit.getScheduler().runTaskAsynchronously(core, () -> {
UpdateCheckResult result = PlatformPlugin.get().updateCheck();
if (result == null) return;
String msg = result.getVersionsBehind() == 0 ? null : ChatColor.translateAlternateColorCodes('&', "&e[APH-&2Spigot&e] " + Constants.DEFAULT_BEHIND.replace("{versions}", result.getVersionsBehind() + "").replace("{download}", result.getUpdateUrl()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ public static void handleSubCompleter(SubCommandCompleterList list, Group player
}
if (playerGroup == null) return;
ConfSubCompleterList originConfList = playerGroup.getSubCompleters();
List<CommandCompleter> cmds = playerGroup.getCompleteCommands();
boolean includedConfig = cmds.stream().anyMatch(c -> c.getName().equalsIgnoreCase(list.getName()) ||
(c.getName().startsWith("from:") && PlatformPlugin.get().getPluginForCommand(list.getName()) != null &&
PlatformPlugin.get().getPluginForCommand(list.getName()).equalsIgnoreCase(c.getName().replaceFirst("from:", ""))));
if (((whitelist && !includedConfig) || (!whitelist && includedConfig))) {
System.out.println(includedConfig);
list.removeAll(); //this command is not visible to player they might not see it's sub args
return;
}
ConfSubCompleterList confList = originConfList.ofCommand(list.getName());
if (!whitelist) applyBlacklist(list, confList);
else applyWhitelist(list, confList);
Expand All @@ -69,7 +78,7 @@ public static void applyBlacklist(SubCommandCompleterList list, ConfSubCompleter
}

public static void applyWhitelist(SubCommandCompleterList list, ConfSubCompleterList originConfList) {
if (list.isEmpty()) return;
if (originConfList.isEmpty()) return;
for (SubCommandCompleter completer : new ArrayList<>(list)) {
ConfSubCompleterList confList = originConfList.ofArgs(list.getArgs(completer));
if (confList.isEmpty()) {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# LICENSE
# AdvancedPlHide
# -------------
# Copyright (C) 2021 - 2021 BlueTree242
# Copyright (C) 2021 - 2022 BlueTree242
# -------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
Expand All @@ -21,5 +21,5 @@
#
group=tk.bluetree242
name=AdvancedPlHide
version=2.3
version=2.3.1
description=A Plugin that Allows you to remove parts of tab completion, and hide plugins from the tabcompleter!
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# LICENSE
# AdvancedPlHide
# -------------
# Copyright (C) 2021 - 2022 BlueTree242
# Copyright (C) 2021 - 2021 BlueTree242
# -------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
Expand Down

0 comments on commit 4fbb419

Please sign in to comment.