From b0fabc888cdf2593566f73b8a64c87297c84e20f Mon Sep 17 00:00:00 2001 From: bigguy345 Date: Mon, 28 Apr 2025 07:26:39 +0300 Subject: [PATCH] Added more create methods --- src/api | 2 +- .../npcs/scripted/ScriptedActionManager.java | 55 ++++++++++--------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/api b/src/api index 0a2697242..8980850d7 160000 --- a/src/api +++ b/src/api @@ -1 +1 @@ -Subproject commit 0a2697242063d4f33021cfed554e092592017f5f +Subproject commit 8980850d7c6da1adac72818cc9eb2e87657467d4 diff --git a/src/main/java/noppes/npcs/scripted/ScriptedActionManager.java b/src/main/java/noppes/npcs/scripted/ScriptedActionManager.java index 37a552d8b..786839452 100644 --- a/src/main/java/noppes/npcs/scripted/ScriptedActionManager.java +++ b/src/main/java/noppes/npcs/scripted/ScriptedActionManager.java @@ -27,6 +27,25 @@ public class ScriptedActionManager implements IActionManager { return new Action(name, maxDuration, startAfterTicks, task); } + @Override + public IAction create(String name, int delay, Consumer t) { + return new Action(name, delay, t); + } + + @Override + public IAction create(int delay, Consumer t) { + return new Action(delay, t); + } + + @Override + public IAction create(String name, Consumer t) { + return new Action(name, t); + } + + @Override + public IAction create(Consumer t) { + return new Action(t); + } @Override public void start() { isWorking = true; @@ -267,11 +286,6 @@ public class ScriptedActionManager implements IActionManager { return startAfterTicks; } - @Override - public IAction create(String n, int md, int sat, Consumer t) { - return ScriptedActionManager.this.create(n, md, sat, t); - } - @Override public IAction getNext() { int idx = getIndex(this); @@ -300,32 +314,27 @@ public class ScriptedActionManager implements IActionManager { @Override public IAction after(String name, int maxDuration, int delay, Consumer t) { - IAction act = new Action(name, maxDuration, delay, t); - return after(act); + return after(create(name, maxDuration, delay, t)); } @Override public IAction after(String name, int delay, Consumer t) { - IAction act = new Action(name, delay, t); - return after(act); + return after(create(name, delay, t)); } @Override public IAction after(int delay, Consumer t) { - IAction act = new Action(delay, t); - return after(act); + return after(create(delay, t)); } @Override public IAction after(String name, Consumer t) { - IAction act = new Action(name, t); - return after(act); + return after(create(name, t)); } @Override public IAction after(Consumer t) { - IAction act = new Action(t); - return after(act); + return after(create(t)); } @@ -341,32 +350,28 @@ public class ScriptedActionManager implements IActionManager { @Override public IAction before(String name, int maxDuration, int delay, Consumer t) { - IAction act = new Action(name, maxDuration, delay, t); - return before(act); + return before(create(name, maxDuration, delay, t)); } @Override public IAction before(String name, int delay, Consumer t) { - IAction act = new Action(name, delay, t); - return before(act); + return before(create(name, delay, t)); } @Override public IAction before(int delay, Consumer t) { - IAction act = new Action(delay, t); - return before(act); + return before(create(delay, t)); } @Override public IAction before(String name, Consumer t) { - IAction act = new Action(name, t); - return before(act); + return before(create(name, t)); } @Override public IAction before(Consumer t) { - IAction act = new Action(t); - return before(act); + return before(create(t)); + } }