Call event in scheduler as listener is async
This commit is contained in:
parent
a704f5e51c
commit
e6752903b4
@ -21,6 +21,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class PacketListenerClientInteract extends PacketAdapter {
|
public class PacketListenerClientInteract extends PacketAdapter {
|
||||||
public PacketListenerClientInteract(LibsDisguises plugin) {
|
public PacketListenerClientInteract(LibsDisguises plugin) {
|
||||||
@ -69,8 +70,13 @@ public class PacketListenerClientInteract extends PacketAdapter {
|
|||||||
DisguiseInteractEvent selfEvent = new DisguiseInteractEvent((TargetedDisguise) disguise, handUsed,
|
DisguiseInteractEvent selfEvent = new DisguiseInteractEvent((TargetedDisguise) disguise, handUsed,
|
||||||
interactType == EnumWrappers.EntityUseAction.ATTACK);
|
interactType == EnumWrappers.EntityUseAction.ATTACK);
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Bukkit.getPluginManager().callEvent(selfEvent);
|
Bukkit.getPluginManager().callEvent(selfEvent);
|
||||||
}
|
}
|
||||||
|
}.runTask(LibsDisguises.getInstance());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(),
|
for (ItemStack item : new ItemStack[]{observer.getInventory().getItemInMainHand(),
|
||||||
|
Loading…
Reference in New Issue
Block a user