Skip to content

Commit

Permalink
Remove outdates features in ScriptEntry (Command Execution timing has…
Browse files Browse the repository at this point in the history
… now been moved to ScriptQueues)
  • Loading branch information
aufdemrand committed Jul 26, 2013
1 parent cad13ed commit d984d96
Showing 1 changed file with 20 additions and 45 deletions.
65 changes: 20 additions & 45 deletions src/main/java/net/aufdemrand/denizen/scripts/ScriptEntry.java
Expand Up @@ -19,12 +19,7 @@ public class ScriptEntry {
// The name of the command that will be executed
private String command;

// The queuetime and allowed-run-time can dictate whether it's okay
// for this command to run in the queue.
private long creationTime;
private long queueTime;
private long runTime;
private long holdTime;

private boolean instant = false;
private boolean waitfor = false;
Expand All @@ -48,13 +43,10 @@ public ScriptEntry(String command, String[] arguments, ScriptContainer script) t

this.command = command.toUpperCase();
if (script != null)
this.script = script.getAsScriptArg();
this.script = script.getAsScriptArg();

// Internal, never null. runTime/holdTime can be adjusted mid-execution
// Internal, never null.
this.creationTime = System.currentTimeMillis();
this.queueTime = creationTime;
this.runTime = creationTime;
this.holdTime = creationTime;

// Check if this is an 'instant' or 'waitfor' command.
if (command.startsWith("^")) {
Expand Down Expand Up @@ -88,7 +80,7 @@ public ScriptEntry addObject(String key, Object object) {
objects.put(key.toUpperCase(), object);
return this;
}

/**
* If the scriptEntry lacks the object corresponding to the
* key, set it to the first non-null argument
Expand All @@ -97,26 +89,18 @@ public ScriptEntry addObject(String key, Object object) {
* @return The scriptEntry
*
*/

public ScriptEntry defaultObject(String key, Object... objects) {

if (this.hasObject(key) == false) {
for (Object obj : objects) {
if (obj != null) {
this.addObject(key, obj);
break;
}
}
}
return this;
}

public long getRunTime() {
return runTime;
}
public ScriptEntry defaultObject(String key, Object... objects) {

public long getHoldTime() {
return holdTime;
if (this.hasObject(key) == false) {
for (Object obj : objects) {
if (obj != null) {
this.addObject(key, obj);
break;
}
}
}
return this;
}

public List<String> getArguments() {
Expand All @@ -129,12 +113,12 @@ public String getCommandName() {

public dNPC getNPC() {
return npc;
}
}

public boolean hasNPC() {

if (npc != null) return true;
return false;
if (npc != null) return true;
return false;
}

public void setFinished(boolean finished) {
Expand All @@ -144,11 +128,11 @@ public void setFinished(boolean finished) {
public dPlayer getPlayer() {
return player;
}

public boolean hasPlayer() {

if (player != null) return true;
return false;
if (player != null) return true;
return false;
}

public Map<String, Object> getObjects() {
Expand Down Expand Up @@ -188,10 +172,6 @@ public ScriptQueue getResidingQueue() {
return queue;
}

public Long getQueueTime() {
return queueTime;
}

public boolean isInstant() {
return instant;
}
Expand All @@ -204,11 +184,6 @@ public boolean isDone() {
return done;
}

public ScriptEntry setRunTime(Long newTime) {
runTime = newTime;
return this;
}

public ScriptEntry setArguments(List<String> arguments) {
args = arguments;
return this;
Expand Down

0 comments on commit d984d96

Please sign in to comment.