新增自定义圈地工具
Java CI-CD with Maven / build (push) Successful in 12m4s Details

This commit is contained in:
zhangyuheng 2024-04-22 00:19:53 +08:00
parent 28735eff4c
commit 07fe7de6ba
6 changed files with 52 additions and 30 deletions

View File

@ -52,7 +52,7 @@
领地有两种创建方式1.手动选择区域创建2.以操作者为中心自动创建。
手动创建:需要使用箭矢作为选区工具,依次使用左键点选领地长方体区域的第一个点、右键点击长方体区域的第二个点。然后使用`/dominion create <领地名称>`
手动创建:需要使用圈地工具(默认为箭矢),依次使用左键点选领地长方体区域的第一个点、右键点击长方体区域的第二个点。然后使用`/dominion create <领地名称>`
创建领地,领地名称不可与其他领地重复。
自动创建:不需要选择对角线点,会以玩家为中心自动创建一定区域的领地。使用 `/dominion auto_create <领地名称>`即可自动创建领地区域。
@ -183,24 +183,19 @@ Database:
User: dominion
Pass: dominion
# -1 表示不开启
AutoCreateRadius: 10
# 自动圈地大小
AutoCreateRadius: 10 #-1 表示不开启
# -1 表示不限制
Limit:
MinY: -64
MaxY: 320
SizeX: 128
SizeY: 64
SizeZ: 128
Amount: 10
MinY: -64 # 最小Y坐标
MaxY: 320 # 最大Y坐标
SizeX: 128 # X方向最大长度
SizeY: 64 # Y方向最大长度
SizeZ: 128 # Z方向最大长度
Amount: 10 # 最大领地数量
Depth: 3 # 子领地深度 0不允许子领地 -1不限制
WorldBlackList: [ ]
# -1 表示不开启
AutoCleanAfterDays: 180
BlueMap: true
WorldBlackList: [] # 不允许领地的世界
Teleport:
Enable: true
@ -209,6 +204,14 @@ Teleport:
# 冷却时间 秒
CoolDown: 0
# 自动清理长时间未上线玩家的领地
AutoCleanAfterDays: 180 # -1 表示不开启
# 圈地工具
Tool: ARROW
BlueMap: true
CheckUpdate: true
Debug: false

View File

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

View File

@ -34,7 +34,7 @@ public class DominionOperate {
}
Map<Integer, Location> points = Dominion.pointsSelect.get(player.getUniqueId());
if (points == null || points.get(0) == null || points.get(1) == null) {
Notification.error(sender, "请先使用箭矢选择领地的对角线两点,或使用 /dominion auto_create <领地名称> 创建自动领地");
Notification.error(sender, "请先使用工具选择领地的对角线两点,或使用 /dominion auto_create <领地名称> 创建自动领地");
return;
}
String name = args[1];
@ -61,7 +61,7 @@ public class DominionOperate {
}
Map<Integer, Location> points = Dominion.pointsSelect.get(player.getUniqueId());
if (points == null || points.get(0) == null || points.get(1) == null) {
Notification.error(sender, "请先使用箭矢选择子领地的对角线两点,或使用 /dominion auto_create_sub <子领地名称> [父领地名称] 创建自动子领地");
Notification.error(sender, "请先使用工具选择子领地的对角线两点,或使用 /dominion auto_create_sub <子领地名称> [父领地名称] 创建自动子领地");
return;
}
if (args.length == 2) {

View File

@ -23,7 +23,7 @@ public class SelectPointEvents implements Listener {
Player player = event.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() != Material.ARROW) {
if (item.getType() != Dominion.config.getTool()) {
return;
}
Block block = event.getClickedBlock();

View File

@ -1,6 +1,7 @@
package cn.lunadeer.dominion.utils;
import cn.lunadeer.dominion.Dominion;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.List;
@ -62,6 +63,11 @@ public class ConfigManager {
_tp_enable = _file.getBoolean("Teleport.Enable", false);
_tp_delay = _file.getInt("Teleport.Delay", 0);
_tp_cool_down = _file.getInt("Teleport.CoolDown", 0);
_tool = _file.getString("Tool", "ARROW");
if (Material.getMaterial(_tool) == null) {
XLogger.err("工具名称设置错误,已重置为 ARROW");
setTool("ARROW");
}
}
public Boolean isDebug() {
@ -260,6 +266,15 @@ public class ConfigManager {
_plugin.saveConfig();
}
public Material getTool() {
return Material.getMaterial(_tool);
}
public void setTool(String tool) {
_tool = tool;
_file.set("Tool", tool);
_plugin.saveConfig();
}
private final Dominion _plugin;
private FileConfiguration _file;
@ -290,4 +305,5 @@ public class ConfigManager {
private Boolean _tp_enable;
private Integer _tp_delay;
private Integer _tp_cool_down;
private String _tool;
}

View File

@ -6,19 +6,19 @@ Database:
User: dominion
Pass: dominion
# -1 表示不开启
AutoCreateRadius: 10
# 自动圈地大小
AutoCreateRadius: 10 #-1 表示不开启
# -1 表示不限制
Limit:
MinY: -64
MaxY: 320
SizeX: 128
SizeY: 64
SizeZ: 128
Amount: 10
MinY: -64 # 最小Y坐标
MaxY: 320 # 最大Y坐标
SizeX: 128 # X方向最大长度
SizeY: 64 # Y方向最大长度
SizeZ: 128 # Z方向最大长度
Amount: 10 # 最大领地数量
Depth: 3 # 子领地深度 0不允许子领地 -1不限制
WorldBlackList: []
WorldBlackList: [] # 不允许领地的世界
Teleport:
Enable: true
@ -27,8 +27,11 @@ Teleport:
# 冷却时间 秒
CoolDown: 0
# -1 表示不开启
AutoCleanAfterDays: 180
# 自动清理长时间未上线玩家的领地
AutoCleanAfterDays: 180 # -1 表示不开启
# 圈地工具
Tool: ARROW
BlueMap: true