Ignore timeouts in placeholders

This commit is contained in:
ajgeiss0702
2023-07-07 22:21:25 -05:00
parent 89a11c176b
commit 567f97f440
8 changed files with 8 additions and 24 deletions
@@ -40,9 +40,7 @@ public class EstimatedTime extends Placeholder {
cache.put(p.getUniqueId(), response.getEither());
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
}
} catch (TimeoutException ignored) {}
});
return cache.getOrDefault(p.getUniqueId(), "...");
@@ -39,9 +39,7 @@ public class InQueue extends Placeholder {
cache.put(p.getUniqueId(), response + "");
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
}
} catch (TimeoutException ignored) {}
});
return cache.getOrDefault(p.getUniqueId(), "...");
@@ -40,9 +40,7 @@ public class Position extends Placeholder {
cache.put(p.getUniqueId(), response.getEither());
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
}
} catch (TimeoutException ignored) {}
});
return cache.getOrDefault(p.getUniqueId(), "...");
@@ -40,9 +40,7 @@ public class PositionOf extends Placeholder {
cache.put(p.getUniqueId(), response.getEither());
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
}
} catch (TimeoutException ignored) {}
});
return cache.getOrDefault(p.getUniqueId(), "...");
@@ -40,9 +40,7 @@ public class Queued extends Placeholder {
cache.put(p.getUniqueId(), response.getEither());
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
}
} catch (TimeoutException ignored) {}
});
return cache.getOrDefault(p.getUniqueId(), "...");
@@ -43,15 +43,13 @@ public class QueuedFor extends Placeholder {
cache.put(queue, response + "");
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof IllegalArgumentException) {
cache.put(queue, invalidMessage);
} else {
throw new RuntimeException(e);
}
}
} catch (TimeoutException ignored) {}
});
return cached;
@@ -43,15 +43,13 @@ public class Status extends Placeholder {
cache.put(queue, response);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof IllegalArgumentException) {
cache.put(queue, invalidMessage);
} else {
throw new RuntimeException(e);
}
}
} catch (TimeoutException ignored) {}
});
return cached;
@@ -46,9 +46,7 @@ public class StatusPlayer extends Placeholder {
cache.put(key, response);
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
} catch (TimeoutException e) {
plugin.getLogger().log(Level.WARNING, "Timed out while trying to get placeholder data from proxy: ", e);
}
} catch (TimeoutException ignored) {}
});
return cache.getOrDefault(key, "...");