refactor: remove all debug code (DumpParticles, RegionEnterNotifier, dead ctors)

This commit is contained in:
2026-04-23 16:45:37 +02:00
parent 1e47f4e846
commit f5e6cc24f5
5 changed files with 8 additions and 322 deletions
@@ -5,9 +5,7 @@ import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.universe.Universe;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.util.Config;
import com.mythlane.gravityflip.command.DumpParticlesCommand;
import com.mythlane.gravityflip.config.GravityFlipConfig;
import com.mythlane.gravityflip.debug.RegionEnterNotifier;
import com.mythlane.gravityflip.physics.FallDamageGuard;
import com.mythlane.gravityflip.physics.FallDamageSuppressorSystem;
import com.mythlane.gravityflip.physics.GravityApplier;
@@ -83,15 +81,6 @@ public class GravityFlipPlugin extends JavaPlugin {
this.tickLoop = new RegionTickLoop(registry, gravityApplier, regionVisualizer, th ->
getLogger().at(Level.WARNING).withCause(th).log("detectTick failed"));
// Debug enter/exit notifier — opt-in via env var GRAVITYFLIP_DEBUG_NOTIFY (or sysprop
// gravityflip.debugNotify). Emits chat + INFO log on every region transition. Off by
// default to keep prod chat/logs clean.
if (isDebugNotifyEnabled()) {
this.tickLoop.setEnterNotifier(new RegionEnterNotifier(registry,
th -> getLogger().at(Level.WARNING).withCause(th).log("regionEnterNotify failed"),
msg -> getLogger().at(Level.INFO).log("%s", msg)));
}
// Lazy world resolution — see setup() comment.
this.tickLoop.startWithDelay(2_000L, () -> {
Universe u = Universe.get();
@@ -111,37 +100,6 @@ public class GravityFlipPlugin extends JavaPlugin {
getLogger().at(Level.INFO).log(
"Gravity Flip enabled — %d region(s) loaded, detector @100ms, gravity inversion active",
cfg.getRegions().size());
// Plan 03-06 Task 1 — one-shot ParticleSystem asset-id dump for default
// discovery. Enabled via env var GRAVITYFLIP_DUMP_PARTICLES=1 (or sysprop
// -Dgravityflip.dumpParticles=true). No-op otherwise. See
// DumpParticlesCommand javadoc for the chosen API rationale.
if (DumpParticlesCommand.isEnabled()) {
try {
int n = DumpParticlesCommand.dump(line ->
getLogger().at(Level.INFO).log("%s", line));
getLogger().at(Level.INFO).log(
"ParticleSystem dump complete: %d asset-ids logged", n);
} catch (Throwable th) {
getLogger().at(Level.WARNING).withCause(th)
.log("ParticleSystem dump failed");
}
}
}
/**
* Env var {@code GRAVITYFLIP_DEBUG_NOTIFY=1} or sysprop {@code -Dgravityflip.debugNotify=true}
* enables the chat + log enter/exit notifier. Off by default — debug tool only.
*/
private static boolean isDebugNotifyEnabled() {
return truthy(System.getenv("GRAVITYFLIP_DEBUG_NOTIFY"))
|| truthy(System.getProperty("gravityflip.debugNotify"));
}
private static boolean truthy(String v) {
if (v == null) return false;
String s = v.trim().toLowerCase();
return s.equals("1") || s.equals("true") || s.equals("yes") || s.equals("on");
}
@Override