Skip to content

Commit

Permalink
Merge pull request #5 from LazyAlienServer/dev
Browse files Browse the repository at this point in the history
v0.1.2
  • Loading branch information
tanhHeng authored Jul 24, 2024
2 parents 0d2fe24 + 7f61d2b commit ad13e4e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
12 changes: 6 additions & 6 deletions where2go/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")))


Expand Down Expand Up @@ -154,25 +154,25 @@ 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:
return
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))
Expand Down
2 changes: 1 addition & 1 deletion where2go/utils/waypoints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit ad13e4e

Please sign in to comment.