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>
|
<groupId>cn.lunadeer</groupId>
|
||||||
<artifactId>Dominion</artifactId>
|
<artifactId>Dominion</artifactId>
|
||||||
<version>1.35.10-dynmap-beta</version>
|
<version>1.36.1-dynmap-beta</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Dominion</name>
|
<name>Dominion</name>
|
||||||
|
@ -253,7 +253,7 @@ public class Cache {
|
|||||||
player_current_dominion_id.put(player.getUniqueId(), current_dominion.getId());
|
player_current_dominion_id.put(player.getUniqueId(), current_dominion.getId());
|
||||||
// show border
|
// show border
|
||||||
if (current_dominion.getFlagValue(Flag.SHOW_BORDER)) {
|
if (current_dominion.getFlagValue(Flag.SHOW_BORDER)) {
|
||||||
ParticleRender.showBoxFace(Dominion.instance, player,
|
ParticleRender.showBoxFace(player,
|
||||||
current_dominion.getLocation1(),
|
current_dominion.getLocation1(),
|
||||||
current_dominion.getLocation2());
|
current_dominion.getLocation2());
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,14 @@ public class DominionController {
|
|||||||
operator.setResponse(FAIL.addMessage("你的领地数量已达上限(%d个)", Dominion.config.getLimitAmount()));
|
operator.setResponse(FAIL.addMessage("你的领地数量已达上限(%d个)", Dominion.config.getLimitAmount()));
|
||||||
return;
|
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,
|
if (sizeNotValid(operator, minX, minY, minZ, maxX, maxY, maxZ)) {
|
||||||
loc1.getBlockX(), loc1.getBlockY(), loc1.getBlockZ(),
|
|
||||||
loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DominionDTO parent_dominion;
|
DominionDTO parent_dominion;
|
||||||
@ -134,9 +138,7 @@ public class DominionController {
|
|||||||
}
|
}
|
||||||
// 创建 dominion (此步骤不会写入数据)
|
// 创建 dominion (此步骤不会写入数据)
|
||||||
DominionDTO dominion = DominionDTO.create(operator.getUniqueId(), name, loc1.getWorld().getName(),
|
DominionDTO dominion = DominionDTO.create(operator.getUniqueId(), name, loc1.getWorld().getName(),
|
||||||
(int) Math.min(loc1.getX(), loc2.getX()), (int) Math.min(loc1.getY(), loc2.getY()),
|
minX, minY, minZ, maxX, maxY, maxZ, parent_dominion);
|
||||||
(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);
|
|
||||||
// 如果parent_dominion不为-1 检查是否在同一世界
|
// 如果parent_dominion不为-1 检查是否在同一世界
|
||||||
if (parent_dominion.getId() != -1 && !parent_dominion.getWorld().equals(dominion.getWorld())) {
|
if (parent_dominion.getId() != -1 && !parent_dominion.getWorld().equals(dominion.getWorld())) {
|
||||||
operator.setResponse(FAIL.addMessage("父领地与子领地不在同一世界。"));
|
operator.setResponse(FAIL.addMessage("父领地与子领地不在同一世界。"));
|
||||||
@ -169,7 +171,7 @@ public class DominionController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 显示粒子效果
|
// 显示粒子效果
|
||||||
handleParticle(operator, dominion.getWorld(), dominion.getX1(), dominion.getY1(), dominion.getZ1(), dominion.getX2(), dominion.getY2(), dominion.getZ2(), FAIL);
|
handleParticle(operator, dominion);
|
||||||
operator.setResponse(SUCCESS);
|
operator.setResponse(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,8 +234,8 @@ public class DominionController {
|
|||||||
handleEconomy(operator, Dominion.config.getEconomyOnlyXZ() ? sqr(newCords) - dominion.getSquare() : vol(newCords) - dominion.getVolume()
|
handleEconomy(operator, Dominion.config.getEconomyOnlyXZ() ? sqr(newCords) - dominion.getSquare() : vol(newCords) - dominion.getVolume()
|
||||||
, true, FAIL, SUCCESS);
|
, true, FAIL, SUCCESS);
|
||||||
// 显示粒子效果
|
// 显示粒子效果
|
||||||
handleParticle(operator, dominion.getWorld(), newCords, FAIL);
|
dominion = dominion.setXYZ(newCords);
|
||||||
dominion.setXYZ(newCords);
|
handleParticle(operator, dominion);
|
||||||
operator.setResponse(SUCCESS);
|
operator.setResponse(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,8 +286,8 @@ public class DominionController {
|
|||||||
handleEconomy(operator, Dominion.config.getEconomyOnlyXZ() ? dominion.getSquare() - sqr(newCords) : dominion.getVolume() - vol(newCords)
|
handleEconomy(operator, Dominion.config.getEconomyOnlyXZ() ? dominion.getSquare() - sqr(newCords) : dominion.getVolume() - vol(newCords)
|
||||||
, false, FAIL, SUCCESS);
|
, false, FAIL, SUCCESS);
|
||||||
// 显示粒子效果
|
// 显示粒子效果
|
||||||
handleParticle(operator, dominion.getWorld(), newCords, FAIL);
|
dominion = dominion.setXYZ(newCords);
|
||||||
dominion.setXYZ(newCords);
|
handleParticle(operator, dominion);
|
||||||
operator.setResponse(SUCCESS);
|
operator.setResponse(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,9 +579,7 @@ public class DominionController {
|
|||||||
* 判断两个领地是否相交
|
* 判断两个领地是否相交
|
||||||
*/
|
*/
|
||||||
private static boolean isIntersect(DominionDTO a, DominionDTO b) {
|
private static boolean isIntersect(DominionDTO a, DominionDTO b) {
|
||||||
return a.getX1() < b.getX2() && a.getX2() > b.getX1() &&
|
return isIntersect(a, b.getX1(), b.getY1(), b.getZ1(), b.getX2(), b.getY2(), b.getZ2());
|
||||||
a.getY1() < b.getY2() && a.getY2() > b.getY1() &&
|
|
||||||
a.getZ1() < b.getZ2() && a.getZ2() > b.getZ1();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isIntersect(DominionDTO a, Integer x1, Integer y1, Integer z1, Integer x2, Integer y2, Integer z2) {
|
private static boolean isIntersect(DominionDTO a, Integer x1, Integer y1, Integer z1, Integer x2, Integer y2, Integer z2) {
|
||||||
@ -782,30 +782,14 @@ public class DominionController {
|
|||||||
* 显示粒子效果
|
* 显示粒子效果
|
||||||
*
|
*
|
||||||
* @param operator 操作者
|
* @param operator 操作者
|
||||||
* @param worldName 世界名称
|
* @param dominion 领地
|
||||||
* @param x1 x1
|
|
||||||
* @param y1 y1
|
|
||||||
* @param z1 z1
|
|
||||||
* @param x2 x2
|
|
||||||
* @param y2 y2
|
|
||||||
* @param z2 z2
|
|
||||||
* @param FAIL 失败消息
|
|
||||||
*/
|
*/
|
||||||
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) {
|
if (operator instanceof BukkitPlayerOperator) {
|
||||||
World world = Dominion.instance.getServer().getWorld(worldName);
|
ParticleRender.showBoxFace(operator.getPlayer(),
|
||||||
if (world == null) {
|
dominion.getLocation1(),
|
||||||
operator.setResponse(FAIL.addMessage("世界 %s 不存在", worldName));
|
dominion.getLocation2());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
ParticleRender.showBoxFace(Dominion.instance, operator.getPlayer(),
|
|
||||||
new Location(world, x1, y1, z1),
|
|
||||||
new Location(world, x2, y2, z2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
private static @Nullable DominionDTO expandContractPreCheck(AbstractOperator operator, @Nullable DominionDTO dominion, AbstractOperator.Result FAIL) {
|
||||||
|
@ -311,23 +311,23 @@ public class DominionDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Integer getSquare() {
|
public Integer getSquare() {
|
||||||
return (getX2() - getX1() + 1) * (getZ2() - getZ1() + 1);
|
return getWidthX() * getWidthZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getVolume() {
|
public Integer getVolume() {
|
||||||
return getSquare() * (getY2() - getY1() + 1);
|
return getSquare() * getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getWidthX() {
|
public Integer getWidthX() {
|
||||||
return getX2() - getX1() + 1;
|
return getX2() - getX1();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getHeight() {
|
public Integer getHeight() {
|
||||||
return getY2() - getY1() + 1;
|
return getY2() - getY1();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getWidthZ() {
|
public Integer getWidthZ() {
|
||||||
return getZ2() - getZ1() + 1;
|
return getZ2() - getZ1();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getParentDomId() {
|
public Integer getParentDomId() {
|
||||||
|
@ -25,9 +25,10 @@ public enum Flag {
|
|||||||
CAKE("cake", "吃蛋糕", "是否可以吃蛋糕", false, false, true),
|
CAKE("cake", "吃蛋糕", "是否可以吃蛋糕", false, false, true),
|
||||||
CONTAINER("container", "一般容器", "包含:箱子/木桶/潜影盒/盔甲架/展示框", false, false, true),
|
CONTAINER("container", "一般容器", "包含:箱子/木桶/潜影盒/盔甲架/展示框", false, false, true),
|
||||||
CRAFT("craft", "使用工作台", "是否可以使用工作台", 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),
|
COMPARER("comparer", "比较器交互", "是否可以修改比较器状态", false, false, true),
|
||||||
DOOR("door", "门交互", "是否可以使用各种材质的门(包括活板门)", false, false, true),
|
DOOR("door", "门交互", "是否可以使用各种材质的门(包括活板门)", false, false, true),
|
||||||
|
DRAGON_BREAK_BLOCK("dragon_break_block", "末影龙破坏方块", "末影龙冲撞是否可以破坏方块", false, true, true),
|
||||||
DRAGON_EGG("dragon_egg", "触碰龙蛋", "是否可以触碰龙蛋", false, false, true),
|
DRAGON_EGG("dragon_egg", "触碰龙蛋", "是否可以触碰龙蛋", false, false, true),
|
||||||
DYE("dye", "染色", "是否可以使用染料(对羊、狗项圈、猫项圈)染色", false, false, true),
|
DYE("dye", "染色", "是否可以使用染料(对羊、狗项圈、猫项圈)染色", false, false, true),
|
||||||
EDIT_SIGN("edit_sign", "编辑告示牌", "是否可以编辑告示牌", 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);
|
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
|
@EventHandler(priority = EventPriority.HIGHEST) // fire_spread
|
||||||
public void onFireSpread(BlockIgniteEvent event) {
|
public void onFireSpread(BlockIgniteEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.lunadeer.dominion.events;
|
package cn.lunadeer.dominion.events;
|
||||||
|
|
||||||
|
import cn.lunadeer.dominion.Cache;
|
||||||
import cn.lunadeer.dominion.Dominion;
|
import cn.lunadeer.dominion.Dominion;
|
||||||
import cn.lunadeer.dominion.dtos.DominionDTO;
|
import cn.lunadeer.dominion.dtos.DominionDTO;
|
||||||
import cn.lunadeer.minecraftpluginutils.Notification;
|
import cn.lunadeer.minecraftpluginutils.Notification;
|
||||||
@ -42,14 +43,23 @@ public class SelectPointEvents implements Listener {
|
|||||||
if (action == Action.LEFT_CLICK_BLOCK) {
|
if (action == Action.LEFT_CLICK_BLOCK) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Notification.info(player, "已选择第一个点: %d %d %d", block.getX(), block.getY(), block.getZ());
|
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) {
|
} else if (action == Action.RIGHT_CLICK_BLOCK) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Notification.info(player, "已选择第二个点: %d %d %d", block.getX(), block.getY(), block.getZ());
|
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 {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Dominion.pointsSelect.put(player.getUniqueId(), points);
|
||||||
|
|
||||||
if (points.size() == 2) {
|
if (points.size() == 2) {
|
||||||
World world = points.get(0).getWorld();
|
World world = points.get(0).getWorld();
|
||||||
@ -57,7 +67,7 @@ public class SelectPointEvents implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!points.get(0).getWorld().equals(points.get(1).getWorld())) {
|
if (!points.get(0).getWorld().equals(points.get(1).getWorld())) {
|
||||||
Notification.error(player, "两个点不在同一个世界");
|
Notification.warn(player, "两个点不在同一个世界");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Notification.info(player, "已选择两个点,可以使用 /dominion create <领地名称> 创建领地");
|
Notification.info(player, "已选择两个点,可以使用 /dominion create <领地名称> 创建领地");
|
||||||
@ -66,13 +76,9 @@ public class SelectPointEvents implements Listener {
|
|||||||
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
||||||
int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
|
int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
|
||||||
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
|
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
|
||||||
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX());
|
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX()) + 1;
|
||||||
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY());
|
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY()) + 1;
|
||||||
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
|
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ()) + 1;
|
||||||
if (Dominion.config.getLimitVert()) {
|
|
||||||
minY = Dominion.config.getLimitMinY();
|
|
||||||
maxY = Dominion.config.getLimitMaxY();
|
|
||||||
}
|
|
||||||
DominionDTO dominion = new DominionDTO(player.getUniqueId(), "", loc1.getWorld().getName(),
|
DominionDTO dominion = new DominionDTO(player.getUniqueId(), "", loc1.getWorld().getName(),
|
||||||
minX, minY, minZ, maxX, maxY, maxZ);
|
minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
if (Dominion.config.getEconomyEnable()) {
|
if (Dominion.config.getEconomyEnable()) {
|
||||||
@ -89,12 +95,11 @@ public class SelectPointEvents implements Listener {
|
|||||||
float price = count * Dominion.config.getEconomyPrice();
|
float price = count * Dominion.config.getEconomyPrice();
|
||||||
Notification.info(player, "预计领地创建价格为 %.2f %s", price, VaultConnect.instance.currencyNamePlural());
|
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 x %d x %d", dominion.getWidthX(), dominion.getHeight(), dominion.getWidthZ());
|
||||||
Notification.info(player, "面积: %d", dominion.getSquare());
|
Notification.info(player, "面积: %d", dominion.getSquare());
|
||||||
Notification.info(player, "高度: %d", dominion.getHeight());
|
Notification.info(player, "高度: %d", dominion.getHeight());
|
||||||
Notification.info(player, "体积: %d", dominion.getVolume());
|
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(Button.create("所有领地").setExecuteCommand("/dominion all_dominion").build())
|
||||||
.append("查看所有领地");
|
.append("查看所有领地");
|
||||||
Line config = Line.create()
|
Line config = Line.create()
|
||||||
.append(Button.create("系统配置").setExecuteCommand("/dominion config").build())
|
.append(Button.create("系统配置").setExecuteCommand("/dominion sys_config").build())
|
||||||
.append("查看/修改系统配置");
|
.append("查看/修改系统配置");
|
||||||
Line reload_cache = Line.create()
|
Line reload_cache = Line.create()
|
||||||
.append(Button.create("重载缓存").setExecuteCommand("/dominion reload_cache").build())
|
.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 manage " + dominion.getName()).build())
|
||||||
.append(Button.create("访客权限").setExecuteCommand("/dominion guest_setting " + dominion.getName()).build()))
|
.append(Button.create("访客权限").setExecuteCommand("/dominion guest_setting " + dominion.getName()).build()))
|
||||||
.showOn(player);
|
.showOn(player);
|
||||||
ParticleRender.showBoxFace(Dominion.instance, player,
|
ParticleRender.showBoxFace(player,
|
||||||
dominion.getLocation1(),
|
dominion.getLocation1(),
|
||||||
dominion.getLocation2());
|
dominion.getLocation2());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user