Skip to content

Commit

Permalink
新增音符盒权限控制
Browse files Browse the repository at this point in the history
  • Loading branch information
ColdeZhang committed Jul 23, 2024
1 parent e3cd0a0 commit c2caf96
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/cn/lunadeer/dominion/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
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;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/cn/lunadeer/dominion/commands/Operator.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cn/lunadeer/dominion/dtos/Flag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/cn/lunadeer/dominion/events/PlayerEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,24 @@ public void onPlayerMove(PlayerMoveEvent event) {
}
}

@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();
Expand Down

0 comments on commit c2caf96

Please sign in to comment.