新增音符盒权限控制

This commit is contained in:
zhangyuheng 2024-07-23 21:57:38 +08:00
parent e3cd0a04a8
commit c2caf96c03
5 changed files with 21 additions and 5 deletions

View File

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

View File

@ -4,10 +4,8 @@ import cn.lunadeer.dominion.dtos.DominionDTO;
import cn.lunadeer.dominion.dtos.Flag;
import cn.lunadeer.dominion.dtos.GroupDTO;
import cn.lunadeer.dominion.dtos.MemberDTO;
import cn.lunadeer.dominion.utils.Particle;
import cn.lunadeer.dominion.dtos.*;
import cn.lunadeer.dominion.utils.BlueMapConnect;
import cn.lunadeer.dominion.utils.MapRender;
import cn.lunadeer.dominion.utils.Particle;
import cn.lunadeer.dominion.utils.ResMigration;
import cn.lunadeer.minecraftpluginutils.Notification;
import cn.lunadeer.minecraftpluginutils.Scheduler;

View File

@ -1,6 +1,5 @@
package cn.lunadeer.dominion.commands;
import cn.lunadeer.dominion.utils.BlueMapConnect;
import cn.lunadeer.dominion.Cache;
import cn.lunadeer.dominion.Dominion;
import cn.lunadeer.dominion.dtos.DominionDTO;

View File

@ -51,6 +51,7 @@ public enum Flag {
MONSTER_KILLING("monster_killing", "对怪物造成伤害", "玩家是否可以对怪物造成伤害", false, false, true),
MONSTER_SPAWN("monster_spawn", "怪物生成", "是否可以生成怪物", false, true, false),
MOVE("move", "移动", "是否可以移动", true, false, true),
NOTE_BLOCK("note_block", "点击音符盒", "红石音乐或者某些红石机器会用到...", false, false, true),
PLACE("place", "放置方块", "是否可以放置方块(包括:一般方块、展示框、岩浆、水)", false, false, true),
PRESSURE("pressure", "压力板交互", "是否可以触发各种材质的压力板", false, false, true),
RIDING("riding", "骑乘载具", "是否可以骑乘各种载具", false, false, true),

View File

@ -566,6 +566,24 @@ public class PlayerEvents implements Listener {
}
}
@EventHandler(priority = EventPriority.HIGHEST) // note_block
public void onNoteBlockClicked(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
return;
}
Block block = event.getClickedBlock();
if (block == null) {
return;
}
Material clicked = block.getType();
if (clicked != Material.NOTE_BLOCK) {
return;
}
Player player = event.getPlayer();
DominionDTO dom = Cache.instance.getDominionByLoc(block.getLocation());
checkFlag(dom, Flag.NOTE_BLOCK, player, event);
}
@EventHandler(priority = EventPriority.HIGHEST) // place
public void onPlaceBlock(BlockPlaceEvent event) {
Player player = event.getPlayer();