Skip to content

Commit

Permalink
Use teleportcause
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 14, 2023
1 parent 22e1821 commit a09a54d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
6 changes: 3 additions & 3 deletions main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
Expand Up @@ -326,7 +326,7 @@ public boolean spawn(Location at, SpawnReason reason) {
skinnable.getSkinTracker().onSpawnNPC();
}

getEntity().teleport(at);
teleport(at, TeleportCause.PLUGIN);

NMS.setHeadYaw(getEntity(), at.getYaw());
NMS.setBodyYaw(getEntity(), at.getYaw());
Expand Down Expand Up @@ -468,8 +468,8 @@ public void update() {

if (navigator.isNavigating()) {
if (data().get(NPC.Metadata.SWIMMING, true)) {
getEntity().setVelocity(getEntity().getVelocity().multiply(data()
.get(NPC.Metadata.WATER_SPEED_MODIFIER, Setting.NPC_WATER_SPEED_MODIFIER.asFloat())));
getEntity().setVelocity(getEntity().getVelocity().multiply(
data().get(NPC.Metadata.WATER_SPEED_MODIFIER, Setting.NPC_WATER_SPEED_MODIFIER.asFloat())));
Location currentDest = navigator.getPathStrategy().getCurrentDestination();
if (currentDest == null || currentDest.getY() > getStoredLocation().getY()) {
NMS.trySwim(getEntity());
Expand Down
12 changes: 0 additions & 12 deletions main/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java
Expand Up @@ -154,23 +154,11 @@ public NPC getById(int id) {

@Override
public NPC getByUniqueId(UUID uuid) {
if (uuid.version() == 2) {
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000002000L;
msb |= 0x0000000000004000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
return uniqueNPCs.get(uuid);
}

@Override
public NPC getByUniqueIdGlobal(UUID uuid) {
if (uuid.version() == 2) {
long msb = uuid.getMostSignificantBits();
msb &= ~0x0000000000002000L;
msb |= 0x0000000000004000L;
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}
NPC npc = getByUniqueId(uuid);
if (npc != null)
return npc;
Expand Down
4 changes: 2 additions & 2 deletions main/src/main/java/net/citizensnpcs/trait/PacketNPC.java
Expand Up @@ -54,9 +54,9 @@ public EntityController wrap(EntityController controller) {
public static interface EntityPacketTracker extends Runnable {
public void link(Player player);

public void unlinkAll(Consumer<Player> callback);

public void unlink(Player player);

public void unlinkAll(Consumer<Player> callback);
}

private class PacketController implements EntityController {
Expand Down

0 comments on commit a09a54d

Please sign in to comment.