mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
feat: allow /phome <name> on uniquely named homes
If multiple public homes with the same name exist, typing /phome (name) will bring up a filtered public home list containing the list of public homes with that name for you to click on. The username-prefixed name will also be the only one to show up in TAB. This commit also fixes a bug with home/warp lists showing a blank description on hover instead of `(none)`.
This commit is contained in:
32 files changed
+353
-81
No files matched your search
@@ -20,6 +20,7 @@
|
||||
package net.william278.huskhomes.command;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.user.CommandUser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -28,7 +29,7 @@ import java.util.List;
|
||||
public class PublicHomeCommand extends HomeCommand implements TabProvider {
|
||||
|
||||
protected PublicHomeCommand(@NotNull HuskHomes plugin) {
|
||||
super("phome", List.of("publichome"), plugin);
|
||||
super("phome", List.of("publichome"), PositionCommandType.PUBLIC_HOME, plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,7 +37,7 @@ public class PublicHomeCommand extends HomeCommand implements TabProvider {
|
||||
// Display the public home list if no arguments are provided
|
||||
if (args.length == 0) {
|
||||
plugin.getCommand(PublicHomeListCommand.class)
|
||||
.ifPresent(command -> command.showPublicHomeList(executor, 1));
|
||||
.ifPresent(command -> command.showPublicHomeList(executor, null, 1));
|
||||
return;
|
||||
}
|
||||
super.execute(executor, args);
|
||||
@@ -46,7 +47,10 @@ public class PublicHomeCommand extends HomeCommand implements TabProvider {
|
||||
@NotNull
|
||||
public List<String> suggest(@NotNull CommandUser executor, @NotNull String[] args) {
|
||||
if (args.length <= 2) {
|
||||
return filter(plugin.getManager().homes().getPublicHomeIdentifiers(), args);
|
||||
if (args.length >= 1 && args[0].contains(Home.IDENTIFIER_DELIMITER)) {
|
||||
return plugin.getManager().homes().getPublicHomeIdentifierNames();
|
||||
}
|
||||
return plugin.getManager().homes().getPublicHomeNames();
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user