@Override public boolean inGroup(final Player base, final String group) { final long start = System.nanoTime(); final boolean result = handler.inGroup(base, group); checkPermLag(start, String.format("Checking if %s is in group %s", base.getName(), group)); return result; }
@Override public String getSuffix(final Player base) { final long start = System.nanoTime(); String suffix = handler.getSuffix(base); if (suffix == null) { suffix = ""; } checkPermLag(start, String.format("Getting suffix for %s", base.getName())); return suffix; }
@Override public String getGroup(final Player base) { final long start = System.nanoTime(); String group = handler.getGroup(base); if (group == null) { group = defaultGroup; } checkPermLag(start, String.format("Getting group for %s", base.getName())); return group; }
@Override public List<String> getGroups(final Player base) { final long start = System.nanoTime(); List<String> groups = handler.getGroups(base); if (groups == null || groups.isEmpty()) { groups = Collections.singletonList(defaultGroup); } checkPermLag(start, String.format("Getting groups for %s", base.getName())); return Collections.unmodifiableList(groups); }
private void checkPermLag(long start, String summary) { final long elapsed = System.nanoTime() - start; if (elapsed > ess.getSettings().getPermissionsLagWarning()) { ess.getLogger() .log( Level.WARNING, String.format( "Permissions lag notice with (%s). Response took %fms. Summary: %s", getName(), elapsed / 1000000.0, summary)); } }