changed how action delay works
This commit is contained in:
parent
12e2c2963d
commit
1e0739e73f
1 changed files with 5 additions and 12 deletions
|
@ -46,19 +46,12 @@ public class InteractionPacketListener implements PacketListener {
|
||||||
Bukkit.getPluginManager().callEvent(interactEvent);
|
Bukkit.getPluginManager().callEvent(interactEvent);
|
||||||
if (interactEvent.isCancelled()) return;
|
if (interactEvent.isCancelled()) return;
|
||||||
|
|
||||||
scheduler.runSyncGlobal(() -> {
|
|
||||||
for (InteractionAction action : npc.getActions()) {
|
for (InteractionAction action : npc.getActions()) {
|
||||||
if (action.getInteractionType() != InteractionType.ANY_CLICK && action.getInteractionType() != type) continue;
|
if (action.getInteractionType() != InteractionType.ANY_CLICK && action.getInteractionType() != type) continue;
|
||||||
if (action.getCooldown() > 0 && !user.actionCooldownCheck(action)) continue;
|
if (action.getCooldown() > 0 && !user.actionCooldownCheck(action)) continue;
|
||||||
action.run(user.getPlayer());
|
scheduler.runLaterAsync(() -> action.run(player), action.getDelay());
|
||||||
try {
|
|
||||||
Thread.sleep(action.getDelay());
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private InteractionType wrapClickType(WrapperPlayClientInteractEntity.InteractAction action) {
|
private InteractionType wrapClickType(WrapperPlayClientInteractEntity.InteractAction action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|
Loading…
Reference in a new issue