Skip to content

Commit

Permalink
misc: 尽可能早地捕获事件
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Nov 13, 2023
1 parent bf5cbfa commit 93ee5ac
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
Expand Down Expand Up @@ -203,7 +204,7 @@ public void onPlayerHurtEntity(EntityDamageByEntityEvent e)
private PlayerTracker tracker;

/**
* todo: SwingEvent应当只相应方块破坏
* todo: SwingEvent应当只响应方块破坏
*/
@EventHandler
public void onPlayerSwing(PlayerArmSwingEvent e)
Expand Down Expand Up @@ -264,7 +265,7 @@ public void onPlayerSwing(PlayerArmSwingEvent e)
logOperation(player, targetPlayer, lastAction.isLeftClick() ? OperationType.LeftClick : OperationType.RightClick);
}

@EventHandler
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerInteract(PlayerInteractEvent e)
{
var player = e.getPlayer();
Expand All @@ -288,7 +289,7 @@ public void onPlayerInteract(PlayerInteractEvent e)
logOperation(player, targetPlayer, e.getAction().isLeftClick() ? OperationType.LeftClick : OperationType.RightClick);
}

@EventHandler
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent e)
{
var player = e.getPlayer();
Expand Down

0 comments on commit 93ee5ac

Please sign in to comment.