Fix shulker bullets with lookclose on

This commit is contained in:
fullwall 2020-10-12 14:10:23 +08:00
parent b20113e1f1
commit b2f841a40e
3 changed files with 4 additions and 4 deletions

View File

@ -190,7 +190,7 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
t--;
if (lookingAt != null && canSeeTarget()) {
Util.faceEntity(npc.getEntity(), lookingAt);
if (npc.getEntity().getType().name().toLowerCase().contains("shulker")) {
if (npc.getEntity().getType().name().equals("SHULKER")) {
NMS.setPeekShulker(npc.getEntity(), 100 - (int) Math
.floor(npc.getStoredLocation().distanceSquared(lookingAt.getLocation(PLAYER_LOCATION))));
}

View File

@ -505,13 +505,13 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
}
public void setPaused(boolean pause) {
paused = pause;
if (pause && currentDestination != null) {
selector.finish();
if (npc != null && npc.getNavigator().isNavigating()) {
npc.getNavigator().cancelNavigation();
}
}
paused = pause;
}
@Override

View File

@ -32,11 +32,11 @@ public class DelayTrigger implements WaypointTrigger {
@Override
public void onWaypointReached(NPC npc, Location waypoint) {
if (delay > 0) {
scheduleTask(npc.getOrAddTrait(Waypoints.class).getCurrentProvider());
delay(npc.getOrAddTrait(Waypoints.class).getCurrentProvider());
}
}
private void scheduleTask(final WaypointProvider provider) {
private void delay(final WaypointProvider provider) {
provider.setPaused(true);
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override