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,6 +1,10 @@
|
||||
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.GroundItems;
|
||||
import org.rev317.min.api.methods.SceneObjects;
|
||||
import org.rev317.min.api.wrappers.SceneObject;
|
||||
|
||||
@@ -8,28 +12,43 @@ import java.awt.*;
|
||||
|
||||
public class DSceneObjects 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 = SceneObjects.getNearest().length;
|
||||
}
|
||||
PaintDebugger p = Context.getInstance().getPaintDebugger();
|
||||
p.addLine("Close SceneObjects: " + cached);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return false;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle() {
|
||||
SceneObject[] objects = SceneObjects.getNearest();
|
||||
if (objects == null || objects.length == 0) {
|
||||
return;
|
||||
}
|
||||
enabled = !enabled;
|
||||
|
||||
for (int i = objects.length - 1; i >= 0; i--) {
|
||||
System.out.println(
|
||||
" ID: " + objects[i].getId() +
|
||||
" UID: " + objects[i].getHash() +
|
||||
" Location: " + objects[i].getLocation() +
|
||||
" Distance: " + objects[i].distanceTo());
|
||||
if (enabled) {
|
||||
SceneObject[] objects = SceneObjects.getNearest();
|
||||
if (objects == null || objects.length == 0) {
|
||||
Logger.addMessage("There are no GameObjects around you.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = objects.length - 1; i >= 0; i--) {
|
||||
System.out.println(
|
||||
" ID: " + objects[i].getId() +
|
||||
" UID: " + objects[i].getHash() +
|
||||
" Location: " + objects[i].getLocation() +
|
||||
" Distance: " + objects[i].distanceTo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user