新增告示牌编辑权限
All checks were successful
Java CI-CD with Maven / build (push) Successful in 8m12s

This commit is contained in:
zhangyuheng 2024-06-12 16:07:09 +08:00
parent 7d28622904
commit dc50603a91
3 changed files with 12 additions and 3 deletions

View File

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

View File

@ -26,9 +26,10 @@ public enum Flag {
CONTAINER("container", "一般容器", "包含:箱子/木桶/潜影盒/盔甲架/展示框", false, false, true),
CRAFT("craft", "使用工作台", "是否可以使用工作台", false, false, true),
CREEPER_EXPLODE("creeper_explode", "实体爆炸", "包含:苦力怕/凋零头颅/水晶爆炸", false, true, true),
COMPARER("comparer", "比较器交互", "是否可以与比较器交互", false, false, true),
COMPARER("comparer", "比较器交互", "是否可以修改比较器状态", false, false, true),
DOOR("door", "门交互", "是否可以使用各种材质的门(包括活板门)", false, false, true),
DYE("dye", "染色", "是否可以使用染料(对羊、狗项圈、猫项圈)染色", false, false, true),
EDIT_SIGN("edit_sign", "编辑告示牌", "是否可以编辑告示牌", false, false, true),
EGG("egg", "扔鸡蛋", "是否可以扔鸡蛋", false, false, true),
ENCHANT("enchant", "使用附魔台", "是否可以使用附魔台", false, false, true),
ENDER_MAN("ender_man", "末影人行为", "包含:末影人是否可以生成、瞬移", false, true, true),
@ -41,7 +42,7 @@ public enum Flag {
HARVEST("harvest", "收获", "收获庄稼、作物", false, false, true),
HONEY("honey", "蜂巢交互", "是否可以采蜂蜜", false, false, true),
HOOK("hook", "使用钓钩", "是否可以使用钓钩", false, false, true),
HOPPER("hopper", "特殊容器", "包含:漏斗/熔炉/发射器", false, false, true),
HOPPER("hopper", "特殊容器", "包含:漏斗/熔炉/发射器/投掷器/高炉/烟熏炉", false, false, true),
IGNITE("ignite", "点燃", "是否可以使用打火石点火", false, false, true),
LEVER("lever", "使用拉杆", "是否可以使用拉杆", false, false, true),
MOB_DROP_ITEM("mob_drop_item", "生物战利品掉落", "生物死亡时是否产生凋落物", true, true, true),

View File

@ -16,6 +16,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityPlaceEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
@ -349,6 +350,13 @@ public class PlayerEvents implements Listener {
checkFlag(dom, Flag.DYE, player, event);
}
@EventHandler(priority = EventPriority.HIGHEST) // edit sign
public void onSignEdit(SignChangeEvent event) {
Player player = event.getPlayer();
DominionDTO dom = Cache.instance.getDominion(event.getBlock().getLocation());
checkFlag(dom, Flag.EDIT_SIGN, player, event);
}
@EventHandler(priority = EventPriority.HIGHEST) // egg
public void onThrowingEgg(ProjectileLaunchEvent event) {
if (!(event.getEntity().getShooter() instanceof Player)) {