Call event in scheduler as listener is async

This commit is contained in:
libraryaddict 2018-11-16 16:10:32 +13:00
parent a704f5e51c
commit e6752903b4

View File

@ -21,6 +21,7 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.*;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
public class PacketListenerClientInteract extends PacketAdapter {
public PacketListenerClientInteract(LibsDisguises plugin) {
@ -69,8 +70,13 @@ public class PacketListenerClientInteract extends PacketAdapter {
DisguiseInteractEvent selfEvent = new DisguiseInteractEvent((TargetedDisguise) disguise, handUsed,
interactType == EnumWrappers.EntityUseAction.ATTACK);
new BukkitRunnable() {
@Override
public void run() {
Bukkit.getPluginManager().callEvent(selfEvent);
}
}.runTask(LibsDisguises.getInstance());
}
}
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(),