Merge branch 'master' into dynmap-impl
# Conflicts: # pom.xml
This commit is contained in:
commit
de2d8758d1
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>cn.lunadeer</groupId>
|
||||
<artifactId>Dominion</artifactId>
|
||||
<version>1.35.10-dynmap-beta</version>
|
||||
<version>1.36.1-dynmap-beta</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Dominion</name>
|
||||
|
@ -253,7 +253,7 @@ public class Cache {
|
||||
player_current_dominion_id.put(player.getUniqueId(), current_dominion.getId());
|
||||
// show border
|
||||
if (current_dominion.getFlagValue(Flag.SHOW_BORDER)) {
|
||||
ParticleRender.showBoxFace(Dominion.instance, player,
|
||||
ParticleRender.showBoxFace(player,
|
||||
current_dominion.getLocation1(),
|
||||
current_dominion.getLocation2());
|
||||
}
|
||||
|
@ -106,10 +106,14 @@ public class DominionController {
|
||||
operator.setResponse(FAIL.addMessage("你的领地数量已达上限(%d个)", Dominion.config.getLimitAmount()));
|
||||
return;
|
||||
}
|
||||
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
||||
int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
|
||||
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
|
||||
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX()) + 1;
|
||||
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY()) + 1;
|
||||
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ()) + 1;
|
||||
// 检查领地大小是否合法
|
||||
if (sizeNotValid(operator,
|
||||
loc1.getBlockX(), loc1.getBlockY(), loc1.getBlockZ(),
|
||||
loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ())) {
|
||||
if (sizeNotValid(operator, minX, minY, minZ, maxX, maxY, maxZ)) {
|
||||
return;
|
||||
}
|
||||
DominionDTO parent_dominion;
|
||||
@ -134,9 +138,7 @@ public class DominionController {
|
||||
}
|
||||
// 创建 dominion (此步骤不会写入数据)
|
||||
DominionDTO dominion = DominionDTO.create(operator.getUniqueId(), name, loc1.getWorld().getName(),
|
||||
(int) Math.min(loc1.getX(), loc2.getX()), (int) Math.min(loc1.getY(), loc2.getY()),
|
||||
(int) Math.min(loc1.getZ(), loc2.getZ()), (int) Math.max(loc1.getX(), loc2.getX()),
|
||||
(int) Math.max(loc1.getY(), loc2.getY()), (int) Math.max(loc1.getZ(), loc2.getZ()), parent_dominion);
|
||||
minX, minY, minZ, maxX, maxY, maxZ, parent_dominion);
|
||||
// 如果parent_dominion不为-1 检查是否在同一世界
|
||||
if (parent_dominion.getId() != -1 && !parent_dominion.getWorld().equals(dominion.getWorld())) {
|
||||
operator.setResponse(FAIL.addMessage("父领地与子领地不在同一世界。"));
|
||||
@ -169,7 +171,7 @@ public class DominionController {
|
||||
return;
|
||||
}
|
||||
// 显示粒子效果
|
||||
handleParticle(operator, dominion.getWorld(), dominion.getX1(), dominion.getY1(), dominion.getZ1(), dominion.getX2(), dominion.getY2(), dominion.getZ2(), FAIL);
|
||||
handleParticle(operator, dominion);
|
||||
operator.setResponse(SUCCESS);
|
||||
}
|
||||
|
||||
@ -232,8 +234,8 @@ public class DominionController {
|
||||
handleEconomy(operator, Dominion.config.getEconomyOnlyXZ() ? sqr(newCords) - dominion.getSquare() : vol(newCords) - dominion.getVolume()
|
||||
, true, FAIL, SUCCESS);
|
||||
// 显示粒子效果
|
||||
handleParticle(operator, dominion.getWorld(), newCords, FAIL);
|
||||
dominion.setXYZ(newCords);
|
||||
dominion = dominion.setXYZ(newCords);
|
||||
handleParticle(operator, dominion);
|
||||
operator.setResponse(SUCCESS);
|
||||
}
|
||||
|
||||
@ -284,8 +286,8 @@ public class DominionController {
|
||||
handleEconomy(operator, Dominion.config.getEconomyOnlyXZ() ? dominion.getSquare() - sqr(newCords) : dominion.getVolume() - vol(newCords)
|
||||
, false, FAIL, SUCCESS);
|
||||
// 显示粒子效果
|
||||
handleParticle(operator, dominion.getWorld(), newCords, FAIL);
|
||||
dominion.setXYZ(newCords);
|
||||
dominion = dominion.setXYZ(newCords);
|
||||
handleParticle(operator, dominion);
|
||||
operator.setResponse(SUCCESS);
|
||||
}
|
||||
|
||||
@ -577,9 +579,7 @@ public class DominionController {
|
||||
* 判断两个领地是否相交
|
||||
*/
|
||||
private static boolean isIntersect(DominionDTO a, DominionDTO b) {
|
||||
return a.getX1() < b.getX2() && a.getX2() > b.getX1() &&
|
||||
a.getY1() < b.getY2() && a.getY2() > b.getY1() &&
|
||||
a.getZ1() < b.getZ2() && a.getZ2() > b.getZ1();
|
||||
return isIntersect(a, b.getX1(), b.getY1(), b.getZ1(), b.getX2(), b.getY2(), b.getZ2());
|
||||
}
|
||||
|
||||
private static boolean isIntersect(DominionDTO a, Integer x1, Integer y1, Integer z1, Integer x2, Integer y2, Integer z2) {
|
||||
@ -781,33 +781,17 @@ public class DominionController {
|
||||
/**
|
||||
* 显示粒子效果
|
||||
*
|
||||
* @param operator 操作者
|
||||
* @param worldName 世界名称
|
||||
* @param x1 x1
|
||||
* @param y1 y1
|
||||
* @param z1 z1
|
||||
* @param x2 x2
|
||||
* @param y2 y2
|
||||
* @param z2 z2
|
||||
* @param FAIL 失败消息
|
||||
* @param operator 操作者
|
||||
* @param dominion 领地
|
||||
*/
|
||||
private static void handleParticle(AbstractOperator operator, String worldName, Integer x1, Integer y1, Integer z1, Integer x2, Integer y2, Integer z2, AbstractOperator.Result FAIL) {
|
||||
private static void handleParticle(AbstractOperator operator, DominionDTO dominion) {
|
||||
if (operator instanceof BukkitPlayerOperator) {
|
||||
World world = Dominion.instance.getServer().getWorld(worldName);
|
||||
if (world == null) {
|
||||
operator.setResponse(FAIL.addMessage("世界 %s 不存在", worldName));
|
||||
return;
|
||||
}
|
||||
ParticleRender.showBoxFace(Dominion.instance, operator.getPlayer(),
|
||||
new Location(world, x1, y1, z1),
|
||||
new Location(world, x2, y2, z2));
|
||||
ParticleRender.showBoxFace(operator.getPlayer(),
|
||||
dominion.getLocation1(),
|
||||
dominion.getLocation2());
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleParticle(AbstractOperator operator, String worldName, int[] cords, AbstractOperator.Result FAIL) {
|
||||
handleParticle(operator, worldName, cords[0], cords[1], cords[2], cords[3], cords[4], cords[5], FAIL);
|
||||
}
|
||||
|
||||
private static @Nullable DominionDTO expandContractPreCheck(AbstractOperator operator, @Nullable DominionDTO dominion, AbstractOperator.Result FAIL) {
|
||||
if (dominion == null) {
|
||||
return null;
|
||||
|
@ -311,23 +311,23 @@ public class DominionDTO {
|
||||
}
|
||||
|
||||
public Integer getSquare() {
|
||||
return (getX2() - getX1() + 1) * (getZ2() - getZ1() + 1);
|
||||
return getWidthX() * getWidthZ();
|
||||
}
|
||||
|
||||
public Integer getVolume() {
|
||||
return getSquare() * (getY2() - getY1() + 1);
|
||||
return getSquare() * getHeight();
|
||||
}
|
||||
|
||||
public Integer getWidthX() {
|
||||
return getX2() - getX1() + 1;
|
||||
return getX2() - getX1();
|
||||
}
|
||||
|
||||
public Integer getHeight() {
|
||||
return getY2() - getY1() + 1;
|
||||
return getY2() - getY1();
|
||||
}
|
||||
|
||||
public Integer getWidthZ() {
|
||||
return getZ2() - getZ1() + 1;
|
||||
return getZ2() - getZ1();
|
||||
}
|
||||
|
||||
public Integer getParentDomId() {
|
||||
|
@ -25,9 +25,10 @@ public enum Flag {
|
||||
CAKE("cake", "吃蛋糕", "是否可以吃蛋糕", false, false, true),
|
||||
CONTAINER("container", "一般容器", "包含:箱子/木桶/潜影盒/盔甲架/展示框", false, false, true),
|
||||
CRAFT("craft", "使用工作台", "是否可以使用工作台", false, false, true),
|
||||
CREEPER_EXPLODE("creeper_explode", "实体爆炸", "包含:苦力怕/凋零头颅/水晶爆炸", false, true, true),
|
||||
CREEPER_EXPLODE("creeper_explode", "实体爆炸", "包含:苦力怕/凋零头颅/末影水晶/火球", false, true, true),
|
||||
COMPARER("comparer", "比较器交互", "是否可以修改比较器状态", false, false, true),
|
||||
DOOR("door", "门交互", "是否可以使用各种材质的门(包括活板门)", false, false, true),
|
||||
DRAGON_BREAK_BLOCK("dragon_break_block", "末影龙破坏方块", "末影龙冲撞是否可以破坏方块", false, true, true),
|
||||
DRAGON_EGG("dragon_egg", "触碰龙蛋", "是否可以触碰龙蛋", false, false, true),
|
||||
DYE("dye", "染色", "是否可以使用染料(对羊、狗项圈、猫项圈)染色", false, false, true),
|
||||
EDIT_SIGN("edit_sign", "编辑告示牌", "是否可以编辑告示牌", false, false, true),
|
||||
|
@ -38,6 +38,16 @@ public class EnvironmentEvents implements Listener {
|
||||
checkFlag(dom, Flag.CREEPER_EXPLODE, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST) // dragon_break_block
|
||||
public void onDragonBreakBlock(EntityExplodeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity.getType() != EntityType.ENDER_DRAGON) {
|
||||
return;
|
||||
}
|
||||
DominionDTO dom = Cache.instance.getDominion(event.getLocation());
|
||||
checkFlag(dom, Flag.DRAGON_BREAK_BLOCK, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST) // fire_spread
|
||||
public void onFireSpread(BlockIgniteEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lunadeer.dominion.events;
|
||||
|
||||
import cn.lunadeer.dominion.Cache;
|
||||
import cn.lunadeer.dominion.Dominion;
|
||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||
@ -42,14 +43,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 +67,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 <领地名称> 创建领地");
|
||||
@ -66,13 +76,9 @@ public class SelectPointEvents implements Listener {
|
||||
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
||||
int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
|
||||
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
|
||||
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();
|
||||
}
|
||||
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX()) + 1;
|
||||
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY()) + 1;
|
||||
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ()) + 1;
|
||||
DominionDTO dominion = new DominionDTO(player.getUniqueId(), "", loc1.getWorld().getName(),
|
||||
minX, minY, minZ, maxX, maxY, maxZ);
|
||||
if (Dominion.config.getEconomyEnable()) {
|
||||
@ -89,12 +95,11 @@ public class SelectPointEvents implements Listener {
|
||||
float price = count * Dominion.config.getEconomyPrice();
|
||||
Notification.info(player, "预计领地创建价格为 %.2f %s", price, VaultConnect.instance.currencyNamePlural());
|
||||
}
|
||||
ParticleRender.showBoxFace(Dominion.instance, player, loc1, loc2);
|
||||
ParticleRender.showBoxFace(player, dominion.getLocation1(), dominion.getLocation2());
|
||||
Notification.info(player, "尺寸: %d x %d x %d", dominion.getWidthX(), dominion.getHeight(), dominion.getWidthZ());
|
||||
Notification.info(player, "面积: %d", dominion.getSquare());
|
||||
Notification.info(player, "高度: %d", dominion.getHeight());
|
||||
Notification.info(player, "体积: %d", dominion.getVolume());
|
||||
}
|
||||
Dominion.pointsSelect.put(player.getUniqueId(), points);
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
|
@ -49,7 +49,7 @@ public class SizeInfo {
|
||||
.append(Button.create("管理界面").setExecuteCommand("/dominion manage " + dominion.getName()).build())
|
||||
.append(Button.create("访客权限").setExecuteCommand("/dominion guest_setting " + dominion.getName()).build()))
|
||||
.showOn(player);
|
||||
ParticleRender.showBoxFace(Dominion.instance, player,
|
||||
ParticleRender.showBoxFace(player,
|
||||
dominion.getLocation1(),
|
||||
dominion.getLocation2());
|
||||
}
|
||||
|
Reference in New Issue
Block a user