实现了领地系统多权限组(多种圈地限制)功能
This commit is contained in:
parent
230e26037f
commit
fd853661e3
@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "cn.lunadeer"
|
||||
version = "2.1.21-beta"
|
||||
version = "2.2.0-beta"
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
|
@ -102,14 +102,14 @@ public class SetConfig {
|
||||
}
|
||||
|
||||
private static void adjustSizeY() {
|
||||
if (Dominion.config.getLimitVert()) {
|
||||
Dominion.config.setLimitSizeY(Dominion.config.getLimitMaxY() - Dominion.config.getLimitMinY() + 1);
|
||||
if (Dominion.config.getLimitVert(null)) {
|
||||
Dominion.config.setLimitSizeY(Dominion.config.getLimitMaxY(null) - Dominion.config.getLimitMinY(null) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setLimitMaxY(CommandSender sender, String[] args) {
|
||||
int maxY = Integer.parseInt(args[2]);
|
||||
if (maxY <= Dominion.config.getLimitMinY()) {
|
||||
if (maxY <= Dominion.config.getLimitMinY(null)) {
|
||||
Notification.error(sender, "最高Y坐标限制不能小于最低Y坐标限制");
|
||||
return;
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class SetConfig {
|
||||
|
||||
private static void setLimitMinY(CommandSender sender, String[] args) {
|
||||
int minY = Integer.parseInt(args[2]);
|
||||
if (minY >= Dominion.config.getLimitMaxY()) {
|
||||
if (minY >= Dominion.config.getLimitMaxY(null)) {
|
||||
Notification.error(sender, "最低Y坐标限制不能大于最高Y坐标限制");
|
||||
return;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class DominionController {
|
||||
}
|
||||
// 检查领地数量是否达到上限
|
||||
if (amountNotValid(operator)) {
|
||||
operator.setResponse(FAIL.addMessage("你的领地数量已达上限(%d个)", Dominion.config.getLimitAmount()));
|
||||
operator.setResponse(FAIL.addMessage("你的领地数量已达上限(%d个)", Dominion.config.getLimitAmount(operator.getPlayer())));
|
||||
return;
|
||||
}
|
||||
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
||||
@ -169,7 +169,7 @@ public class DominionController {
|
||||
}
|
||||
// 检查经济
|
||||
if (!skipEco) {
|
||||
if (handleEconomyFailed(operator, Dominion.config.getEconomyOnlyXZ() ? dominion.getSquare() : dominion.getVolume(), true, FAIL, SUCCESS)) {
|
||||
if (handleEconomyFailed(operator, Dominion.config.getEconomyOnlyXZ(operator.getPlayer()) ? dominion.getSquare() : dominion.getVolume(), true, FAIL, SUCCESS)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@ public class DominionController {
|
||||
}
|
||||
AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "成功扩展领地 %s %d格", dominion_name, size);
|
||||
// 检查经济
|
||||
if (handleEconomyFailed(operator, Dominion.config.getEconomyOnlyXZ() ? sqr(newCords) - dominion.getSquare() : vol(newCords) - dominion.getVolume()
|
||||
if (handleEconomyFailed(operator, Dominion.config.getEconomyOnlyXZ(operator.getPlayer()) ? sqr(newCords) - dominion.getSquare() : vol(newCords) - dominion.getVolume()
|
||||
, true, FAIL, SUCCESS)) return;
|
||||
// 显示粒子效果
|
||||
dominion = dominion.setXYZ(newCords);
|
||||
@ -326,7 +326,7 @@ public class DominionController {
|
||||
}
|
||||
AbstractOperator.Result SUCCESS = new AbstractOperator.Result(AbstractOperator.Result.SUCCESS, "成功缩小领地 %s %d格", dominion_name, size);
|
||||
// 退还经济
|
||||
if (handleEconomyFailed(operator, Dominion.config.getEconomyOnlyXZ() ? dominion.getSquare() - sqr(newCords) : dominion.getVolume() - vol(newCords)
|
||||
if (handleEconomyFailed(operator, Dominion.config.getEconomyOnlyXZ(operator.getPlayer()) ? dominion.getSquare() - sqr(newCords) : dominion.getVolume() - vol(newCords)
|
||||
, false, FAIL, SUCCESS)) return;
|
||||
// 显示粒子效果
|
||||
dominion = dominion.setXYZ(newCords);
|
||||
@ -377,7 +377,7 @@ public class DominionController {
|
||||
DominionDTO.delete(dominion);
|
||||
// 退还经济
|
||||
int count;
|
||||
if (Dominion.config.getEconomyOnlyXZ()) {
|
||||
if (Dominion.config.getEconomyOnlyXZ(operator.getPlayer())) {
|
||||
count = dominion.getSquare();
|
||||
for (DominionDTO sub_dominion : sub_dominions) {
|
||||
count += sub_dominion.getSquare();
|
||||
@ -720,24 +720,24 @@ public class DominionController {
|
||||
operator.setResponse(FAIL.addMessage("领地的任意一边长度不得小于4"));
|
||||
return true;
|
||||
}
|
||||
if (x_length > Dominion.config.getLimitSizeX() && Dominion.config.getLimitSizeX() > 0) {
|
||||
operator.setResponse(FAIL.addMessage("领地X方向长度不能超过 %d", Dominion.config.getLimitSizeX()));
|
||||
if (x_length > Dominion.config.getLimitSizeX(operator.getPlayer()) && Dominion.config.getLimitSizeX(operator.getPlayer()) > 0) {
|
||||
operator.setResponse(FAIL.addMessage("领地X方向长度不能超过 %d", Dominion.config.getLimitSizeX(operator.getPlayer())));
|
||||
return true;
|
||||
}
|
||||
if (y_length > Dominion.config.getLimitSizeY() && Dominion.config.getLimitSizeY() > 0) {
|
||||
operator.setResponse(FAIL.addMessage("领地Y方向高度不能超过 %d", Dominion.config.getLimitSizeY()));
|
||||
if (y_length > Dominion.config.getLimitSizeY(operator.getPlayer()) && Dominion.config.getLimitSizeY(operator.getPlayer()) > 0) {
|
||||
operator.setResponse(FAIL.addMessage("领地Y方向高度不能超过 %d", Dominion.config.getLimitSizeY(operator.getPlayer())));
|
||||
return true;
|
||||
}
|
||||
if (z_length > Dominion.config.getLimitSizeZ() && Dominion.config.getLimitSizeZ() > 0) {
|
||||
operator.setResponse(FAIL.addMessage("领地Z方向长度不能超过 %d", Dominion.config.getLimitSizeZ()));
|
||||
if (z_length > Dominion.config.getLimitSizeZ(operator.getPlayer()) && Dominion.config.getLimitSizeZ(operator.getPlayer()) > 0) {
|
||||
operator.setResponse(FAIL.addMessage("领地Z方向长度不能超过 %d", Dominion.config.getLimitSizeZ(operator.getPlayer())));
|
||||
return true;
|
||||
}
|
||||
if (y2 > Dominion.config.getLimitMaxY()) {
|
||||
operator.setResponse(FAIL.addMessage("领地Y坐标不能超过 %d", Dominion.config.getLimitMaxY()));
|
||||
if (y2 > Dominion.config.getLimitMaxY(operator.getPlayer())) {
|
||||
operator.setResponse(FAIL.addMessage("领地Y坐标不能超过 %d", Dominion.config.getLimitMaxY(operator.getPlayer())));
|
||||
return true;
|
||||
}
|
||||
if (y1 < Dominion.config.getLimitMinY()) {
|
||||
operator.setResponse(FAIL.addMessage("领地Y坐标不能低于 %d", Dominion.config.getLimitMinY()));
|
||||
if (y1 < Dominion.config.getLimitMinY(operator.getPlayer())) {
|
||||
operator.setResponse(FAIL.addMessage("领地Y坐标不能低于 %d", Dominion.config.getLimitMinY(operator.getPlayer())));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -748,10 +748,10 @@ public class DominionController {
|
||||
if (operator.isOp() && Dominion.config.getLimitOpBypass()) {
|
||||
return false;
|
||||
}
|
||||
if (Dominion.config.getLimitDepth() == -1) {
|
||||
if (Dominion.config.getLimitDepth(operator.getPlayer()) == -1) {
|
||||
return false;
|
||||
}
|
||||
if (parent_dom.getId() != -1 && Dominion.config.getLimitDepth() == 0) {
|
||||
if (parent_dom.getId() != -1 && Dominion.config.getLimitDepth(operator.getPlayer()) == 0) {
|
||||
operator.setResponse(FAIL.addMessage("不允许创建子领地"));
|
||||
return true;
|
||||
}
|
||||
@ -763,8 +763,8 @@ public class DominionController {
|
||||
parent_dom = Cache.instance.getDominion(parent_dom.getParentDomId());
|
||||
level++;
|
||||
}
|
||||
if (level >= Dominion.config.getLimitDepth()) {
|
||||
operator.setResponse(FAIL.addMessage("子领地嵌套深度不能超过 %d", Dominion.config.getLimitDepth()));
|
||||
if (level >= Dominion.config.getLimitDepth(operator.getPlayer())) {
|
||||
operator.setResponse(FAIL.addMessage("子领地嵌套深度不能超过 %d", Dominion.config.getLimitDepth(operator.getPlayer())));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -774,14 +774,14 @@ public class DominionController {
|
||||
if (operator.isOp() && Dominion.config.getLimitOpBypass()) {
|
||||
return false;
|
||||
}
|
||||
return Cache.instance.getPlayerDominionCount(operator.getUniqueId()) >= Dominion.config.getLimitAmount() && Dominion.config.getLimitAmount() != -1;
|
||||
return Cache.instance.getPlayerDominionCount(operator.getUniqueId()) >= Dominion.config.getLimitAmount(operator.getPlayer()) && Dominion.config.getLimitAmount(operator.getPlayer()) != -1;
|
||||
}
|
||||
|
||||
private static boolean worldNotValid(AbstractOperator operator, String world) {
|
||||
if (operator.isOp() && Dominion.config.getLimitOpBypass()) {
|
||||
return false;
|
||||
}
|
||||
return Dominion.config.getWorldBlackList().contains(world);
|
||||
return Dominion.config.getWorldBlackList(operator.getPlayer()).contains(world);
|
||||
}
|
||||
|
||||
private static DominionDTO getExistDomAndIsOwner(AbstractOperator operator, String dominion_name) {
|
||||
@ -817,7 +817,7 @@ public class DominionController {
|
||||
SUCCESS.addMessage("你是OP,已跳过经济检查。");
|
||||
return false;
|
||||
}
|
||||
float priceOrRefund = count * Dominion.config.getEconomyPrice();
|
||||
float priceOrRefund = count * Dominion.config.getEconomyPrice(operator.getPlayer());
|
||||
if (paid) {
|
||||
if (VaultConnect.instance.getBalance(operator.getPlayer()) < priceOrRefund) {
|
||||
operator.setResponse(FAIL.addMessage("你的余额不足,需要 %.2f %s", priceOrRefund, VaultConnect.instance.currencyNamePlural()));
|
||||
@ -826,7 +826,7 @@ public class DominionController {
|
||||
SUCCESS.addMessage("已扣除 %.2f %s", priceOrRefund, VaultConnect.instance.currencyNamePlural());
|
||||
VaultConnect.instance.withdrawPlayer(operator.getPlayer(), priceOrRefund);
|
||||
} else {
|
||||
float refund = priceOrRefund * Dominion.config.getEconomyRefund();
|
||||
float refund = priceOrRefund * Dominion.config.getEconomyRefund(operator.getPlayer());
|
||||
VaultConnect.instance.depositPlayer(operator.getPlayer(), refund);
|
||||
SUCCESS.addMessage("已退还 %.2f %s", refund, VaultConnect.instance.currencyNamePlural());
|
||||
}
|
||||
|
@ -6,8 +6,11 @@ import cn.lunadeer.minecraftpluginutils.VaultConnect.VaultConnect;
|
||||
import cn.lunadeer.minecraftpluginutils.XLogger;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -37,21 +40,6 @@ public class ConfigManager {
|
||||
setAutoCreateRadius(10);
|
||||
}
|
||||
_spawn_protection = _file.getInt("Limit.SpawnProtection", 10);
|
||||
_limit_size_x = _file.getInt("Limit.SizeX", 128);
|
||||
if (_limit_size_x <= 4 && _limit_size_x != -1) {
|
||||
XLogger.err("Limit.SizeX 尺寸不能小于 4,已重置为 128");
|
||||
setLimitSizeX(128);
|
||||
}
|
||||
_limit_size_y = _file.getInt("Limit.SizeY", 64);
|
||||
if (_limit_size_y <= 4 && _limit_size_y != -1) {
|
||||
XLogger.err("Limit.SizeY 尺寸不能小于 4,已重置为 64");
|
||||
setLimitSizeY(64);
|
||||
}
|
||||
_limit_size_z = _file.getInt("Limit.SizeZ", 128);
|
||||
if (_limit_size_z <= 4 && _limit_size_z != -1) {
|
||||
XLogger.err("Limit.SizeZ 尺寸不能小于 4,已重置为 128");
|
||||
setLimitSizeZ(128);
|
||||
}
|
||||
_blue_map = _file.getBoolean("BlueMap", false);
|
||||
_dynmap = _file.getBoolean("Dynmap", false);
|
||||
_auto_clean_after_days = _file.getInt("AutoCleanAfterDays", 180);
|
||||
@ -59,22 +47,7 @@ public class ConfigManager {
|
||||
XLogger.err("AutoCleanAfterDays 不能等于 0,已重置为 180");
|
||||
setAutoCleanAfterDays(180);
|
||||
}
|
||||
_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 && _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));
|
||||
}
|
||||
_limit_op_bypass = _file.getBoolean("Limit.OpByPass", true);
|
||||
_world_black_list = _file.getStringList("Limit.WorldBlackList");
|
||||
_check_update = _file.getBoolean("CheckUpdate", true);
|
||||
_tp_enable = _file.getBoolean("Teleport.Enable", false);
|
||||
_tp_delay = _file.getInt("Teleport.Delay", 0);
|
||||
@ -85,9 +58,6 @@ public class ConfigManager {
|
||||
setTool("ARROW");
|
||||
}
|
||||
_economy_enable = _file.getBoolean("Economy.Enable", false);
|
||||
_economy_price = (float) _file.getDouble("Economy.Price", 10.0);
|
||||
_economy_only_xz = _file.getBoolean("Economy.OnlyXZ", false);
|
||||
_economy_refund = (float) _file.getDouble("Economy.Refund", 0.85);
|
||||
if (getEconomyEnable()) {
|
||||
new VaultConnect(this._plugin);
|
||||
}
|
||||
@ -96,6 +66,61 @@ public class ConfigManager {
|
||||
_group_title_enable = _file.getBoolean("GroupTitle.Enable", false);
|
||||
_group_title_prefix = _file.getString("GroupTitle.Prefix", "&#ffffff[");
|
||||
_group_title_suffix = _file.getString("GroupTitle.Suffix", "&#ffffff]");
|
||||
|
||||
GroupLimit defaultGroup = new GroupLimit();
|
||||
defaultGroup.setLimitSizeX(_file.getInt("Limit.SizeX", 128));
|
||||
defaultGroup.setLimitSizeY(_file.getInt("Limit.SizeY", 64));
|
||||
defaultGroup.setLimitSizeZ(_file.getInt("Limit.SizeZ", 128));
|
||||
defaultGroup.setLimitMinY(_file.getInt("Limit.MinY", -64));
|
||||
defaultGroup.setLimitMaxY(_file.getInt("Limit.MaxY", 320));
|
||||
defaultGroup.setLimitAmount(_file.getInt("Limit.Amount", 10));
|
||||
defaultGroup.setLimitDepth(_file.getInt("Limit.Depth", 3));
|
||||
defaultGroup.setLimitVert(_file.getBoolean("Limit.Vert", false));
|
||||
defaultGroup.setWorldBlackList(_file.getStringList("Limit.WorldBlackList"));
|
||||
defaultGroup.setPrice(_file.getDouble("Economy.Price", 10.0));
|
||||
defaultGroup.setPriceOnlyXZ(_file.getBoolean("Economy.OnlyXZ", false));
|
||||
defaultGroup.setRefundRatio(_file.getDouble("Economy.Refund", 0.85));
|
||||
limits.put("default", defaultGroup);
|
||||
if (defaultGroup.getLimitSizeX() <= 4 && defaultGroup.getLimitSizeX() != -1) {
|
||||
XLogger.err("Limit.SizeX 尺寸不能小于 4,已重置为 128");
|
||||
setLimitSizeX(128);
|
||||
}
|
||||
if (defaultGroup.getLimitSizeY() <= 4 && defaultGroup.getLimitSizeY() != -1) {
|
||||
XLogger.err("Limit.SizeY 尺寸不能小于 4,已重置为 64");
|
||||
setLimitSizeY(64);
|
||||
}
|
||||
if (defaultGroup.getLimitSizeZ() <= 4 && defaultGroup.getLimitSizeZ() != -1) {
|
||||
XLogger.err("Limit.SizeZ 尺寸不能小于 4,已重置为 128");
|
||||
setLimitSizeZ(128);
|
||||
}
|
||||
if (defaultGroup.getLimitMinY() >= defaultGroup.getLimitMaxY()) {
|
||||
XLogger.err("Limit.MinY 不能大于或等于 Limit.MaxY,已重置为 -64 320");
|
||||
setLimitMinY(-64);
|
||||
setLimitMaxY(320);
|
||||
}
|
||||
if (defaultGroup.getRefundRatio() < 0.0 || defaultGroup.getRefundRatio() > 1.0) {
|
||||
XLogger.err("Economy.Refund 设置不合法,已重置为 0.85");
|
||||
setEconomyRefund(0.85f);
|
||||
}
|
||||
if (defaultGroup.getPrice() < 0.0) {
|
||||
XLogger.err("Economy.Price 设置不合法,已重置为 10.0");
|
||||
setEconomyPrice(10.0f);
|
||||
}
|
||||
if (defaultGroup.getLimitVert() && defaultGroup.getLimitSizeY() <= defaultGroup.getLimitMaxY() - defaultGroup.getLimitMinY()) {
|
||||
XLogger.warn("启用 Limit.Vert 时 Limit.SizeY 不能小于 Limit.MaxY - Limit.MinY,已自动调整为 " + (defaultGroup.getLimitMaxY() - defaultGroup.getLimitMinY() + 1));
|
||||
setLimitSizeY(defaultGroup.getLimitMaxY() - defaultGroup.getLimitMinY() + 1);
|
||||
}
|
||||
if (defaultGroup.getLimitAmount() < 0 && defaultGroup.getLimitAmount() != -1) {
|
||||
XLogger.err("Limit.Amount 设置不合法,已重置为 10");
|
||||
setLimitAmount(10);
|
||||
}
|
||||
if (defaultGroup.getLimitDepth() < 0 && defaultGroup.getLimitDepth() != -1) {
|
||||
XLogger.err("Limit.Depth 设置不合法,已重置为 3");
|
||||
setLimitDepth(3);
|
||||
}
|
||||
|
||||
limits.putAll(GroupLimit.loadGroups(_plugin));
|
||||
|
||||
saveAll(); // 回写文件 防止文件中的数据不完整
|
||||
Flag.loadFromJson(); // 加载 Flag 配置
|
||||
}
|
||||
@ -120,15 +145,15 @@ public class ConfigManager {
|
||||
_file.set("AutoCreateRadius", _auto_create_radius);
|
||||
|
||||
_file.set("Limit.SpawnProtection", _spawn_protection);
|
||||
_file.set("Limit.MinY", _limit_min_y);
|
||||
_file.set("Limit.MaxY", _limit_max_y);
|
||||
_file.set("Limit.SizeX", _limit_size_x);
|
||||
_file.set("Limit.SizeY", _limit_size_y);
|
||||
_file.set("Limit.SizeZ", _limit_size_z);
|
||||
_file.set("Limit.Amount", _limit_amount);
|
||||
_file.set("Limit.Depth", _limit_depth);
|
||||
_file.set("Limit.Vert", _limit_vert);
|
||||
_file.set("Limit.WorldBlackList", _world_black_list);
|
||||
_file.set("Limit.MinY", limits.get("default").getLimitMinY());
|
||||
_file.set("Limit.MaxY", limits.get("default").getLimitMaxY());
|
||||
_file.set("Limit.SizeX", limits.get("default").getLimitSizeX());
|
||||
_file.set("Limit.SizeY", limits.get("default").getLimitSizeY());
|
||||
_file.set("Limit.SizeZ", limits.get("default").getLimitSizeZ());
|
||||
_file.set("Limit.Amount", limits.get("default").getLimitAmount());
|
||||
_file.set("Limit.Depth", limits.get("default").getLimitDepth());
|
||||
_file.set("Limit.Vert", limits.get("default").getLimitVert());
|
||||
_file.set("Limit.WorldBlackList", limits.get("default").getWorldBlackList());
|
||||
_file.set("Limit.OpByPass", _limit_op_bypass);
|
||||
|
||||
_file.set("Teleport.Enable", _tp_enable);
|
||||
@ -140,9 +165,9 @@ public class ConfigManager {
|
||||
_file.set("Tool", _tool);
|
||||
|
||||
_file.set("Economy.Enable", _economy_enable);
|
||||
_file.set("Economy.Price", _economy_price);
|
||||
_file.set("Economy.OnlyXZ", _economy_only_xz);
|
||||
_file.set("Economy.Refund", _economy_refund);
|
||||
_file.set("Economy.Price", limits.get("default").getPrice());
|
||||
_file.set("Economy.OnlyXZ", limits.get("default").getPriceOnlyXZ());
|
||||
_file.set("Economy.Refund", limits.get("default").getRefundRatio());
|
||||
|
||||
_file.set("FlyPermissionNodes", _fly_permission_nodes);
|
||||
|
||||
@ -223,32 +248,32 @@ public class ConfigManager {
|
||||
return _db_pass;
|
||||
}
|
||||
|
||||
public Integer getLimitSizeX() {
|
||||
return _limit_size_x;
|
||||
public Integer getLimitSizeX(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitSizeX();
|
||||
}
|
||||
|
||||
public void setLimitSizeX(Integer max_x) {
|
||||
_limit_size_x = max_x;
|
||||
limits.get("default").setLimitSizeX(max_x);
|
||||
_file.set("Limit.SizeX", max_x);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Integer getLimitSizeY() {
|
||||
return _limit_size_y;
|
||||
public Integer getLimitSizeY(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitSizeY();
|
||||
}
|
||||
|
||||
public void setLimitSizeY(Integer max_y) {
|
||||
_limit_size_y = max_y;
|
||||
limits.get("default").setLimitSizeY(max_y);
|
||||
_file.set("Limit.SizeY", max_y);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Integer getLimitSizeZ() {
|
||||
return _limit_size_z;
|
||||
public Integer getLimitSizeZ(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitSizeZ();
|
||||
}
|
||||
|
||||
public void setLimitSizeZ(Integer max_z) {
|
||||
_limit_size_z = max_z;
|
||||
limits.get("default").setLimitSizeZ(max_z);
|
||||
_file.set("Limit.SizeZ", max_z);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
@ -281,58 +306,58 @@ public class ConfigManager {
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Integer getLimitMinY() {
|
||||
return _limit_min_y;
|
||||
public Integer getLimitMinY(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitMinY();
|
||||
}
|
||||
|
||||
public void setLimitMinY(Integer limit_bottom) {
|
||||
_limit_min_y = limit_bottom;
|
||||
limits.get("default").setLimitMinY(limit_bottom);
|
||||
_file.set("Limit.MinY", limit_bottom);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Integer getLimitMaxY() {
|
||||
return _limit_max_y;
|
||||
public Integer getLimitMaxY(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitMaxY();
|
||||
}
|
||||
|
||||
public void setLimitMaxY(Integer limit_top) {
|
||||
_limit_max_y = limit_top;
|
||||
limits.get("default").setLimitMaxY(limit_top);
|
||||
_file.set("Limit.MaxY", limit_top);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Integer getLimitAmount() {
|
||||
return _limit_amount;
|
||||
public Integer getLimitAmount(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitAmount();
|
||||
}
|
||||
|
||||
public void setLimitAmount(Integer limit_amount) {
|
||||
_limit_amount = limit_amount;
|
||||
limits.get("default").setLimitAmount(limit_amount);
|
||||
_file.set("Limit.Amount", limit_amount);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Integer getLimitDepth() {
|
||||
return _limit_depth;
|
||||
public Integer getLimitDepth(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitDepth();
|
||||
}
|
||||
|
||||
public void setLimitDepth(Integer limit_depth) {
|
||||
_limit_depth = limit_depth;
|
||||
limits.get("default").setLimitDepth(limit_depth);
|
||||
_file.set("Limit.Depth", limit_depth);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Boolean getLimitVert() {
|
||||
return _limit_vert;
|
||||
public Boolean getLimitVert(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getLimitVert();
|
||||
}
|
||||
|
||||
public void setLimitVert(Boolean limit_vert) {
|
||||
_limit_vert = limit_vert;
|
||||
limits.get("default").setLimitVert(limit_vert);
|
||||
_file.set("Limit.Vert", limit_vert);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public List<String> getWorldBlackList() {
|
||||
return _world_black_list;
|
||||
public List<String> getWorldBlackList(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getWorldBlackList();
|
||||
}
|
||||
|
||||
public Boolean getLimitOpBypass() {
|
||||
@ -399,32 +424,32 @@ public class ConfigManager {
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Float getEconomyPrice() {
|
||||
return _economy_price;
|
||||
public Float getEconomyPrice(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getPrice().floatValue();
|
||||
}
|
||||
|
||||
public void setEconomyPrice(Float economy_price) {
|
||||
_economy_price = economy_price;
|
||||
limits.get("default").setPrice((double) economy_price);
|
||||
_file.set("Economy.Price", economy_price);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Boolean getEconomyOnlyXZ() {
|
||||
return _economy_only_xz;
|
||||
public Boolean getEconomyOnlyXZ(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getPriceOnlyXZ();
|
||||
}
|
||||
|
||||
public void setEconomyOnlyXZ(Boolean economy_only_xz) {
|
||||
_economy_only_xz = economy_only_xz;
|
||||
limits.get("default").setPriceOnlyXZ(economy_only_xz);
|
||||
_file.set("Economy.OnlyXZ", economy_only_xz);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
|
||||
public Float getEconomyRefund() {
|
||||
return _economy_refund;
|
||||
public Float getEconomyRefund(Player player) {
|
||||
return limits.get(getPlayerGroup(player)).getRefundRatio().floatValue();
|
||||
}
|
||||
|
||||
public void setEconomyRefund(Float economy_refund) {
|
||||
_economy_refund = economy_refund;
|
||||
limits.get("default").setRefundRatio((double) economy_refund);
|
||||
_file.set("Economy.Refund", economy_refund);
|
||||
_plugin.saveConfig();
|
||||
}
|
||||
@ -526,5 +551,20 @@ public class ConfigManager {
|
||||
private String _group_title_prefix;
|
||||
private String _group_title_suffix;
|
||||
|
||||
private Map<String, GroupLimit> limits;
|
||||
private final Map<String, GroupLimit> limits = new HashMap<>();
|
||||
|
||||
private String getPlayerGroup(@Nullable Player player) {
|
||||
if (player == null) {
|
||||
return "default";
|
||||
}
|
||||
for (String group : limits.keySet()) {
|
||||
if (group.equals("default")) {
|
||||
continue;
|
||||
}
|
||||
if (player.hasPermission("group." + group)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return "default";
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GroupLimit {
|
||||
private final JavaPlugin plugin;
|
||||
YamlConfiguration config;
|
||||
private final File file_path;
|
||||
private Integer min_y;
|
||||
private Integer max_y;
|
||||
@ -25,9 +25,59 @@ public class GroupLimit {
|
||||
private Boolean only_xz;
|
||||
private Double refund;
|
||||
|
||||
public GroupLimit(JavaPlugin plugin, File filePath) {
|
||||
this.plugin = plugin;
|
||||
public GroupLimit() {
|
||||
this.file_path = null;
|
||||
}
|
||||
|
||||
public GroupLimit(File filePath) {
|
||||
this.file_path = filePath;
|
||||
config = YamlConfiguration.loadConfiguration(this.file_path);
|
||||
setLimitMinY(config.getInt("MinY", -64));
|
||||
setLimitMaxY(config.getInt("MaxY", 320));
|
||||
if (getLimitMinY() >= getLimitMaxY()) {
|
||||
XLogger.err("权限组 %s 的 MinY 不能大于等于 MaxY,已重置为 -64 和 320", this.file_path.getName());
|
||||
setLimitMinY(-64);
|
||||
setLimitMaxY(320);
|
||||
}
|
||||
setLimitSizeX(config.getInt("SizeX", 128));
|
||||
if (getLimitSizeX() <= 4 && getLimitSizeX() != -1) {
|
||||
XLogger.err("权限组 %s 的 SizeX 设置过小,已重置为 128", this.file_path.getName());
|
||||
setLimitSizeX(128);
|
||||
}
|
||||
setLimitSizeY(config.getInt("SizeY", 64));
|
||||
if (getLimitSizeY() <= 4 && getLimitSizeY() != -1) {
|
||||
XLogger.err("权限组 %s 的 SizeY 设置过小,已重置为 64", this.file_path.getName());
|
||||
setLimitSizeY(64);
|
||||
}
|
||||
setLimitSizeZ(config.getInt("SizeZ", 128));
|
||||
if (getLimitSizeZ() <= 4 && getLimitSizeZ() != -1) {
|
||||
XLogger.err("权限组 %s 的 SizeZ 设置过小,已重置为 128", this.file_path.getName());
|
||||
setLimitSizeZ(128);
|
||||
}
|
||||
setLimitAmount(config.getInt("Amount", 10));
|
||||
if (getLimitAmount() <= 0 && getLimitAmount() != -1) {
|
||||
XLogger.err("权限组 %s 的 Amount 设置不合法,已重置为 10", this.file_path.getName());
|
||||
setLimitAmount(10);
|
||||
}
|
||||
setLimitDepth(config.getInt("Depth", 3));
|
||||
if (getLimitDepth() <= 0 && getLimitDepth() != -1) {
|
||||
XLogger.err("权限组 %s 的 Depth 设置不合法,已重置为 3", this.file_path.getName());
|
||||
setLimitDepth(3);
|
||||
}
|
||||
setLimitVert(config.getBoolean("Vert", false));
|
||||
setWorldBlackList(config.getStringList("WorldBlackList"));
|
||||
setPrice(config.getDouble("Price", 10.0));
|
||||
if (getPrice() < 0.0) {
|
||||
XLogger.err("权限组 %s 的 Price 设置不合法,已重置为 10.0", this.file_path.getName());
|
||||
setPrice(10.0);
|
||||
}
|
||||
setPriceOnlyXZ(config.getBoolean("OnlyXZ", false));
|
||||
setRefundRatio(config.getDouble("Refund", 0.85));
|
||||
if (getRefundRatio() < 0.0 || getRefundRatio() > 1.0) {
|
||||
XLogger.err("权限组 %s 的 Refund 设置不合法,已重置为 0.85", this.file_path.getName());
|
||||
setRefundRatio(0.85);
|
||||
}
|
||||
save(); // 保存一次,确保文件中的数据是合法的
|
||||
}
|
||||
|
||||
public Integer getLimitMinY() {
|
||||
@ -78,96 +128,71 @@ public class GroupLimit {
|
||||
return refund;
|
||||
}
|
||||
|
||||
|
||||
public void setLimitMinY(Integer min_y) {
|
||||
this.min_y = min_y;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitMaxY(Integer max_y) {
|
||||
this.max_y = max_y;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitSizeX(Integer size_x) {
|
||||
this.size_x = size_x;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitSizeY(Integer size_y) {
|
||||
this.size_y = size_y;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitSizeZ(Integer size_z) {
|
||||
this.size_z = size_z;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitAmount(Integer amount) {
|
||||
this.amount = amount;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitDepth(Integer depth) {
|
||||
this.depth = depth;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setLimitVert(Boolean vert) {
|
||||
this.vert = vert;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setWorldBlackList(List<String> world_black_list) {
|
||||
this.world_black_list = world_black_list;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setPriceOnlyXZ(Boolean only_xz) {
|
||||
this.only_xz = only_xz;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void setRefundRatio(Double refund) {
|
||||
this.refund = refund;
|
||||
}
|
||||
|
||||
private static GroupLimit loadGroup(JavaPlugin plugin, File file) {
|
||||
GroupLimit group = new GroupLimit(plugin, file);
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(file);
|
||||
group.setLimitMinY(config.getInt("MinY", -64));
|
||||
group.setLimitMaxY(config.getInt("MaxY", 320));
|
||||
if (group.getLimitMinY() >= group.getLimitMaxY()) {
|
||||
XLogger.err("权限组 " + file.getName() + " 的 MinY 不能大于等于 MaxY,已重置为 -64 和 320");
|
||||
group.setLimitMinY(-64);
|
||||
group.setLimitMaxY(320);
|
||||
}
|
||||
group.setLimitSizeX(config.getInt("SizeX", 128));
|
||||
if (group.getLimitSizeX() <= 4 && group.getLimitSizeX() != -1) {
|
||||
XLogger.err("权限组 " + file.getName() + " 的 SizeX 设置过小,已重置为 128");
|
||||
group.setLimitSizeX(128);
|
||||
}
|
||||
group.setLimitSizeY(config.getInt("SizeY", 64));
|
||||
if (group.getLimitSizeY() <= 4 && group.getLimitSizeY() != -1) {
|
||||
XLogger.err("权限组 " + file.getName() + " 的 SizeY 设置过小,已重置为 64");
|
||||
group.setLimitSizeY(64);
|
||||
}
|
||||
group.setLimitSizeZ(config.getInt("SizeZ", 128));
|
||||
if (group.getLimitSizeZ() <= 4 && group.getLimitSizeZ() != -1) {
|
||||
XLogger.err("权限组 " + file.getName() + " 的 SizeZ 设置过小,已重置为 128");
|
||||
group.setLimitSizeZ(128);
|
||||
}
|
||||
group.setLimitAmount(config.getInt("Amount", 10));
|
||||
group.setLimitDepth(config.getInt("Depth", 3));
|
||||
group.setLimitVert(config.getBoolean("Vert", false));
|
||||
group.setWorldBlackList(config.getStringList("WorldBlackList"));
|
||||
group.setPrice(config.getDouble("Price", 10.0));
|
||||
group.setPriceOnlyXZ(config.getBoolean("OnlyXZ", false));
|
||||
group.setRefundRatio(config.getDouble("Refund", 0.85));
|
||||
if (group.getRefundRatio() < 0.0 || group.getRefundRatio() > 1.0) {
|
||||
XLogger.err("权限组 " + file.getName() + " 的 Refund 设置不合法,已重置为 0.85");
|
||||
group.setRefundRatio(0.85);
|
||||
}
|
||||
group.save();
|
||||
return group;
|
||||
this.save();
|
||||
}
|
||||
|
||||
private void save() {
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
if (file_path == null) {
|
||||
return;
|
||||
}
|
||||
config.set("MinY", min_y);
|
||||
config.set("MaxY", max_y);
|
||||
config.set("SizeX", size_x);
|
||||
@ -206,9 +231,10 @@ public class GroupLimit {
|
||||
continue;
|
||||
}
|
||||
String groupName = name.substring(0, name.length() - 4);
|
||||
GroupLimit group = GroupLimit.loadGroup(plugin, file);
|
||||
GroupLimit group = new GroupLimit(file);
|
||||
groups.put(groupName, group);
|
||||
}
|
||||
XLogger.info("共加载了 %d 个领地组。", groups.size());
|
||||
return groups;
|
||||
}
|
||||
}
|
||||
|
@ -41,38 +41,38 @@ public class SysConfig {
|
||||
|
||||
Line limitSizeX = Line.create()
|
||||
.append(Component.text(" X轴(东西)"));
|
||||
if (Dominion.config.getLimitSizeX() == -1) {
|
||||
if (Dominion.config.getLimitSizeX(null) == -1) {
|
||||
limitSizeX.append(Component.text("无限制")).append(Button.create("设置数值").setExecuteCommand("/dominion set_config limit_size_x 64 " + page).build());
|
||||
} else {
|
||||
limitSizeX.append(NumChanger.create(Dominion.config.getLimitSizeX(), "/dominion set_config limit_size_x").setPageNumber(page).build());
|
||||
limitSizeX.append(NumChanger.create(Dominion.config.getLimitSizeX(null), "/dominion set_config limit_size_x").setPageNumber(page).build());
|
||||
limitSizeX.append(Button.create("设置无限制").setExecuteCommand("/dominion set_config limit_size_x -1 " + page).build());
|
||||
}
|
||||
view.add(limitSizeX);
|
||||
Line limitSizeZ = Line.create()
|
||||
.append(Component.text(" Z轴(南北)"));
|
||||
if (Dominion.config.getLimitSizeZ() == -1) {
|
||||
if (Dominion.config.getLimitSizeZ(null) == -1) {
|
||||
limitSizeZ.append(Component.text("无限制")).append(Button.create("设置数值").setExecuteCommand("/dominion set_config limit_size_z 64 " + page).build());
|
||||
} else {
|
||||
limitSizeZ.append(NumChanger.create(Dominion.config.getLimitSizeZ(), "/dominion set_config limit_size_z").setPageNumber(page).build());
|
||||
limitSizeZ.append(NumChanger.create(Dominion.config.getLimitSizeZ(null), "/dominion set_config limit_size_z").setPageNumber(page).build());
|
||||
limitSizeZ.append(Button.create("设置无限制").setExecuteCommand("/dominion set_config limit_size_z -1 " + page).build());
|
||||
}
|
||||
view.add(limitSizeZ);
|
||||
Line limitSizeY = Line.create()
|
||||
.append(Component.text(" Y轴(垂直)"));
|
||||
if (!Dominion.config.getLimitVert()) {
|
||||
if (Dominion.config.getLimitSizeY() == -1) {
|
||||
if (!Dominion.config.getLimitVert(null)) {
|
||||
if (Dominion.config.getLimitSizeY(null) == -1) {
|
||||
limitSizeY.append(Component.text("无限制")).append(Button.create("设置数值").setExecuteCommand("/dominion set_config limit_size_y 64 " + page).build());
|
||||
} else {
|
||||
limitSizeY.append(NumChanger.create(Dominion.config.getLimitSizeY(), "/dominion set_config limit_size_y").setPageNumber(page).build());
|
||||
limitSizeY.append(NumChanger.create(Dominion.config.getLimitSizeY(null), "/dominion set_config limit_size_y").setPageNumber(page).build());
|
||||
limitSizeY.append(Button.create("设置无限制").setExecuteCommand("/dominion set_config limit_size_y -1 " + page).build());
|
||||
}
|
||||
} else {
|
||||
limitSizeY.append(Component.text(Dominion.config.getLimitSizeY())
|
||||
limitSizeY.append(Component.text(Dominion.config.getLimitSizeY(null))
|
||||
.style(Style.style(TextDecoration.STRIKETHROUGH))
|
||||
.hoverEvent(Component.text("因为垂直自动延伸已开启,此设置不可手动修改")));
|
||||
}
|
||||
view.add(limitSizeY);
|
||||
if (Dominion.config.getLimitVert()) {
|
||||
if (Dominion.config.getLimitVert(null)) {
|
||||
view.add(Line.create()
|
||||
.append("垂直自动延伸")
|
||||
.append(Button.createGreen("☑").setExecuteCommand("/dominion set_config limit_vert false " + page).build()));
|
||||
@ -83,27 +83,27 @@ public class SysConfig {
|
||||
}
|
||||
Line limitMaxY = Line.create()
|
||||
.append(Component.text("最高Y坐标限制"));
|
||||
limitMaxY.append(NumChanger.create(Dominion.config.getLimitMaxY(), "/dominion set_config limit_max_y").setPageNumber(page).build());
|
||||
limitMaxY.append(NumChanger.create(Dominion.config.getLimitMaxY(null), "/dominion set_config limit_max_y").setPageNumber(page).build());
|
||||
view.add(limitMaxY);
|
||||
Line limitMinY = Line.create()
|
||||
.append(Component.text("最低Y坐标限制"));
|
||||
limitMinY.append(NumChanger.create(Dominion.config.getLimitMinY(), "/dominion set_config limit_min_y").setPageNumber(page).build());
|
||||
limitMinY.append(NumChanger.create(Dominion.config.getLimitMinY(null), "/dominion set_config limit_min_y").setPageNumber(page).build());
|
||||
view.add(limitMinY);
|
||||
Line limitAmount = Line.create()
|
||||
.append(Component.text("每个玩家领地数量限制"));
|
||||
if (Dominion.config.getLimitAmount() == -1) {
|
||||
if (Dominion.config.getLimitAmount(null) == -1) {
|
||||
limitAmount.append(Component.text("无限制")).append(Button.create("设置数值").setExecuteCommand("/dominion set_config limit_amount 3 " + page).build());
|
||||
} else {
|
||||
limitAmount.append(NumChanger.create(Dominion.config.getLimitAmount(), "/dominion set_config limit_amount").setPageNumber(page).build());
|
||||
limitAmount.append(NumChanger.create(Dominion.config.getLimitAmount(null), "/dominion set_config limit_amount").setPageNumber(page).build());
|
||||
limitAmount.append(Button.create("设置无限制").setExecuteCommand("/dominion set_config limit_amount -1 " + page).build());
|
||||
}
|
||||
view.add(limitAmount);
|
||||
Line limitDepth = Line.create()
|
||||
.append(Component.text("领地深度限制"));
|
||||
if (Dominion.config.getLimitDepth() == -1) {
|
||||
if (Dominion.config.getLimitDepth(null) == -1) {
|
||||
limitDepth.append(Component.text("无限制")).append(Button.create("设置数值").setExecuteCommand("/dominion set_config limit_depth 64 " + page).build());
|
||||
} else {
|
||||
limitDepth.append(NumChanger.create(Dominion.config.getLimitDepth(), "/dominion set_config limit_depth").setPageNumber(page).build());
|
||||
limitDepth.append(NumChanger.create(Dominion.config.getLimitDepth(null), "/dominion set_config limit_depth").setPageNumber(page).build());
|
||||
limitDepth.append(Button.create("设置无限制").setExecuteCommand("/dominion set_config limit_depth -1 " + page).build());
|
||||
}
|
||||
view.add(limitDepth);
|
||||
@ -146,9 +146,9 @@ public class SysConfig {
|
||||
view.add(economy);
|
||||
Line price = Line.create()
|
||||
.append(Component.text(" 每方块单价"))
|
||||
.append(NumChanger.create(Dominion.config.getEconomyPrice(), "/dominion set_config economy_price", 0.1).setPageNumber(page).build());
|
||||
.append(NumChanger.create(Dominion.config.getEconomyPrice(null), "/dominion set_config economy_price", 0.1).setPageNumber(page).build());
|
||||
view.add(price);
|
||||
if (Dominion.config.getEconomyOnlyXZ()) {
|
||||
if (Dominion.config.getEconomyOnlyXZ(null)) {
|
||||
view.add(Line.create()
|
||||
.append(" 仅计价平面积")
|
||||
.append(Button.createGreen("☑").setExecuteCommand("/dominion set_config economy_only_xz false " + page).build()));
|
||||
@ -159,7 +159,7 @@ public class SysConfig {
|
||||
}
|
||||
Line refund = Line.create()
|
||||
.append(Component.text(" 删除/缩小领地退还比例"))
|
||||
.append(NumChanger.create(Dominion.config.getEconomyRefund(), "/dominion set_config economy_refund", 0.01).setPageNumber(page).build());
|
||||
.append(NumChanger.create(Dominion.config.getEconomyRefund(null), "/dominion set_config economy_refund", 0.01).setPageNumber(page).build());
|
||||
view.add(refund);
|
||||
}
|
||||
if (Dominion.config.getResidenceMigration()) {
|
||||
|
@ -31,9 +31,9 @@ public class CommandUtils {
|
||||
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() - 1);
|
||||
if (Dominion.config.getLimitVert(player)) {
|
||||
location1.setY(Dominion.config.getLimitMinY(player));
|
||||
location2.setY(Dominion.config.getLimitMaxY(player) - 1);
|
||||
}
|
||||
Map<Integer, Location> points = new HashMap<>();
|
||||
points.put(0, location1);
|
||||
|
@ -43,16 +43,16 @@ public class SelectPointEvents implements Listener {
|
||||
event.setCancelled(true);
|
||||
Notification.info(player, "已选择第一个点: %d %d %d", block.getX(), block.getY(), block.getZ());
|
||||
Location loc = block.getLocation();
|
||||
if (Dominion.config.getLimitVert()) {
|
||||
loc.setY(Dominion.config.getLimitMinY());
|
||||
if (Dominion.config.getLimitVert(player)) {
|
||||
loc.setY(Dominion.config.getLimitMinY(player));
|
||||
}
|
||||
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());
|
||||
Location loc = block.getLocation();
|
||||
if (Dominion.config.getLimitVert()) {
|
||||
loc.setY(Dominion.config.getLimitMaxY() - 1);
|
||||
if (Dominion.config.getLimitVert(player)) {
|
||||
loc.setY(Dominion.config.getLimitMaxY(player) - 1);
|
||||
}
|
||||
points.put(1, loc);
|
||||
} else {
|
||||
@ -86,12 +86,12 @@ public class SelectPointEvents implements Listener {
|
||||
return;
|
||||
}
|
||||
int count;
|
||||
if (Dominion.config.getEconomyOnlyXZ()) {
|
||||
if (Dominion.config.getEconomyOnlyXZ(player)) {
|
||||
count = dominion.getSquare();
|
||||
} else {
|
||||
count = dominion.getVolume();
|
||||
}
|
||||
float price = count * Dominion.config.getEconomyPrice();
|
||||
float price = count * Dominion.config.getEconomyPrice(player);
|
||||
Notification.info(player, "预计领地创建价格为 %.2f %s", price, VaultConnect.instance.currencyNamePlural());
|
||||
}
|
||||
Particle.showBorder(player, dominion);
|
||||
|
@ -43,16 +43,16 @@ public class SelectPointEvents implements Listener {
|
||||
event.setCancelled(true);
|
||||
Notification.info(player, "已选择第一个点: %d %d %d", block.getX(), block.getY(), block.getZ());
|
||||
Location loc = block.getLocation();
|
||||
if (Dominion.config.getLimitVert()) {
|
||||
loc.setY(Dominion.config.getLimitMinY());
|
||||
if (Dominion.config.getLimitVert(player)) {
|
||||
loc.setY(Dominion.config.getLimitMinY(player));
|
||||
}
|
||||
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());
|
||||
Location loc = block.getLocation();
|
||||
if (Dominion.config.getLimitVert()) {
|
||||
loc.setY(Dominion.config.getLimitMaxY() - 1);
|
||||
if (Dominion.config.getLimitVert(player)) {
|
||||
loc.setY(Dominion.config.getLimitMaxY(player) - 1);
|
||||
}
|
||||
points.put(1, loc);
|
||||
} else {
|
||||
@ -86,12 +86,12 @@ public class SelectPointEvents implements Listener {
|
||||
return;
|
||||
}
|
||||
int count;
|
||||
if (Dominion.config.getEconomyOnlyXZ()) {
|
||||
if (Dominion.config.getEconomyOnlyXZ(player)) {
|
||||
count = dominion.getSquare();
|
||||
} else {
|
||||
count = dominion.getVolume();
|
||||
}
|
||||
float price = count * Dominion.config.getEconomyPrice();
|
||||
float price = count * Dominion.config.getEconomyPrice(player);
|
||||
Notification.info(player, "预计领地创建价格为 %.2f %s", price, VaultConnect.instance.currencyNamePlural());
|
||||
}
|
||||
Particle.showBorder(player, dominion);
|
||||
|
Reference in New Issue
Block a user