Print the root cause of any exceptions while updating NPCs

This commit is contained in:
fullwall 2013-07-14 16:38:06 +08:00
parent e21d6daf48
commit e1e05c6728
2 changed files with 6 additions and 3 deletions

View File

@ -36,6 +36,7 @@ import org.bukkit.metadata.FixedMetadataValue;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
@ -236,8 +237,9 @@ public class CitizensNPC extends AbstractNPC {
navigator.run();
}
} catch (Exception ex) {
Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), ex.getMessage());
ex.printStackTrace();
Throwable error = Throwables.getRootCause(ex);
Messaging.logTr(Messages.EXCEPTION_UPDATING_NPC, getId(), error.getMessage());
error.printStackTrace();
}
}

View File

@ -67,8 +67,9 @@ public class CreeperController extends MobEntityController {
@Override
public void bh() {
super.bh();
if (npc != null)
if (npc != null) {
npc.update();
}
}
@Override