Skip to content

Commit

Permalink
fix tab completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Telesphoreo committed Jan 20, 2024
1 parent c1d1be2 commit da22605
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 21 deletions.
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ repositories {
}

dependencies {
compileOnly("org.projectlombok:lombok:1.18.28")
annotationProcessor("org.projectlombok:lombok:1.18.28")
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
implementation("org.apache.commons:commons-lang3:3.12.0")
compileOnly("org.projectlombok:lombok:1.18.30")
annotationProcessor("org.projectlombok:lombok:1.18.30")
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
implementation("org.apache.commons:commons-lang3:3.14.0")
compileOnly("dev.plex:server:1.4-SNAPSHOT")
compileOnly("org.json:json:20230618")
implementation("org.jetbrains:annotations:24.0.1")
compileOnly("org.json:json:20231013")
implementation("org.jetbrains:annotations:24.1.0")
}

group = "dev.plex"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/dev/plex/command/GuildCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void registerSubCommand(PlexCommand subCommand)
}

@Override
public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
if (args.length == 1)
{
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/dev/plex/command/sub/ChatSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.guild.data.Member;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -15,8 +18,6 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Objects;

@CommandParameters(name = "chat", usage = "/guild <command> [message]", description = "Toggles guild chat or sends a guild chat message")
@CommandPermissions(source = RequiredCommandSource.IN_GAME, permission = "plex.guilds.chat")
public class ChatSubCommand extends PlexCommand
Expand Down Expand Up @@ -50,4 +51,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
8 changes: 8 additions & 0 deletions src/main/java/dev/plex/command/sub/CreateSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.guild.Guild;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -41,4 +43,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
});
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
8 changes: 8 additions & 0 deletions src/main/java/dev/plex/command/sub/HomeSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -35,4 +37,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
14 changes: 10 additions & 4 deletions src/main/java/dev/plex/command/sub/InfoSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import java.time.format.DateTimeFormatter;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.concurrent.CompletableFuture;

@CommandParameters(name = "info", aliases = "information", usage = "/guild <command>", description = "Shows the guild's information")
@CommandPermissions(source = RequiredCommandSource.IN_GAME, permission = "plex.guilds.info")
public class InfoSubCommand extends PlexCommand
Expand Down Expand Up @@ -55,4 +55,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
});
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
2 changes: 1 addition & 1 deletion src/main/java/dev/plex/command/sub/InviteSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}

@Override
public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
public @NotNull List<String> smartTabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) throws IllegalArgumentException
{
if (!(sender instanceof Player player))
{
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/dev/plex/command/sub/OwnerSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.guild.data.Member;
import dev.plex.player.PlexPlayer;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -58,4 +60,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
8 changes: 8 additions & 0 deletions src/main/java/dev/plex/command/sub/PrefixSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.util.minimessage.SafeMiniMessage;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -48,4 +50,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
8 changes: 8 additions & 0 deletions src/main/java/dev/plex/command/sub/SetHomeSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.util.CustomLocation;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -48,4 +50,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
11 changes: 9 additions & 2 deletions src/main/java/dev/plex/command/sub/SetWarpSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.util.CustomLocation;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Locale;

@CommandParameters(name = "setwarp", aliases = "makewarp,createwarp", usage = "/guild <command> <name>", description = "Creates a new warp at player's location with a specified name")
@CommandPermissions(source = RequiredCommandSource.IN_GAME, permission = "plex.guilds.setwarp")
public class SetWarpSubCommand extends PlexCommand
Expand Down Expand Up @@ -60,4 +61,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
12 changes: 9 additions & 3 deletions src/main/java/dev/plex/command/sub/WarpListSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.guild.Guild;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Set;

@CommandParameters(name = "warps", aliases = "listwarps", usage = "/guild <command>", description = "Displays a clickable list of warps")
@CommandPermissions(source = RequiredCommandSource.IN_GAME, permission = "plex.guilds.warps")
public class WarpListSubCommand extends PlexCommand
Expand Down Expand Up @@ -53,4 +53,10 @@ public Component getWarps(Guild guild)
}
return parent;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}
8 changes: 8 additions & 0 deletions src/main/java/dev/plex/command/sub/WarpSubCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import java.util.Collections;
import java.util.List;
import net.kyori.adventure.text.Component;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -41,4 +43,10 @@ protected Component execute(@NotNull CommandSender commandSender, @Nullable Play
}, () -> send(player, messageComponent("guildNotFound")));
return null;
}

@Override
public @NotNull List<String> smartTabComplete(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) throws IllegalArgumentException
{
return Collections.emptyList();
}
}

0 comments on commit da22605

Please sign in to comment.