From 0193f3560ea5d38964c9cbb5ef45c95e0d31ffe9 Mon Sep 17 00:00:00 2001 From: Daniel McCoy Stephenson Date: Thu, 19 Nov 2026 23:43:32 -0700 Subject: [PATCH] Bring three Javadocs up to the fail-closed opt-outs 0.8.0 made every switch fail closed, but three comments still describe the old lists of values that turn reporting off: the ENV_USAGE_REPORTING and ENV_DO_NOT_TRACK constants, Builder.serverWideConfig, and ServerWideConfig.NONE (an unreadable file is now UNREADABLE, not NONE). They now say what disabledReason(Builder) and parseServerWideConfig do. Co-Authored-By: Claude Opus 5.5 --- .../stephenson/trace/TraceClient.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/main/java/software/stephenson/trace/TraceClient.java b/src/main/java/software/stephenson/trace/TraceClient.java index b4680d0..a5179af 100644 --- a/src/main/java/software/stephenson/trace/TraceClient.java +++ b/src/main/java/software/stephenson/trace/TraceClient.java @@ -190,9 +190,17 @@ public final class TraceClient { /** Reason reported when no key was given. */ public static final String REASON_NO_KEY = "no key"; - /** Environment variable that turns reporting off: {@code off}, {@code false}, {@code 0}, {@code no}. */ + /** + * Environment variable that turns reporting off when set to anything but + * blank, {@code true}, {@code on}, {@code yes} or {@code 1} (any case): + * {@code off}, {@code false}, {@code 0}, {@code no}, a typo. + */ public static final String ENV_USAGE_REPORTING = "TRACE_USAGE_REPORTING"; - /** Environment variable that turns reporting off: {@code 1}, {@code true}, {@code yes}. See https://consoledonottrack.com. */ + /** + * Environment variable that turns reporting off when set to anything but + * blank, {@code 0}, {@code false}, {@code off} or {@code no} (any case): + * {@code 1}, {@code true}, {@code yes}, a typo. See https://consoledonottrack.com. + */ public static final String ENV_DO_NOT_TRACK = "DO_NOT_TRACK"; /** The server-wide switch, relative to the plugins directory. */ @@ -530,7 +538,11 @@ public static boolean allowsReporting(Object setting) { /** What {@code plugins/trace/config.yml} says: the switch, the server-wide tags and the server-id. */ static final class ServerWideConfig { - /** No file was read: none was asked for, or it could not be read. */ + /** + * No file was read: none was asked for, the environment opted out + * first, or none was there and none could be made. (One that is + * there but cannot be read is {@link #UNREADABLE}.) + */ static final ServerWideConfig NONE = new ServerWideConfig(false, Collections.emptyMap(), null); /** The file is there but could not be read: whatever it says, it may say off. */ static final ServerWideConfig UNREADABLE = new ServerWideConfig(true, Collections.emptyMap(), null); @@ -1215,9 +1227,11 @@ public Builder enabled(boolean enabled) { * Given the plugins directory ({@code getDataFolder().getParentFile()} * in a Bukkit plugin), {@link #build()} makes sure * {@code plugins/trace/config.yml} exists -- creating it with - * {@code enabled: true} if it is missing -- and honours - * {@code enabled: false} (or {@code off}, {@code 0}, {@code no}, - * case-insensitive) in it. Its optional {@code tags:} block is + * {@code enabled: true} if it is missing -- and fails closed on it: + * any {@code enabled:} line whose value, bare or quoted, is not + * {@code true}, {@code on}, {@code yes} or {@code 1} + * (case-insensitive) turns reporting off, and so does a file that is + * there but cannot be read. Its optional {@code tags:} block is * added to every event this client reports, below the event's own * tags. Its {@code server-id:} line is sent as the tag * {@code install}; when an enabled client finds none, it appends one