Pushed missing file

This commit is contained in:
fullwall 2023-06-26 00:13:20 +08:00
parent 309b1d7b65
commit a06b2ed2c6
1 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,7 @@ import net.citizensnpcs.api.ai.speech.SpeechContext;
import net.citizensnpcs.api.ai.speech.Talkable;
import net.citizensnpcs.api.ai.speech.TalkableEntity;
import net.citizensnpcs.api.event.NPCCollisionEvent;
import net.citizensnpcs.api.event.NPCPistonPushEvent;
import net.citizensnpcs.api.event.NPCPushEvent;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.BoundingBox;
@ -59,6 +60,17 @@ public class Util {
}
}
public static boolean callPistonPushEvent(NPC npc) {
if (npc == null)
return false;
NPCPistonPushEvent event = new NPCPistonPushEvent(npc);
if (npc.isProtected()) {
event.setCancelled(true);
}
Bukkit.getPluginManager().callEvent(event);
return event.isCancelled();
}
public static <T> T callPossiblySync(Callable<T> callable, boolean sync) {
if (!sync) {
try {