修复了重复点击事件的bug~

This commit is contained in:
2026-02-17 13:50:42 +08:00
parent 3b9ffb8a95
commit 81be418af6
4 changed files with 17 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ public class PluginMain extends JavaPlugin implements Listener {
/**
* 调试模式
*/
public static final boolean DEBUG = true;
public static final boolean DEBUG = false;
/**
* 日志类 - 仅在初始化后调用
*/

View File

@@ -27,13 +27,22 @@ public class EventListener implements Listener {
return;
}
Player player = event.getPlayer();
if (player.getInventory().getItemInMainHand().getType() != Material.GLOWSTONE_DUST) {
if (event.getItem() == null ) {
return;
}
if (event.getItem().getType() != Material.GLOWSTONE_DUST) {
return;
}
if (event.getClickedBlock() != null && event.getClickedBlock().getType() != Material.REDSTONE_WIRE) {
return;
}
// PluginMain.LOGGER.info(event.getEventName()
// + " " + event.getInteractionPoint()
// + " " + event.getItem()
// + " " + event.getClickedBlock()
// + " " + event.getAction());
Location location = event.getClickedBlock().getLocation();
String structid = PluginMain.structureManager.match(location);
if (structid == null) {