Fix duplicate message and only log unexpected errors

This commit is contained in:
Phoenix616 2019-04-27 01:04:55 +01:00
parent b25e38f393
commit 58c1a98005

View File

@ -348,8 +348,14 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
return true;
}).exceptionally(ex -> {
sendMessage(sender, "error.location");
sender.sendMessage(ex.getMessage());
searcher.getTargets().forEach(e -> sendMessage(e, "error.location"));
if (!(ex instanceof NotFoundException)) {
getLogger().log(Level.SEVERE, "Error while trying to find a location!", ex);
}
searcher.getTargets().forEach(e -> {
if (e != sender) {
sendMessage(e, "error.location");
}
});
return true;
});
return searcher;