File tree Expand file tree Collapse file tree
src/main/java/ict/minesunshineone/landmark/listener Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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>
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments