From 07187d6e8a50f4a8ec8b43b13f817eff8277c75a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 16:58:11 +0100 Subject: [PATCH] Fix ParticleListener rename of Villager npcs --- src/de/steamwar/lobby/listener/ParticleListener.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/lobby/listener/ParticleListener.java b/src/de/steamwar/lobby/listener/ParticleListener.java index c504f74..984c3e9 100644 --- a/src/de/steamwar/lobby/listener/ParticleListener.java +++ b/src/de/steamwar/lobby/listener/ParticleListener.java @@ -22,13 +22,14 @@ package de.steamwar.lobby.listener; import de.steamwar.lobby.LobbySystem; import de.steamwar.lobby.particle.BaseParticle; import de.steamwar.lobby.particle.ParticleData; -import de.steamwar.lobby.particle.particles.ParticleEnum; import de.steamwar.lobby.particle.ParticleInventory; +import de.steamwar.lobby.particle.particles.ParticleEnum; import de.steamwar.lobby.util.LobbyPlayer; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerMoveEvent; @@ -56,6 +57,7 @@ public class ParticleListener extends BasicListener { public void handlePlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); if (!PlayerSpawn.PARTICLE.equals(event.getItem())) return; + event.setCancelled(true); ParticleInventory.openParticleInventory(player); } @@ -71,4 +73,11 @@ public class ParticleListener extends BasicListener { if (baseParticle.needsTick()) return; baseParticle.particle(new ParticleData(player.getWorld(), player, deg)); } + + @EventHandler + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { + if (PlayerSpawn.PARTICLE.equals(event.getPlayer().getInventory().getItemInMainHand())) { + event.setCancelled(true); + } + } }