修复了自动垂直选取不生效问题

This commit is contained in:
zhangyuheng 2024-07-12 21:11:51 +08:00
parent c859718f8b
commit ba81403d6f
3 changed files with 14 additions and 10 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.35.10-beta</version>
<version>1.35.13-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -42,14 +42,23 @@ public class SelectPointEvents implements Listener {
if (action == Action.LEFT_CLICK_BLOCK) {
event.setCancelled(true);
Notification.info(player, "已选择第一个点: %d %d %d", block.getX(), block.getY(), block.getZ());
points.put(0, block.getLocation());
Location loc = block.getLocation();
if (Dominion.config.getLimitVert()) {
loc.setY(Dominion.config.getLimitMinY());
}
points.put(0, loc);
} else if (action == Action.RIGHT_CLICK_BLOCK) {
event.setCancelled(true);
Notification.info(player, "已选择第二个点: %d %d %d", block.getX(), block.getY(), block.getZ());
points.put(1, block.getLocation());
Location loc = block.getLocation();
if (Dominion.config.getLimitVert()) {
loc.setY(Dominion.config.getLimitMaxY());
}
points.put(1, loc);
} else {
return;
}
Dominion.pointsSelect.put(player.getUniqueId(), points);
if (points.size() == 2) {
World world = points.get(0).getWorld();
@ -57,7 +66,7 @@ public class SelectPointEvents implements Listener {
return;
}
if (!points.get(0).getWorld().equals(points.get(1).getWorld())) {
Notification.error(player, "两个点不在同一个世界");
Notification.warn(player, "两个点不在同一个世界");
return;
}
Notification.info(player, "已选择两个点,可以使用 /dominion create <领地名称> 创建领地");
@ -69,10 +78,6 @@ public class SelectPointEvents implements Listener {
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX());
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY());
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
if (Dominion.config.getLimitVert()) {
minY = Dominion.config.getLimitMinY();
maxY = Dominion.config.getLimitMaxY();
}
DominionDTO dominion = new DominionDTO(player.getUniqueId(), "", loc1.getWorld().getName(),
minX, minY, minZ, maxX, maxY, maxZ);
if (Dominion.config.getEconomyEnable()) {
@ -95,6 +100,5 @@ public class SelectPointEvents implements Listener {
Notification.info(player, "高度: %d", dominion.getHeight());
Notification.info(player, "体积: %d", dominion.getVolume());
}
Dominion.pointsSelect.put(player.getUniqueId(), points);
}
}

View File

@ -46,7 +46,7 @@ public class Menu {
.append(Button.create("所有领地").setExecuteCommand("/dominion all_dominion").build())
.append("查看所有领地");
Line config = Line.create()
.append(Button.create("系统配置").setExecuteCommand("/dominion config").build())
.append(Button.create("系统配置").setExecuteCommand("/dominion sys_config").build())
.append("查看/修改系统配置");
Line reload_cache = Line.create()
.append(Button.create("重载缓存").setExecuteCommand("/dominion reload_cache").build())