Skip to content

Commit

Permalink
fix: 处理名称为 <.*>§. 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperScript-PRC committed Feb 7, 2025
1 parent 2ccf6eb commit cd807dc
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tooldelta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,20 +743,19 @@ def to_plain_name(name: str) -> str:
Returns:
str: 去除颜色代码后的名字
"""
if "§" in name:
name = Utils.remove_mc_color_code(name)
if name.count("<") > 1:
# <<VIP名><玩家名>> -> 玩家名
cleaned_name = Utils.remove_mc_color_code(name)
cached_str = ""
words = []

for char in cleaned_name:
for char in name:
if char == "<":
cached_str = ""
elif char == ">":
words.append(cached_str)
else:
cached_str += char

return words[-1]
elif name.startswith("<") and name.endswith(">"):
# <玩家名> -> 玩家名
Expand Down

0 comments on commit cd807dc

Please sign in to comment.