Skip to content

Commit 12f6e58

Browse files
修复一下检测
不知道为什么右键点击事件没用
1 parent 405136d commit 12f6e58

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>ict.minesunshineone</groupId>
88
<artifactId>LandmarkSystem</artifactId>
9-
<version>1.6</version>
9+
<version>1.7</version>
1010

1111
<properties>
1212
<java.version>21</java.version>

src/main/java/ict/minesunshineone/landmark/listener/PlayerListener.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -279,22 +279,28 @@ public void cleanup() {
279279
lastCheckTimes.clear();
280280
}
281281

282-
@EventHandler
282+
@EventHandler(priority = EventPriority.LOWEST)
283283
public void onPlayerInteract(PlayerInteractEvent event) {
284-
// 只监听右键空气
285-
if (event.getAction() != Action.RIGHT_CLICK_AIR) {
286-
return;
287-
}
288-
284+
Action action = event.getAction();
289285
Player player = event.getPlayer();
290286

291-
// 检查玩家是否在任意锚点范围内
292-
for (Landmark landmark : plugin.getLandmarkManager().getLandmarks().values()) {
293-
if (plugin.getLandmarkManager().isPlayerNearLandmark(player, landmark.getLocation())) {
294-
// 在锚点范围内,打开菜单
295-
new LandmarkMenu(plugin, player).open();
287+
// 检查是否是左键动作,并且点击的是空气(不要问为什么不右键,因为右键的事件好像有问题)
288+
if (action == Action.LEFT_CLICK_AIR) {
289+
// 检查权限
290+
if (!player.hasPermission("landmark.menu")) {
296291
return;
297292
}
293+
294+
// 检查玩家是否在任意锚点范围内
295+
for (Landmark landmark : plugin.getLandmarkManager().getLandmarks().values()) {
296+
if (plugin.getLandmarkManager().isPlayerNearLandmark(player, landmark.getLocation())) {
297+
// 在锚点范围内,打开菜单
298+
plugin.getServer().getRegionScheduler().execute(plugin, player.getLocation(), () -> {
299+
new LandmarkMenu(plugin, player).open();
300+
});
301+
return;
302+
}
303+
}
298304
}
299305
}
300306

0 commit comments

Comments
 (0)