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
@@ -81,9 +81,11 @@ public class HomesManager {
|
||||
*/
|
||||
@NotNull
|
||||
public Map<String, List<String>> getPublicHomes() {
|
||||
return publicHomes.stream()
|
||||
.collect(HashMap::new, (m, e) -> m.put(e.getOwner().getUsername(), List.of(e.getName())),
|
||||
HashMap::putAll);
|
||||
return publicHomes.stream().collect(
|
||||
HashMap::new,
|
||||
(m, e) -> m.put(e.getOwner().getUsername(), List.of(e.getName())),
|
||||
HashMap::putAll
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,9 +94,26 @@ public class HomesManager {
|
||||
* @return a list of all cached public home identifiers
|
||||
*/
|
||||
@NotNull
|
||||
public List<String> getPublicHomeIdentifiers() {
|
||||
public List<String> getPublicHomeIdentifierNames() {
|
||||
return publicHomes.stream().map(Home::getIdentifier).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cached public homes.
|
||||
* <p>
|
||||
* This will return the full home identifier if there are multiple homes with the same name.
|
||||
*
|
||||
* @return a list of all cached public home identifiers
|
||||
*/
|
||||
@NotNull
|
||||
public List<String> getPublicHomeNames() {
|
||||
return publicHomes.stream()
|
||||
.map(Home::getIdentifier)
|
||||
.map(home -> {
|
||||
if (publicHomes.stream().filter(h -> h.getName().equals(home.getName())).count() > 1) {
|
||||
return home.getIdentifier();
|
||||
}
|
||||
return home.getName();
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user