新增 Vert 参数,可设置玩家圈地自动包含Y方向最大值。
All checks were successful
Java CI-CD with Maven / build (push) Successful in 8m25s

This commit is contained in:
zhangyuheng 2024-05-07 17:45:35 +08:00
parent 528adc5b46
commit 4a44ec7498
5 changed files with 36 additions and 2 deletions

View File

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

View File

@ -41,6 +41,10 @@ public class Apis {
Location location = player.getLocation();
Location location1 = new Location(location.getWorld(), location.getX() - size, location.getY() - size, location.getZ() - size);
Location location2 = new Location(location.getWorld(), location.getX() + size, location.getY() + size, location.getZ() + size);
if (Dominion.config.getLimitVert()) {
location1.setY(Dominion.config.getLimitMinY());
location2.setY(Dominion.config.getLimitMaxY());
}
Map<Integer, Location> points = new HashMap<>();
points.put(0, location1);
points.put(1, location2);

View File

@ -70,6 +70,10 @@ 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();
}
if (Dominion.config.getEconomyEnable()) {
int count;
if (Dominion.config.getEconomyOnlyXZ()) {

View File

@ -56,8 +56,28 @@ public class ConfigManager {
}
_limit_min_y = _file.getInt("Limit.MinY", -64);
_limit_max_y = _file.getInt("Limit.MaxY", 320);
if (_limit_min_y >= _limit_max_y) {
XLogger.err("Limit.MinY 不能大于或等于 Limit.MaxY已重置为 -64 320");
setLimitMinY(-64);
setLimitMaxY(320);
}
_limit_amount = _file.getInt("Limit.Amount", 10);
_limit_depth = _file.getInt("Limit.Depth", 10);
_limit_vert = _file.getBoolean("Limit.Vert", false);
if (_limit_vert) {
if (_limit_min_y == -1) {
XLogger.warn("启用 Limit.Vert 时 Limit.MinY 不能设置为无限,已自动调整为 -64");
setLimitMinY(-64);
}
if (_limit_max_y == -1) {
XLogger.warn("启用 Limit.Vert 时 Limit.MaxY 不能设置为无限,已自动调整为 320");
setLimitMaxY(320);
}
if (_limit_size_y <= _limit_max_y - _limit_min_y) {
setLimitSizeY(_limit_max_y - _limit_min_y + 1);
XLogger.warn("启用 Limit.Vert 时 Limit.SizeY 不能小于 Limit.MaxY - Limit.MinY已自动调整为 " + (_limit_max_y - _limit_min_y + 1));
}
}
_world_black_list = _file.getStringList("Limit.WorldBlackList");
_check_update = _file.getBoolean("CheckUpdate", true);
_tp_enable = _file.getBoolean("Teleport.Enable", false);
@ -232,6 +252,10 @@ public class ConfigManager {
_plugin.saveConfig();
}
public Boolean getLimitVert() {
return _limit_vert;
}
public List<String> getWorldBlackList() {
return _world_black_list;
}
@ -323,6 +347,7 @@ public class ConfigManager {
private Integer _limit_max_y;
private Integer _limit_amount;
private Integer _limit_depth;
private Boolean _limit_vert;
private List<String> _world_black_list;
private Boolean _check_update;

View File

@ -18,7 +18,8 @@ Limit:
SizeZ: 128 # Z方向最大长度
Amount: 10 # 最大领地数量
Depth: 3 # 子领地深度 0不允许子领地 -1不限制
WorldBlackList: [] # 不允许领地的世界
Vert: false # 是否自动延伸到 MaxY 和 MinY
WorldBlackList: [ ] # 不允许领地的世界
Teleport:
Enable: true