Skip to content

Commit

Permalink
Respect tab option for user commands
Browse files Browse the repository at this point in the history
  • Loading branch information
imDaniX committed Jul 5, 2023
1 parent 9368d1b commit f361ce1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class ArgumentsChain implements Comparable<ArgumentsChain> {
private final boolean consoleAllowed;
private final boolean ignoreAfter;
private final int priority;
private final boolean tab;

public ArgumentsChain(String chain, ConfigurationSection argSection) {
execs = new EnumMap<>(ExecType.class);
Expand All @@ -39,6 +40,7 @@ public ArgumentsChain(String chain, ConfigurationSection argSection) {
arguments.add(argument);
}
this.priority = priority;
this.tab = argSection.getBoolean("tab", true);
}

private void loadExecs(ConfigurationSection argSection) {
Expand All @@ -61,7 +63,7 @@ private void loadExecs(ConfigurationSection argSection) {
* @param args Current arguments
*/
public void tabComplete(List<String> complete, CommandSender sender, String[] args) {
if (args.length > arguments.size()) return;
if (!tab || args.length > arguments.size()) return;

if (sender instanceof ConsoleCommandSender) {
if (!consoleAllowed) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public boolean proceed(@NotNull Environment env, @NotNull String paramsStr) {
Parameters params = Parameters.fromString(paramsStr);
Player player = env.getPlayer();
if (!RaVault.isEconomyConnected()) return false;
if (params.size() == 0) return false;
if (params.size() <= 2) params = parseOldFormat(player, params.origin());
String amountStr = params.getString("amount");
if (amountStr.isEmpty()) return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.jetbrains.annotations.Nullable;

public record SafeEnum<E extends Enum<E>>(@Nullable E instance) {
public boolean isValidFor(E other) {
public boolean isValidFor(@Nullable E other) {
return instance == null || instance == other;
}

Expand Down

0 comments on commit f361ce1

Please sign in to comment.