diff --git a/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java index aaa24f81..93dc63e4 100644 --- a/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/DelHomeCommand.java @@ -31,7 +31,7 @@ import java.util.List; public class DelHomeCommand extends SavedPositionCommand { public DelHomeCommand(@NotNull HuskHomes plugin) { - super("delhome", List.of(), Home.class, List.of(), plugin); + super("delhome", List.of(), PositionCommandType.HOME, List.of(), plugin); } @Override diff --git a/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java index 1800c37e..53b51fad 100644 --- a/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/DelWarpCommand.java @@ -30,7 +30,7 @@ import java.util.List; public class DelWarpCommand extends SavedPositionCommand { public DelWarpCommand(@NotNull HuskHomes plugin) { - super("delwarp", List.of(), Warp.class, List.of(), plugin); + super("delwarp", List.of(), PositionCommandType.WARP, List.of(), plugin); setOperatorCommand(true); } diff --git a/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java index 3b25a8fa..021adeff 100644 --- a/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/EditHomeCommand.java @@ -36,7 +36,13 @@ import java.util.regex.Pattern; public class EditHomeCommand extends SavedPositionCommand { public EditHomeCommand(@NotNull HuskHomes plugin) { - super("edithome", List.of(), Home.class, List.of("rename", "description", "relocate", "privacy"), plugin); + super( + "edithome", + List.of(), + PositionCommandType.HOME, + List.of("rename", "description", "relocate", "privacy"), + plugin + ); } @Override diff --git a/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java index 64fbf79d..ce3c126b 100644 --- a/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/EditWarpCommand.java @@ -37,7 +37,13 @@ import java.util.regex.Pattern; public class EditWarpCommand extends SavedPositionCommand { public EditWarpCommand(@NotNull HuskHomes plugin) { - super("editwarp", List.of(), Warp.class, List.of("rename", "description", "relocate"), plugin); + super( + "editwarp", + List.of(), + PositionCommandType.WARP, + List.of("rename", "description", "relocate"), + plugin + ); setOperatorCommand(true); } diff --git a/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java index 041d064a..de10a641 100644 --- a/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/HomeCommand.java @@ -32,8 +32,9 @@ import java.util.Optional; public abstract class HomeCommand extends SavedPositionCommand { - protected HomeCommand(@NotNull String name, @NotNull List aliases, @NotNull HuskHomes plugin) { - super(name, aliases, Home.class, List.of("player"), plugin); + protected HomeCommand(@NotNull String name, @NotNull List aliases, @NotNull PositionCommandType type, + @NotNull HuskHomes plugin) { + super(name, aliases, type, List.of("player"), plugin); } @Override diff --git a/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java b/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java index ff80e996..46664810 100644 --- a/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java @@ -109,13 +109,17 @@ public class HomeListCommand extends ListCommand { final PaginatedList homeList = PaginatedList.of(homes.stream().map(home -> plugin.getLocales() .getRawLocale("home_list_item", - Locales.escapeText(home.getName()), home.getSafeIdentifier(), + Locales.escapeText(home.getName()), + home.getSafeIdentifier(), home.isPublic() ? plugin.getLocales().getRawLocale("home_is_public") .orElse("Public") : plugin.getLocales().getRawLocale("home_is_private") .orElse("Private"), - Locales.escapeText(home.getMeta().getDescription())) + home.getMeta().getDescription().isBlank() + ? plugin.getLocales().getNone() + : Locales.escapeText(home.getMeta().getDescription()) + ) .orElse(home.getName())).sorted().collect(Collectors.toList()), plugin.getLocales() .getBaseList(plugin.getSettings().getGeneral().getListItemsPerPage()) diff --git a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java index 3d2ccbd7..5be9ef6e 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java @@ -30,7 +30,7 @@ import java.util.List; public class PrivateHomeCommand extends HomeCommand { protected PrivateHomeCommand(@NotNull HuskHomes plugin) { - super("home", List.of(), plugin); + super("home", List.of(), PositionCommandType.HOME, plugin); } @Override diff --git a/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java index 5a56b7f7..c4cbd25f 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PublicHomeCommand.java @@ -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 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(); } diff --git a/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java b/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java index 2c713554..19a20836 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PublicHomeListCommand.java @@ -26,6 +26,7 @@ import net.william278.huskhomes.user.CommandUser; import net.william278.huskhomes.user.OnlineUser; import net.william278.paginedown.PaginatedList; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.Optional; @@ -40,19 +41,20 @@ public class PublicHomeListCommand extends ListCommand { @Override public void execute(@NotNull CommandUser executor, @NotNull String[] args) { final int pageNumber = parseIntArg(args, 0).orElse(1); - this.showPublicHomeList(executor, pageNumber); + this.showPublicHomeList(executor, null, pageNumber); } - protected void showPublicHomeList(@NotNull CommandUser executor, int pageNumber) { - if (executor instanceof OnlineUser user && cachedLists.containsKey(user.getUuid())) { + public void showPublicHomeList(@NotNull CommandUser executor, @Nullable String nameFilter, int pageNumber) { + if (nameFilter == null && executor instanceof OnlineUser user && cachedLists.containsKey(user.getUuid())) { executor.sendMessage(cachedLists.get(user.getUuid()).getNearestValidPage(pageNumber)); return; } - final List homes = plugin.getDatabase().getPublicHomes(); + final List homes = nameFilter == null ? plugin.getDatabase().getPublicHomes() + : plugin.getDatabase().getPublicHomes(nameFilter); plugin.fireEvent(plugin.getViewHomeListEvent(homes, executor, true), (event) -> this.generateList(executor, event.getHomes()).ifPresent(homeList -> { - if (executor instanceof OnlineUser onlineUser) { + if (nameFilter == null && executor instanceof OnlineUser onlineUser) { cachedLists.put(onlineUser.getUuid(), homeList); } executor.sendMessage(homeList.getNearestValidPage(pageNumber)); @@ -69,9 +71,15 @@ public class PublicHomeListCommand extends ListCommand { final PaginatedList homeList = PaginatedList.of(publicHomes.stream().map(home -> plugin.getLocales() .getRawLocale("public_home_list_item", - Locales.escapeText(home.getName()), home.getSafeIdentifier(), + publicHomes.stream() + .filter(h -> h.getName().equals(home.getName())).count() > 1 + ? home.getSafeIdentifier() : Locales.escapeText(home.getName()), + home.getSafeIdentifier(), Locales.escapeText(home.getOwner().getUsername()), - Locales.escapeText(home.getMeta().getDescription())) + home.getMeta().getDescription().isBlank() + ? plugin.getLocales().getNone() + : Locales.escapeText(home.getMeta().getDescription()) + ) .orElse(home.getName())).sorted().collect(Collectors.toList()), plugin.getLocales() .getBaseList(plugin.getSettings().getGeneral().getListItemsPerPage()) diff --git a/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java b/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java index 588a30e5..6189cfe2 100644 --- a/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/SavedPositionCommand.java @@ -35,10 +35,11 @@ import java.util.*; public abstract class SavedPositionCommand extends Command implements TabProvider { - private final Class positionType; protected final List arguments; + protected final PositionCommandType positionType; - protected SavedPositionCommand(@NotNull String name, @NotNull List aliases, @NotNull Class positionType, + protected SavedPositionCommand(@NotNull String name, @NotNull List aliases, + @NotNull PositionCommandType positionType, @NotNull List arguments, @NotNull HuskHomes plugin) { super(name, aliases, "" + formatUsage(arguments), plugin); this.positionType = positionType; @@ -50,7 +51,10 @@ public abstract class SavedPositionCommand extends Comm @NotNull public String getOtherPermission() { - return (positionType == Home.class ? super.getPermission("other") : super.getPermission()); + if (positionType != PositionCommandType.WARP) { + return super.getPermission("other"); + } + return super.getPermission("warp"); } @SuppressWarnings("unchecked") @@ -63,9 +67,10 @@ public abstract class SavedPositionCommand extends Comm return; } - final Optional position = (positionType == Home.class - ? resolveHome(executor, name.get()) - : resolveWarp(executor, name.get())); + // Resolve and execute + final Optional position = (positionType == PositionCommandType.WARP + ? resolveWarp(executor, name.get()) // Resolve warps + : resolveHome(executor, name.get())); // Resolve homes & public homes position.ifPresent(p -> execute(executor, (T) p, removeFirstArg(args))); } @@ -73,45 +78,68 @@ public abstract class SavedPositionCommand extends Comm private Optional resolveHome(@NotNull CommandUser executor, @NotNull String homeName) { if (homeName.contains(Home.IDENTIFIER_DELIMITER)) { - final String ownerUsername = homeName.substring(0, homeName.indexOf(Home.IDENTIFIER_DELIMITER)); - final String ownerHome = homeName.substring(homeName.indexOf(Home.IDENTIFIER_DELIMITER) + 1); - if (ownerUsername.isBlank() || ownerHome.isBlank()) { - plugin.getLocales().getLocale("error_invalid_syntax", getUsage()) - .ifPresent(executor::sendMessage); - return Optional.empty(); - } - - final Optional optionalHome = plugin.getDatabase().getUserDataByName(ownerUsername) - .flatMap(owner -> resolveHomeByName(owner.getUser(), ownerHome)); - if (optionalHome.isEmpty()) { - plugin.getLocales().getLocale(executor.hasPermission(getOtherPermission()) - ? "error_home_invalid_other" : "error_public_home_invalid", ownerUsername, ownerHome) - .ifPresent(executor::sendMessage); - return Optional.empty(); - } - - final Home home = optionalHome.get(); - if (executor instanceof OnlineUser user && !home.isPublic() && !user.equals(home.getOwner()) - && !user.hasPermission(getOtherPermission())) { - plugin.getLocales().getLocale("error_public_home_invalid", ownerUsername, ownerHome) - .ifPresent(executor::sendMessage); - return Optional.empty(); - } - - return optionalHome; + return resolveDelimitedHome(executor, homeName); + } else if (positionType == PositionCommandType.PUBLIC_HOME) { + return resolvePublicHome(executor, homeName); } else if (executor instanceof OnlineUser owner) { - final Optional optionalHome = resolveHomeByName(owner, homeName); - if (optionalHome.isEmpty()) { - plugin.getLocales().getLocale("error_home_invalid", homeName) - .ifPresent(executor::sendMessage); - return Optional.empty(); - } - return optionalHome; - } else { + return resolveOwnerHome(owner, homeName); + } + plugin.getLocales().getLocale("error_invalid_syntax", getUsage()) + .ifPresent(executor::sendMessage); + return Optional.empty(); + } + + private Optional resolveDelimitedHome(@NotNull CommandUser executor, @NotNull String homeName) { + final String ownerUsername = homeName.substring(0, homeName.indexOf(Home.IDENTIFIER_DELIMITER)); + final String ownerHome = homeName.substring(homeName.indexOf(Home.IDENTIFIER_DELIMITER) + 1); + if (ownerUsername.isBlank() || ownerHome.isBlank()) { plugin.getLocales().getLocale("error_invalid_syntax", getUsage()) .ifPresent(executor::sendMessage); return Optional.empty(); } + + final Optional optionalHome = plugin.getDatabase().getUserDataByName(ownerUsername) + .flatMap(owner -> resolveHomeByName(owner.getUser(), ownerHome)); + if (optionalHome.isEmpty()) { + plugin.getLocales().getLocale(executor.hasPermission(getOtherPermission()) + ? "error_home_invalid_other" : "error_public_home_invalid", ownerUsername, ownerHome) + .ifPresent(executor::sendMessage); + return Optional.empty(); + } + + final Home home = optionalHome.get(); + if (executor instanceof OnlineUser user && !home.isPublic() && !user.equals(home.getOwner()) + && !user.hasPermission(getOtherPermission())) { + plugin.getLocales().getLocale("error_public_home_invalid", ownerUsername, ownerHome) + .ifPresent(executor::sendMessage); + return Optional.empty(); + } + return optionalHome; + } + + private Optional resolvePublicHome(@NotNull CommandUser executor, @NotNull String homeName) { + final List publicHomes = plugin.getDatabase().getPublicHomes(homeName); + if (publicHomes.isEmpty()) { + plugin.getLocales().getLocale("error_unknown_public_home", homeName) + .ifPresent(executor::sendMessage); + return Optional.empty(); + } + if (publicHomes.size() > 1) { + plugin.getCommand(PublicHomeListCommand.class) + .ifPresent(command -> command.showPublicHomeList(executor, homeName, 1)); + return Optional.empty(); + } + return publicHomes.stream().findFirst(); + } + + private Optional resolveOwnerHome(@NotNull OnlineUser owner, @NotNull String homeName) { + final Optional optionalHome = resolveHomeByName(owner, homeName); + if (optionalHome.isEmpty()) { + plugin.getLocales().getLocale("error_home_invalid", homeName) + .ifPresent(owner::sendMessage); + return Optional.empty(); + } + return optionalHome; } private Optional resolveHomeByName(@NotNull User owner, @NotNull String homeName) { @@ -191,14 +219,23 @@ public abstract class SavedPositionCommand extends Comm @Override @NotNull public List suggest(@NotNull CommandUser executor, @NotNull String[] args) { - if (positionType != Home.class) { - return switch (args.length) { - case 0, 1 -> plugin.getManager().warps().getUsableWarps(executor); - case 2 -> arguments.stream().filter(a -> executor.hasPermission(getPermission(a))).toList(); - default -> List.of(); - }; - } + return switch (positionType) { + case HOME, PUBLIC_HOME -> suggestHome(executor, args); + case WARP -> suggestWarp(executor, args); + }; + } + @NotNull + private List suggestWarp(@NotNull CommandUser executor, @NotNull String[] args) { + return switch (args.length) { + case 0, 1 -> plugin.getManager().warps().getUsableWarps(executor); + case 2 -> arguments.stream().filter(a -> executor.hasPermission(getPermission(a))).toList(); + default -> List.of(); + }; + } + + @NotNull + private List suggestHome(@NotNull CommandUser executor, @NotNull String[] args) { return switch (args.length) { case 0, 1 -> { if (args.length == 1 && args[0].contains(Home.IDENTIFIER_DELIMITER)) { @@ -217,4 +254,10 @@ public abstract class SavedPositionCommand extends Comm }; } + protected enum PositionCommandType { + HOME, + PUBLIC_HOME, + WARP, + } + } diff --git a/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java b/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java index 7b021bbe..1f4b09a6 100644 --- a/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/WarpCommand.java @@ -32,7 +32,7 @@ import java.util.Optional; public class WarpCommand extends SavedPositionCommand { protected WarpCommand(@NotNull HuskHomes plugin) { - super("warp", List.of(), Warp.class, List.of("player"), plugin); + super("warp", List.of(), PositionCommandType.WARP, List.of("player"), plugin); } @Override diff --git a/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java b/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java index dc123efa..81e80856 100644 --- a/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/WarpListCommand.java @@ -69,8 +69,11 @@ public class WarpListCommand extends ListCommand { final PaginatedList warpList = PaginatedList.of(warps.stream().map(warp -> plugin.getLocales() .getRawLocale("warp_list_item", - Locales.escapeText(warp.getName()), warp.getSafeIdentifier(), - Locales.escapeText(warp.getMeta().getDescription()) + Locales.escapeText(warp.getName()), + warp.getSafeIdentifier(), + warp.getMeta().getDescription().isBlank() + ? plugin.getLocales().getNone() + : Locales.escapeText(warp.getMeta().getDescription()) ) .orElse(warp.getName())).sorted().collect(Collectors.toList()), plugin.getLocales() diff --git a/common/src/main/java/net/william278/huskhomes/database/Database.java b/common/src/main/java/net/william278/huskhomes/database/Database.java index f734642e..8780be1d 100644 --- a/common/src/main/java/net/william278/huskhomes/database/Database.java +++ b/common/src/main/java/net/william278/huskhomes/database/Database.java @@ -243,6 +243,27 @@ public abstract class Database { */ public abstract List getPublicHomes(); + /** + * Get a list of publicly-set {@link Home}s with a specific name. + * + * @param name The name of the home + * @param caseInsensitive Whether the name lookup query should be case-insensitive + * @return A list containing all publicly-set {@link Home}s with the specified name + */ + public abstract List getPublicHomes(@NotNull String name, boolean caseInsensitive); + + /** + * Get a list of publicly-set {@link Home}s with a specific name. + * + * @param name The name of the home + * @return A list containing all publicly-set {@link Home}s with the specified name + * @apiNote Whether lookup is case-sensitive is determined by the {@code general.case_insensitive_names} setting + */ + public List getPublicHomes(@NotNull String name) { + return getPublicHomes(name, plugin.getSettings().getGeneral().getNames().isCaseInsensitive()); + } + + /** * Get a list of publicly-set {@link Home}s on this {@link Server server}. * diff --git a/common/src/main/java/net/william278/huskhomes/database/H2Database.java b/common/src/main/java/net/william278/huskhomes/database/H2Database.java index e60fe542..b4d6b3af 100644 --- a/common/src/main/java/net/william278/huskhomes/database/H2Database.java +++ b/common/src/main/java/net/william278/huskhomes/database/H2Database.java @@ -296,19 +296,19 @@ public class H2Database extends Database { try (Connection connection = getConnection()) { // Delete Position PreparedStatement statement = connection.prepareStatement(formatStatementTables(""" - DELETE FROM `%positions_table%` - WHERE `id` - IN ((SELECT `last_position` FROM `%players_table%` WHERE `uuid` = ?), - (SELECT `offline_position` FROM `%players_table%` WHERE `uuid` = ?), - (SELECT `respawn_position` FROM `%players_table%` WHERE `uuid` = ?));""")); + DELETE FROM `%positions_table%` + WHERE `id` + IN ((SELECT `last_position` FROM `%players_table%` WHERE `uuid` = ?), + (SELECT `offline_position` FROM `%players_table%` WHERE `uuid` = ?), + (SELECT `respawn_position` FROM `%players_table%` WHERE `uuid` = ?));""")); statement.setString(1, uuid.toString()); statement.setString(2, uuid.toString()); statement.setString(3, uuid.toString()); statement.executeUpdate(); statement = connection.prepareStatement(formatStatementTables(""" - DELETE FROM `%players_table%` - WHERE `uuid`=?;""")); + DELETE FROM `%players_table%` + WHERE `uuid`=?;""")); statement.setString(1, uuid.toString()); statement.executeUpdate(); @@ -498,6 +498,54 @@ public class H2Database extends Database { return userHomes; } + @Override + public List getPublicHomes(@NotNull String name, boolean caseInsensitive) { + final List userHomes = new ArrayList<>(); + try (Connection connection = getConnection()) { + try (PreparedStatement statement = connection.prepareStatement(formatStatementTables(""" + SELECT `%homes_table%`.`uuid` AS `home_uuid`, `owner_uuid`, `username` AS `owner_username`, `name`, + `description`, `tags`, `timestamp`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, `world_uuid`, + `server_name`, `public` + FROM `%homes_table%` + INNER JOIN `%saved_positions_table%` + ON `%homes_table%`.`saved_position_id`=`%saved_positions_table%`.`id` + INNER JOIN `%positions_table` + ON `%saved_positions_table%`.`position_id`=`%positions_table%`.`id` + INNER JOIN `%players_table` + ON `%homes_table%`.`owner_uuid`=`%players_table%`.`uuid` + WHERE `public`=true + AND ((? AND UPPER(`name`) LIKE UPPER(?)) OR (`name`=?)) + ORDER BY `name`;"""))) { + statement.setBoolean(1, caseInsensitive); + statement.setString(2, name); + statement.setString(3, name); + + final ResultSet resultSet = statement.executeQuery(); + while (resultSet.next()) { + userHomes.add(Home.from(resultSet.getDouble("x"), + resultSet.getDouble("y"), + resultSet.getDouble("z"), + resultSet.getFloat("yaw"), + resultSet.getFloat("pitch"), + World.from(resultSet.getString("world_name"), + UUID.fromString(resultSet.getString("world_uuid"))), + resultSet.getString("server_name"), + PositionMeta.from(resultSet.getString("name"), + resultSet.getString("description"), + resultSet.getTimestamp("timestamp").toInstant(), + resultSet.getString("tags")), + UUID.fromString(resultSet.getString("home_uuid")), + User.of(UUID.fromString(resultSet.getString("owner_uuid")), + resultSet.getString("owner_username")), + resultSet.getBoolean("public"))); + } + } + } catch (SQLException e) { + plugin.log(Level.SEVERE, "Failed to query the database for public home data"); + } + return userHomes; + } + @Override public Optional getHome(@NotNull User user, @NotNull String homeName, boolean caseInsensitive) { try (Connection connection = getConnection()) { diff --git a/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java b/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java index 862aac0f..c9b1d9d5 100644 --- a/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java +++ b/common/src/main/java/net/william278/huskhomes/database/MySqlDatabase.java @@ -552,6 +552,54 @@ public class MySqlDatabase extends Database { return userHomes; } + @Override + public List getPublicHomes(@NotNull String name, boolean caseInsensitive) { + final List userHomes = new ArrayList<>(); + try (Connection connection = getConnection()) { + try (PreparedStatement statement = connection.prepareStatement(formatStatementTables(""" + SELECT `%homes_table%`.`uuid` AS `home_uuid`, `owner_uuid`, `username` AS `owner_username`, `name`, + `description`, `tags`, `timestamp`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, `world_uuid`, + `server_name`, `public` + FROM `%homes_table%` + INNER JOIN `%saved_positions_table%` + ON `%homes_table%`.`saved_position_id`=`%saved_positions_table%`.`id` + INNER JOIN `%positions_table%` + ON `%saved_positions_table%`.`position_id`=`%positions_table%`.`id` + INNER JOIN `%players_table%` + ON `%homes_table%`.`owner_uuid`=`%players_table%`.`uuid` + WHERE `public`=true + AND ((? AND UPPER(`name`) LIKE UPPER(?)) OR (`name`=?)) + ORDER BY `name`;"""))) { + statement.setBoolean(1, caseInsensitive); + statement.setString(2, name); + statement.setString(3, name); + + final ResultSet resultSet = statement.executeQuery(); + while (resultSet.next()) { + userHomes.add(Home.from(resultSet.getDouble("x"), + resultSet.getDouble("y"), + resultSet.getDouble("z"), + resultSet.getFloat("yaw"), + resultSet.getFloat("pitch"), + World.from(resultSet.getString("world_name"), + UUID.fromString(resultSet.getString("world_uuid"))), + resultSet.getString("server_name"), + PositionMeta.from(resultSet.getString("name"), + resultSet.getString("description"), + resultSet.getTimestamp("timestamp").toInstant(), + resultSet.getString("tags")), + UUID.fromString(resultSet.getString("home_uuid")), + User.of(UUID.fromString(resultSet.getString("owner_uuid")), + resultSet.getString("owner_username")), + resultSet.getBoolean("public"))); + } + } + } catch (SQLException e) { + plugin.log(Level.SEVERE, "Failed to query the database for public home data"); + } + return userHomes; + } + @Override public Optional getHome(@NotNull User user, @NotNull String homeName, boolean caseInsensitive) { try (Connection connection = getConnection()) { diff --git a/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java b/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java index decc65f4..fab98166 100644 --- a/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java +++ b/common/src/main/java/net/william278/huskhomes/database/SqLiteDatabase.java @@ -514,6 +514,52 @@ public class SqLiteDatabase extends Database { return userHomes; } + @Override + public List getPublicHomes(@NotNull String name, boolean caseInsensitive) { + final List userHomes = new ArrayList<>(); + try (PreparedStatement statement = getConnection().prepareStatement(formatStatementTables(""" + SELECT `%homes_table%`.`uuid` AS `home_uuid`, `owner_uuid`, `username` AS `owner_username`, + `name`, `description`, `tags`, `timestamp`, `x`, `y`, `z`, `yaw`, `pitch`, `world_name`, + `world_uuid`, `server_name`, `public` + FROM `%homes_table%` + INNER JOIN `%saved_positions_table%` + ON `%homes_table%`.`saved_position_id`=`%saved_positions_table%`.`id` + INNER JOIN `%positions_table%` + ON `%saved_positions_table%`.`position_id`=`%positions_table%`.`id` + INNER JOIN `%players_table%` + ON `%homes_table%`.`owner_uuid`=`%players_table%`.`uuid` + WHERE `public`=true + AND ((? AND UPPER(`name`) LIKE UPPER(?)) OR (`name`=?)) + ORDER BY `name`;"""))) { + statement.setBoolean(1, caseInsensitive); + statement.setString(2, name); + statement.setString(3, name); + + final ResultSet resultSet = statement.executeQuery(); + while (resultSet.next()) { + userHomes.add(Home.from(resultSet.getDouble("x"), + resultSet.getDouble("y"), + resultSet.getDouble("z"), + resultSet.getFloat("yaw"), + resultSet.getFloat("pitch"), + World.from(resultSet.getString("world_name"), + UUID.fromString(resultSet.getString("world_uuid"))), + resultSet.getString("server_name"), + PositionMeta.from(resultSet.getString("name"), + resultSet.getString("description"), + resultSet.getTimestamp("timestamp").toInstant(), + resultSet.getString("tags")), + UUID.fromString(resultSet.getString("home_uuid")), + User.of(UUID.fromString(resultSet.getString("owner_uuid")), + resultSet.getString("owner_username")), + resultSet.getBoolean("public"))); + } + } catch (SQLException e) { + plugin.log(Level.SEVERE, "Failed to query the database for public home data"); + } + return userHomes; + } + @Override public Optional getHome(@NotNull User user, @NotNull String homeName, boolean caseInsensitive) { try (PreparedStatement statement = getConnection().prepareStatement(formatStatementTables(""" diff --git a/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java b/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java index 6277323e..25d3e24b 100644 --- a/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java +++ b/common/src/main/java/net/william278/huskhomes/manager/HomesManager.java @@ -81,9 +81,11 @@ public class HomesManager { */ @NotNull public Map> 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 getPublicHomeIdentifiers() { + public List getPublicHomeIdentifierNames() { + return publicHomes.stream().map(Home::getIdentifier).toList(); + } + + /** + * Get a list of all cached public homes. + *

+ * 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 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(); } diff --git a/common/src/main/resources/locales/bg-bg.yml b/common/src/main/resources/locales/bg-bg.yml index a6c8678a..66817e40 100644 --- a/common/src/main/resources/locales/bg-bg.yml +++ b/common/src/main/resources/locales/bg-bg.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Error:](#ff3300) [You have not set any homes!](#ff7e5e)' error_no_public_homes_set: '[Error:](#ff3300) [There are no public homes set!](#ff7e5e)' error_no_warps_set: '[Error:](#ff3300) [There are no warps set!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Грешка:](#ff3300) [Не можахме да открием публичен дом притежаван от %1% наречен %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Грешка:](#ff3300) [Можете да поставяте максимум до %1% домове!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [The spawn position has not been set.](#ff7e5e)' diff --git a/common/src/main/resources/locales/de-de.yml b/common/src/main/resources/locales/de-de.yml index 8bb5440c..849b299d 100644 --- a/common/src/main/resources/locales/de-de.yml +++ b/common/src/main/resources/locales/de-de.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Fehler:](#ff3300) [Du hast keine Homes gesetzt!](#ff7e5e)' error_no_public_homes_set: '[Fehler:](#ff3300) [Es sind keine öffentlichen Homes gesetzt!](#ff7e5e)' error_no_warps_set: '[Fehler:](#ff3300) [Es sind keine Warps gesetzt!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Fehler:](#ff3300) [Es wurde kein öffentliches Home von %1% namens "%2%" gefunden.](#ff7e5e)' error_set_home_maximum_homes: '[Fehler:](#ff3300) [Du darfst nicht mehr als %1% Home(s) setzen!](#ff7e5e)' error_spawn_not_set: '[Fehler:](#ff3300) [Es wurde keine Spawn-Position festgelegt.](#ff7e5e)' diff --git a/common/src/main/resources/locales/en-gb.yml b/common/src/main/resources/locales/en-gb.yml index 796ad0b3..790a7b6f 100644 --- a/common/src/main/resources/locales/en-gb.yml +++ b/common/src/main/resources/locales/en-gb.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Error:](#ff3300) [You have not set any homes!](#ff7e5e)' error_no_public_homes_set: '[Error:](#ff3300) [There are no public homes set!](#ff7e5e)' error_no_warps_set: '[Error:](#ff3300) [There are no warps set!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Error:](#ff3300) [Could not find a public home owned by %1% called %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Error:](#ff3300) [You can only set a maximum of %1% homes!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [The spawn position has not been set.](#ff7e5e)' diff --git a/common/src/main/resources/locales/es-es.yml b/common/src/main/resources/locales/es-es.yml index 75fb9e83..a87ba578 100644 --- a/common/src/main/resources/locales/es-es.yml +++ b/common/src/main/resources/locales/es-es.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Error:](#ff3300) [¡No tienes ninguna casa!](#ff7e5e)' error_no_public_homes_set: '[Error:](#ff3300) [No se han establecido hogares públicos.](#ff7e5e)' error_no_warps_set: '[Error:](#ff3300) [No hay warps creados.](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Error:](#ff3300) [No se ha podido encontrar una casa pública propiedad de %1% llamada %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Error:](#ff3300) [Sólo se puede establecer un máximo de %1% casas!](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [La posición del spawn no ha sido fijada.](#ff7e5e)' diff --git a/common/src/main/resources/locales/fr-fr.yml b/common/src/main/resources/locales/fr-fr.yml index 346adfbd..93e9d187 100644 --- a/common/src/main/resources/locales/fr-fr.yml +++ b/common/src/main/resources/locales/fr-fr.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Erreur :](#ff3300) [Vous n''avez créer aucun homes !](#ff7e5e)' error_no_public_homes_set: '[Erreur :](#ff3300)[Aucun home publique n''a été créé !](#ff7e5e)' error_no_warps_set: '[Erreur :](#ff3300) [Aucun warp n''a été créé !](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Erreur :](#ff3300) [L''home %2% posseder par %1% est introuvable.](#ff7e5e)' error_set_home_maximum_homes: '[Erreur :](#ff3300) [Vous ne pouvez avoir qu''un maximum de %1% homes !](#ff7e5e)' error_spawn_not_set: '[Erreur :](#ff3300) [La position du spawn n''a pas été définit.](#ff7e5e)' diff --git a/common/src/main/resources/locales/it-it.yml b/common/src/main/resources/locales/it-it.yml index df6059ee..31e1425f 100644 --- a/common/src/main/resources/locales/it-it.yml +++ b/common/src/main/resources/locales/it-it.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Errore:](#ff3300) [Non hai nessuna home!](#ff7e5e)' error_no_public_homes_set: '[Errore:](#ff3300) [Non ci sono home pubbliche!](#ff7e5e)' error_no_warps_set: '[Errore:](#ff3300) [Non ci sono warp impostati!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Errore:](#ff3300) [Non trovo la home di %1% chiamata %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Errore:](#ff3300) [Puoi impostare un massimo di %1% home!](#ff7e5e)' error_spawn_not_set: '[Errore:](#ff3300) [Il punto di spawn non è impostato.](#ff7e5e)' diff --git a/common/src/main/resources/locales/ja-jp.yml b/common/src/main/resources/locales/ja-jp.yml index 7f15fcd7..ea06cd2f 100644 --- a/common/src/main/resources/locales/ja-jp.yml +++ b/common/src/main/resources/locales/ja-jp.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[エラー:](#ff3300) [ホームをまだ設定していません!](#ff7e5e)' error_no_public_homes_set: '[エラー:](#ff3300) [パブリックホームはまだ設定されていません!(#ff7e5e)' error_no_warps_set: '[エラー:](#ff3300) [ワープはまだ設定されていません!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[エラー:](#ff3300) [%1% が所有するパブリックホーム %2% は見つかりませんでした。](#ff7e5e)' error_set_home_maximum_homes: '[エラー:](#ff3300) [最大で %1% までしかホームを設定できません!](#ff7e5e)' error_spawn_not_set: '[エラー:](#ff3300) [スポーン位置がまだ設定されていません。](#ff7e5e)' diff --git a/common/src/main/resources/locales/ko-kr.yml b/common/src/main/resources/locales/ko-kr.yml index eabe4e75..d330306a 100644 --- a/common/src/main/resources/locales/ko-kr.yml +++ b/common/src/main/resources/locales/ko-kr.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[오류:](#ff3300) [당신은 아직 아무 집도 설정하지 않았습니다!](#ff7e5e)' error_no_public_homes_set: '[오류:](#ff3300) [설정된 공용 집이 없습니다!](#ff7e5e)' error_no_warps_set: '[오류:](#ff3300) [설정된 워프가 없습니다!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[오류:](#ff3300) [%1%님이 소유한 공용 집 %2%를 찾을 수 없습니다.](#ff7e5e)' error_set_home_maximum_homes: '[오류:](#ff3300) [%1%개 이상의 집을 생성할 수 없습니다!](#ff7e5e)' error_spawn_not_set: '[오류:](#ff3300) [스폰 위치가 아직 지정되지 않았습니다.](#ff7e5e)' diff --git a/common/src/main/resources/locales/pl-pl.yml b/common/src/main/resources/locales/pl-pl.yml index 3e70b330..eaf95a25 100644 --- a/common/src/main/resources/locales/pl-pl.yml +++ b/common/src/main/resources/locales/pl-pl.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Błąd:](#ff3300) [Nie ustawiłeś żadnych domów!](#ff7e5e)' error_no_public_homes_set: '[Błąd:](#ff3300) [Nie ma ustawionych żadnych domów publicznych!](#ff7e5e)' error_no_warps_set: '[Błąd:](#ff3300) [Nie ma ustawionych żadnych warpów!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Błąd:](#ff3300) [Nie można znaleźć domu publicznego należącego do %1% o nazwie %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Błąd:](#ff3300) [Możesz ustawić maksymalnie %1% domów!](#ff7e5e)' error_spawn_not_set: '[Błąd:](#ff3300) [Pozycja spawnu nie została jeszcze ustawiona.](#ff7e5e)' diff --git a/common/src/main/resources/locales/pt-br.yml b/common/src/main/resources/locales/pt-br.yml index 7c86eca7..88155c8e 100644 --- a/common/src/main/resources/locales/pt-br.yml +++ b/common/src/main/resources/locales/pt-br.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Erro:](#ff3300) [Você não definiu nenhuma casa!](#ff7e5e)' error_no_public_homes_set: '[Erro:](#ff3300) [Não há casas públicas definidas!](#ff7e5e)' error_no_warps_set: '[Erro:](#ff3300) [Não há warps definidos!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Erro:](#ff3300) [Não foi possível encontrar uma casa pública de %1% chamada %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Erro:](#ff3300) [Você só pode definir no máximo %1% casas!](#ff7e5e)' error_spawn_not_set: '[Erro:](#ff3300) [A posição de spawn não foi definida.](#ff7e5e)' diff --git a/common/src/main/resources/locales/ru-ru.yml b/common/src/main/resources/locales/ru-ru.yml index 3af8e6e4..71f375bb 100644 --- a/common/src/main/resources/locales/ru-ru.yml +++ b/common/src/main/resources/locales/ru-ru.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Ошибка:](#ff3300) [Вы не установили ни одного дома!](#ff7e5e)' error_no_public_homes_set: '[Ошибка:](#ff3300) [Публичные дома не установлены!](#ff7e5e)' error_no_warps_set: '[Ошибка:](#ff3300) [Телепортации не установлены!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Ошибка:](#ff3300) [Невозможно найти публичный дом, принадлежащий %1%, с именем %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Ошибка:](#ff3300) [Вы можете установить максимум %1% домов!](#ff7e5e)' error_spawn_not_set: '[Ошибка:](#ff3300) [Позиция спавна не установлена.](#ff7e5e)' diff --git a/common/src/main/resources/locales/tr-tr.yml b/common/src/main/resources/locales/tr-tr.yml index c78d9e6e..83df531c 100644 --- a/common/src/main/resources/locales/tr-tr.yml +++ b/common/src/main/resources/locales/tr-tr.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Hata:](#ff3300) [Herhangi bir ev belirlemediniz!](#ff7e5e)' error_no_public_homes_set: '[Hata:](#ff3300) [Halka açık ayarlanan ev yok!](#ff7e5e)' error_no_warps_set: '[Hata:](#ff3300) [Ayarlanan warp yok!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Hata:](#ff3300) [%1% tarafından sahip olunan, %2% adında bir herkese açık ev bulunamadı.](#ff7e5e)' error_set_home_maximum_homes: '[Hata:](#ff3300) [En fazla %1% ev ayarlayabilirsiniz!](#ff7e5e)' error_spawn_not_set: '[Hata:](#ff3300) [Spawn konumu ayarlanmadı.](#ff7e5e)' diff --git a/common/src/main/resources/locales/uk-ua.yml b/common/src/main/resources/locales/uk-ua.yml index aac4da0a..5d3249d8 100644 --- a/common/src/main/resources/locales/uk-ua.yml +++ b/common/src/main/resources/locales/uk-ua.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[Error:](#ff3300) [You have not set any homes!](#ff7e5e)' error_no_public_homes_set: '[Error:](#ff3300) [There are no public homes set!](#ff7e5e)' error_no_warps_set: '[Error:](#ff3300) [There are no warps set!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[Помилка:](#ff3300) [Не знайдено домівку гравця %1% з назвою %2%.](#ff7e5e)' error_set_home_maximum_homes: '[Помилка:](#ff3300) [Максимальна кількість твоїх домівок: %1%](#ff7e5e)' error_spawn_not_set: '[Error:](#ff3300) [The spawn position has not been set.](#ff7e5e)' diff --git a/common/src/main/resources/locales/zh-cn.yml b/common/src/main/resources/locales/zh-cn.yml index 3c8c4612..1d2df1da 100644 --- a/common/src/main/resources/locales/zh-cn.yml +++ b/common/src/main/resources/locales/zh-cn.yml @@ -142,6 +142,7 @@ locales: error_no_homes_set: '[错误:](#ff3300) [你还没设置任何家!](#ff7e5e)' error_no_public_homes_set: '[错误:](#ff3300) [没有任何公共的家!](#ff7e5e)' error_no_warps_set: '[错误:](#ff3300) [没有任何地标!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[错误:](#ff3300) [%1% 没有 %2% 公共家.](#ff7e5e)' error_set_home_maximum_homes: '[错误:](#ff3300) [最多可以设置 %1% 个家!](#ff7e5e)' error_spawn_not_set: '[错误:](#ff3300) [重生点尚未设置](#ff7e5e)' diff --git a/common/src/main/resources/locales/zh-tw.yml b/common/src/main/resources/locales/zh-tw.yml index efeb7cfb..2b0d3d3c 100644 --- a/common/src/main/resources/locales/zh-tw.yml +++ b/common/src/main/resources/locales/zh-tw.yml @@ -142,6 +142,7 @@ error_no_homes_set: '[錯誤:](#ff3300) [您還沒有設置任何家!](#ff7e5e)' error_no_public_homes_set: '[錯誤:](#ff3300) [目前沒有公共的家可傳送!](#ff7e5e)' error_no_warps_set: '[錯誤:](#ff3300) [目前沒有可傳送的地標!](#ff7e5e)' + error_unknown_public_home: '[Error:](#ff3300) [Could not find a public home with the name "%1%".](#ff7e5e)' error_public_home_invalid: '[錯誤:](#ff3300) [沒有在 %1% 名下找到名為 %2% 的公開傳點.](#ff7e5e)' error_set_home_maximum_homes: '[錯誤:](#ff3300) [最多可以設置 %1% 個家!](#ff7e5e)' error_spawn_not_set: '[錯誤:](#ff3300) [重生點尚未設置.](#ff7e5e)'