Skip to content

Commit

Permalink
卫星地图展示新增所有人名称 #12
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdeZhang committed Sep 6, 2024
1 parent 04c3036 commit 18632f9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "cn.lunadeer"
version = "2.6.1-beta"
version = "2.6.2-beta"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ public class Translation extends Localization {
public static i18n Messages_PlaceholderAPIRegisterSuccess;
@i18nField(defaultValue = "共加载了 %d 个领地组")
public static i18n Messages_LoadedGroupAmount;
@i18nField(defaultValue = "<div>%s</div><div>所有人:%s</div>")
public static i18n Messages_MapInfoDetail;

@i18nField(defaultValue = "开始自动清理长时间未登录玩家领地数据")
public static i18n Messages_AutoCleanStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import cn.lunadeer.dominion.Cache;
import cn.lunadeer.dominion.dtos.DominionDTO;
import cn.lunadeer.dominion.dtos.PlayerDTO;
import cn.lunadeer.dominion.managers.Translation;
import cn.lunadeer.minecraftpluginutils.Scheduler;
import cn.lunadeer.minecraftpluginutils.XLogger;
Expand Down Expand Up @@ -37,6 +38,11 @@ public static void render() {
.build();

for (DominionDTO dominion : d.getValue()) {
PlayerDTO p = PlayerDTO.select(dominion.getOwner());
if (p == null) {
continue;
}

Collection<Vector2d> vectors = new ArrayList<>();
vectors.add(new Vector2d(dominion.getX1() + 0.001, dominion.getZ1() + 0.001));
vectors.add(new Vector2d(dominion.getX2() - 0.001, dominion.getZ1() + 0.001));
Expand All @@ -55,6 +61,7 @@ public static void render() {
Color fill = new Color(r, g, b, 0.2F);
ExtrudeMarker marker = ExtrudeMarker.builder()
.label(dominion.getName())
.detail(String.format(Translation.Messages_MapInfoDetail.trans(), dominion.getName(), p.getLastKnownName()))
.position(x, y, z)
.shape(shape, dominion.getY1() + 0.001f, dominion.getY2() - 0.001f)
.lineColor(line)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cn.lunadeer.dominion.utils.map;

import cn.lunadeer.dominion.dtos.DominionDTO;
import cn.lunadeer.dominion.dtos.PlayerDTO;
import cn.lunadeer.dominion.managers.Translation;
import cn.lunadeer.minecraftpluginutils.Scheduler;
import cn.lunadeer.minecraftpluginutils.XLogger;
Expand Down Expand Up @@ -40,7 +41,11 @@ public void apiEnabled(DynmapCommonAPI dynmapCommonAPI) {
}

private void setDominionMarker(DominionDTO dominion) {
String nameLabel = "<div>" + dominion.getName() + "</div>";
PlayerDTO p = PlayerDTO.select(dominion.getOwner());
if (p == null) {
return;
}
String nameLabel = String.format(Translation.Messages_MapInfoDetail.trans(), dominion.getName(), p.getLastKnownName());
double[] xx = {dominion.getX1(), dominion.getX2()};
double[] zz = {dominion.getZ1(), dominion.getZ2()};
if (dominion.getWorld() == null) {
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/languages/zh-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ Messages:
AutoCleanStart: 开始自动清理长时间未登录玩家领地数据
AutoCleanPlayer: 已清理玩家 %s 的领地数据
AutoCleanEnd: 自动清理完成
MapInfoDetail: <div>%s</div><div>所有人:%s</div>
TUI:
NotDominionOwnerOrAdminForPage: 你不是领地 %s 的拥有者或管理员,无权访问此页面
CommandHelp:
Expand Down

0 comments on commit 18632f9

Please sign in to comment.