mirror of
https://github.com/2006-Scape/Parabot-317-API-Minified.git
synced 2026-07-03 08:39:09 +00:00
Add missing 'enabled' state to various AbstractDebuggers + only send debug info if when enabled
This commit is contained in:
@@ -1,27 +1,47 @@
|
||||
package org.rev317.min.debug;
|
||||
|
||||
import org.parabot.core.Context;
|
||||
import org.parabot.core.paint.AbstractDebugger;
|
||||
import org.parabot.core.paint.PaintDebugger;
|
||||
import org.parabot.core.ui.Logger;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class DNpcs extends AbstractDebugger {
|
||||
|
||||
private boolean enabled;
|
||||
private long lastCheck = System.currentTimeMillis();
|
||||
private int cached;
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
|
||||
if (System.currentTimeMillis() - lastCheck > 1000L) {
|
||||
lastCheck = System.currentTimeMillis();
|
||||
cached = Npcs.getNearest().length;
|
||||
}
|
||||
PaintDebugger p = Context.getInstance().getPaintDebugger();
|
||||
p.addLine("Close NPCs: " + cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return false;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle() {
|
||||
for (Npc n : Npcs.getNearest()) {
|
||||
System.out.println("ID: " + n.getDef().getId() + " Distance: " + n.distanceTo() + " Location: " + n.getLocation().toString());
|
||||
enabled = !enabled;
|
||||
if (enabled) {
|
||||
if (Npcs.getNearest().length == 0) {
|
||||
Logger.addMessage("There are no NPCs close to you.");
|
||||
return;
|
||||
}
|
||||
for (Npc n : Npcs.getNearest()) {
|
||||
System.out.println("ID: " + n.getDef().getId() + " Distance: " + n.distanceTo() + " Location: " + n.getLocation().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user