Changed event type for left click in adventure
This commit is contained in:
parent
32e1fa96e8
commit
64bf28b85d
2 changed files with 11 additions and 5 deletions
|
@ -15,17 +15,21 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class PlayerInteractListener implements Listener {
|
public class PlayerInteractListener implements Listener {
|
||||||
//BUTTON CLICK
|
//BUTTON CLICK
|
||||||
|
@ -67,8 +71,10 @@ public class PlayerInteractListener implements Listener {
|
||||||
|
|
||||||
//Gamemode adventure left click fix
|
//Gamemode adventure left click fix
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerLeftClickSign(PlayerAnimationEvent e) {
|
public void onPlayerLeftClickSign(EntityDamageByEntityEvent e) {
|
||||||
Player p = e.getPlayer();
|
Entity ent = e.getDamager();
|
||||||
|
if (!(ent instanceof Player)) return;
|
||||||
|
Player p = (Player) e.getDamager();
|
||||||
|
|
||||||
if (p.getGameMode() != GameMode.ADVENTURE) return;
|
if (p.getGameMode() != GameMode.ADVENTURE) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue