diff --git a/mcdreforged.plugin.json b/mcdreforged.plugin.json index c16f75f..97e961b 100644 --- a/mcdreforged.plugin.json +++ b/mcdreforged.plugin.json @@ -1,6 +1,6 @@ { "id": "where2go", - "version": "0.1.1", + "version": "0.1.2", "name": "Where2go", "description": { "en_us": "An advanced 'location' plugin including sharing waypoints, search player pos, etc.", diff --git a/where2go/__init__.py b/where2go/__init__.py index fa1671e..7763431 100644 --- a/where2go/__init__.py +++ b/where2go/__init__.py @@ -109,7 +109,7 @@ def list(self, source: CommandSource, context: CommandContext): pre = pre.c(RAction.run_command, f"{self.prefix} list {page-1}") next = rtr("command.list.next").h(rtr(f"command.list.{'end' if page == total else 'next'}_prompt")) if page != total: - pre = pre.c(RAction.run_command, f"{self.prefix} list {page+1}") + next = next.c(RAction.run_command, f"{self.prefix} list {page+1}") source.reply(RTextList(rtr("command.list.left"), pre, rtr("command.list.page", current=page, total=total), next, rtr("command.list.right"))) @@ -154,7 +154,7 @@ def player_pos(self, source: CommandSource, context: CommandContext, player: str def on_user_info(self, server: PluginServerInterface, info: Info): waypoint = Waypoint.transform_xaero_waypoint(info.content) if waypoint: - server.reply(info, Display.temporary(waypoint, self.config["command"]["waypoints"])) + server.say(Display.temporary(waypoint, self.config["command"]["waypoints"])) return fastsearch = re.match(self.config["command"]["fastsearch_regex"], info.content) if not fastsearch: @@ -162,17 +162,17 @@ def on_user_info(self, server: PluginServerInterface, info: Info): name = fastsearch.groups()[0] target = self.waypoint_manager.search_name(name) if target: - server.reply(info, rtr("command.search.title", name=name, count=len(target))) + server.say(rtr("command.search.title", name=name, count=len(target))) for i in target: - server.reply(info, Display.show(i["waypoint"], i["id"])) + server.say(Display.show(i["waypoint"], i["id"])) return player_list = self.api.get_player_list() if not player_list or name not in player_list: - server.reply(info, rtr("command.fastsearch.nodata", name=name)) + server.say(rtr("command.fastsearch.nodata", name=name)) return player_pos = self.api.get_player_pos(name) if not player_pos: - server.reply(info, rtr("command.fastsearch.nodata", name=name)) + server.say(rtr("command.fastsearch.nodata", name=name)) return waypoint = Waypoint(player_pos["pos"], player_pos["dimension"], name) server.say(Display.show(waypoint)) diff --git a/where2go/utils/waypoints/__init__.py b/where2go/utils/waypoints/__init__.py index 814fb1b..b07b26d 100644 --- a/where2go/utils/waypoints/__init__.py +++ b/where2go/utils/waypoints/__init__.py @@ -89,7 +89,7 @@ def save(self): def search_name(self, content: str) -> List[WaypointData]: - targets = [data for data in self.data if self.is_string_similar(data["waypoint"].name, content)] + targets = [data for data in self.data if self.is_string_similar(data["waypoint"].name, content) or content in data["waypoint"].name] return targets