Added Action.getIdentifier

This commit is contained in:
bigguy345 committed 2025-07-08 12:00:37 +03:00
1 parent b6ac84d4c4
commit b37f9a7ea4
3 files changed
+14 -10

No files matched your search

@@ -107,7 +107,7 @@ public class Action implements IAction {
this.isScheduled = true;
if (manager.debug)
manager.LOGGER.log(String.format("Scheduled Action '%s'", name), queue);
manager.LOGGER.log(String.format("Scheduled %s", getIdentifier()), queue);
}
@Override
@@ -278,7 +278,7 @@ public class Action implements IAction {
}
if (duration == 0 && onStart != null)
execute("start", this::executeOnStart);
execute("onStart", this::executeOnStart);
if (done)
return;
@@ -369,7 +369,7 @@ public class Action implements IAction {
@Override
public void kill() {
if (manager.debug)
manager.LOGGER.log(String.format("Killing Action '%s'...", name), queue);
manager.LOGGER.log(String.format("Killing %s...", getIdentifier()), queue);
if (actionThread != null)
actionThread.stop();
@@ -380,8 +380,13 @@ public class Action implements IAction {
}
@Override
public String getIdentifier() {
return String.format("%s '%s'", getClass().getSimpleName(), name);
}
public String toString() {
return String.format("%s '%s' [queue='%s', scheduled=%s, done=%s, paused=%s, updateEvery=%s, duration=%d/%d, count=%d/%d, threaded=%s]", getClass().getSimpleName(), name != null ? name : "unnamed", getQueueName(), isScheduled, done, isPaused(), updateEveryXTick, duration, maxDuration, count, maxCount, isThreaded);
return String.format("%s [queue='%s', scheduled=%s, done=%s, paused=%s, updateEvery=%s, duration=%d/%d, count=%d/%d, threaded=%s]", getIdentifier(), getQueueName(), isScheduled, done, isPaused(), updateEveryXTick, duration, maxDuration, count, maxCount, isThreaded);
}
///////////////////////////////////////////////////
//////////////////////////////////////////////////
@@ -264,12 +264,12 @@ public class ActionQueue implements IActionQueue {
public boolean finish(Action a) {
if (a.isDone()) {
if (a.onDone != null)
a.execute("done", a::executeOnDone);
a.execute("onDone", a::executeOnDone);
a.kill();
if (manager.debug)
manager.LOGGER.finish(String.format("Removing Action '%s' from queue", a.name), this);
manager.LOGGER.finish(String.format("Removing %s from queue", a.getIdentifier()), this);
return true;
}
@@ -281,12 +281,12 @@ public class ActionQueue implements IActionQueue {
boolean wasDone = a.isDone();
if (manager.debug && !wasDone)
manager.LOGGER.push(this).log(String.format("Started ticking Action '%s' ", a.name), this).push(a);
manager.LOGGER.push(this).log(String.format("Started ticking %s", a.getIdentifier(), a.name), this).push(a);
a.tick();
if (manager.debug && !wasDone)
manager.LOGGER.pop().finish(String.format("Finished ticking Action '%s' ", a.name), this).pop();
manager.LOGGER.pop().finish(String.format("Finished ticking %s", a.getIdentifier(), a.name), this).pop();
return finish(a);
}
@@ -155,8 +155,7 @@ public class ConditionalAction extends Action implements IConditionalAction {
public String toString() {
return String.format("%s '%s' [queue='%s', scheduled=%s, done=%s, paused=%s, updateEvery=%s, duration=%d/%d, count=%d/%d, checks=%d/%d, taskExecuted=%s, threaded=%s]", getClass().getSimpleName(),
name != null ? name : "unnamed", getQueueName(),
return String.format("%s [queue='%s', scheduled=%s, done=%s, paused=%s, updateEvery=%s, duration=%d/%d, count=%d/%d, checks=%d/%d, taskExecuted=%s, threaded=%s]", getIdentifier(), getQueueName(),
isScheduled,
done,
isPaused(),