Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import dev.mizarc.waystonewarps.interaction.utils.lore
import dev.mizarc.waystonewarps.interaction.utils.name
import me.xdrop.fuzzywuzzy.FuzzySearch
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import net.kyori.adventure.translation.GlobalTranslator
import org.bukkit.event.inventory.ClickType
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
Expand Down Expand Up @@ -310,7 +312,15 @@ class WarpMenu(
localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_RIGHT_CLICK)
)

for (warp in warps) {
val costItem = configService.getTeleportCostItem()
val costItemStack = ItemStack(Material.valueOf(costItem.uppercase()))
val playerLocale = player.locale()
val translationComponent = Component.translatable(costItemStack.type.translationKey())
val renderedComponent = GlobalTranslator.render(translationComponent, playerLocale)
val itemDisplayName = LegacyComponentSerializer.legacySection().serialize(renderedComponent)


for (warp in warps) {
val warpModel = warp.toViewModel()
val locationText = warpModel.location?.let { location ->
if (configService.worldNameEnabled()) {
Expand All @@ -326,7 +336,7 @@ class WarpMenu(
if (configService.isTeleportCostEnabled() && configService.getTeleportCostType() == CostType.ITEM) {
val cost = teleportationService.calculateCost(player.uniqueId, warp)
if (cost > 0) {
customLore.add(0, "§6${localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_COST, cost)}")
customLore.add(0, "§a${localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_COST, cost, itemDisplayName)}")
}
}
customLore.add(0, "§8$locationText")
Expand Down Expand Up @@ -361,20 +371,20 @@ class WarpMenu(
// Add permission-related lore (only show one message at a time, priority order)
when {
!hasTeleportPermission -> {
customLore.add(2, "§c${
customLore.add(3, "§c${
localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_NO_TELEPORT_PERMISSION)
}")
}
!hasInterworldPermission && !hasIntergroupPermission -> {
customLore.add(2, "§c${
customLore.add(3, "§c${
localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_NO_INTERWORLD_PERMISSION)
}")
}
isLocked -> {
// No additional message needed if locked
}
else -> {
customLore.add(2, localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_LEFT_CLICK))
customLore.add(3, localizationProvider.get(player.uniqueId, LocalizationKeys.MENU_WARP_ITEM_WARP_LORE_LEFT_CLICK))
}
}

Expand Down
7 changes: 2 additions & 5 deletions src/main/resources/lang/defaults/en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ command.invalids.remove.error=An error occurred while removing warps: {0}
command.invalids.remove.invalid_world=Error: ''{0}'' is not a valid UUID or world name
command.invalids.no_invalid_warps=No invalid warps found.



# -------------------------------------
# Action Feedback
# -------------------------------------
Expand Down Expand Up @@ -56,7 +54,7 @@ feedback.teleport.locked=Cannot teleport to a warp that is now locked
feedback.teleport.cancelled=Cancelled teleport due to movement
feedback.teleport.no_permission=You don't have permission to teleport
feedback.teleport.no_interworld_permission=You don't have permission to teleport to that world from your current location
feedback.teleport.on_cooldown=Waystone on cooldown, {0}s remaining
feedback.teleport.on_cooldown=Cooldown active, {0}s remaining


# -------------------------------------
Expand Down Expand Up @@ -168,7 +166,7 @@ menu.warp.item.warp.lore.left_click=Left Click to teleport
menu.warp.item.warp.lore.locked=LOCKED
menu.warp.item.warp.lore.no_teleport_permission=You don't have permission to teleport
menu.warp.item.warp.lore.no_interworld_permission=You don't have permission to teleport to that world from your current location
menu.warp.item.warp.lore.cost=Cost: {0} Warp Stone(s)
menu.warp.item.warp.lore.cost=Teleport cost: {0} {1}(s)

# Warp Options Menu
menu.warp_options.title=Warp '{0}'
Expand Down Expand Up @@ -222,6 +220,5 @@ menu.warp_management.group.none=No Group
# Warp title (group-filtered)
menu.warp.title.grouped=Warps - {0}


# Warp Search Menu
menu.warp_search.title=Search for warp
40 changes: 38 additions & 2 deletions src/main/resources/lang/defaults/zh_cn.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ command.invalids.remove.error=移除传送点时发生错误: {0}
command.invalids.remove.invalid_world=错误: ''{0}'' 不是有效的 UUID 或世界名称
command.invalids.no_invalid_warps=未发现无效传送点。


# -------------------------------------
# Action Feedback / 动作反馈
# -------------------------------------
Expand Down Expand Up @@ -47,7 +46,7 @@ feedback.teleport.locked=无法传送到已锁定的传送点
feedback.teleport.cancelled=传送因移动而取消
feedback.teleport.no_permission=你没有权限进行传送
feedback.teleport.no_interworld_permission=你当前所在的位置没有权限传送至该世界

feedback.teleport.on_cooldown=传送冷却中,还剩 {0} 秒

# -------------------------------------
# Conditions / 条件限制
Expand Down Expand Up @@ -77,8 +76,11 @@ menu.warp_management.title=传送点 ''{0}''
menu.warp_management.access.name=访问权限: {0}
menu.warp_management.access.name.public=公开
menu.warp_management.access.name.private=私有
menu.warp_management.access.name.global=全局
menu.warp_management.access.lore.public=所有玩家都可以发现并传送。
menu.warp_management.access.lore.private=只有白名单内的玩家可以发现并传送。
menu.warp_management.access.lore.global=对所有玩家可见并开放使用。
menu.warp_management.access.lore_no_perm=你没有权限更改此访问模式。
menu.warp_management.players=已发现的玩家:
menu.warp_management.players.lore={0}
menu.warp_management.rename=重命名传送点
Expand Down Expand Up @@ -155,6 +157,7 @@ menu.warp.item.warp.lore.left_click=左键点击 传送
menu.warp.item.warp.lore.locked=已锁定
menu.warp.item.warp.lore.no_teleport_permission=你没有传送权限
menu.warp.item.warp.lore.no_interworld_permission=你当前所在的位置没有权限传送至该世界
menu.warp.item.warp.lore.cost=传送费用:{0} {1}

# Warp Options Menu
menu.warp_options.title=传送点 '{0}'
Expand All @@ -172,5 +175,38 @@ menu.warp_options.item.cannot_delete.name=无法删除
menu.warp_options.item.cannot_delete.lore=你是此传送点的拥有者!
menu.warp_options.confirm.delete=删除对 {0} 的访问权

# Warp Groups Browse Menu
menu.warp_groups.title=传送点分组
menu.warp_groups.item.warp_count=可访问 {0} 个传送点
menu.warp_groups.item.click_to_browse=点击查看传送点
menu.warp_groups.button.name=按分组浏览
menu.warp_groups.button.lore=查看按分组整理的传送点

# Warp Group Admin Management Menu
menu.warp_group_management.title=管理传送点分组
menu.warp_group_management.item.actions=左键重命名 | 右键删除
menu.warp_group_management.create.name=创建分组
menu.warp_group_management.create.lore=创建一个新的传送点分组
menu.warp_group_management.admin_button.name=管理分组
menu.warp_group_management.admin_button.lore=创建、重命名或删除传送点分组
menu.warp_group_management.confirm.delete=确定删除分组 "{0}"?{1} 个传送点将被取消分组。

# Warp Group Create / Rename Menus
menu.warp_group_create.title=创建分组
menu.warp_group_rename.title=重命名分组
menu.warp_group_rename.name_taken=该分组名称已存在

# Warp Group Picker Menu
menu.warp_group_picker.title=分配分组
menu.warp_group_picker.item.none.name=无分组
menu.warp_group_picker.item.none.lore=从所有分组中移除
menu.warp_group_picker.item.click=点击分配
menu.warp_group_picker.item.current=当前分组

# Warp Management Group button
menu.warp_management.group=分组
menu.warp_management.group.lore=将此传送点分配至一个分组
menu.warp_management.group.none=无分组

# Warp Search Menu
menu.warp_search.title=搜索传送点
Loading