Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Nov 6, 2014
1 parent bdabb15 commit bd5b225
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
Expand Up @@ -390,15 +390,13 @@ public void setProtected(boolean isProtected) {
data().setPersistent(NPC.DEFAULT_PROTECTED_METADATA, isProtected);
}

private void teleport(final Entity entity, Location location, boolean loaded, int delay) {
if (!loaded)
location.getBlock().getChunk();
private void teleport(final Entity entity, Location location, int delay) {
final Entity passenger = entity.getPassenger();
entity.eject();
entity.teleport(location);
if (passenger == null)
return;
teleport(passenger, location, true, delay++);
teleport(passenger, location, delay++);
Runnable task = new Runnable() {
@Override
public void run() {
Expand All @@ -420,7 +418,8 @@ public void teleport(Location location, TeleportCause cause) {
while (entity.getVehicle() != null) {
entity = entity.getVehicle();
}
teleport(entity, location, false, 5);
location.getBlock().getChunk();
teleport(entity, location, 5);
}

public void update() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/citizensnpcs/api/util/NBTStorage.java
Expand Up @@ -133,7 +133,7 @@ private String createRelativeKey(String parent, String sub) {
return parent;
if (sub.charAt(0) == '.')
return parent.isEmpty() ? sub.substring(1, sub.length()) : parent + sub;
return parent.isEmpty() ? sub : parent + "." + sub;
return parent.isEmpty() ? sub : parent + "." + sub;
}

@Override
Expand Down

0 comments on commit bd5b225

Please sign in to comment.