/
StopCommand.java
56 lines (47 loc) · 1.64 KB
/
StopCommand.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.denizenscript.denizencore.scripts.commands.queue;
import com.denizenscript.denizencore.exceptions.InvalidArgumentsException;
import com.denizenscript.denizencore.objects.Argument;
import com.denizenscript.denizencore.objects.core.QueueTag;
import com.denizenscript.denizencore.utilities.debugging.Debug;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
public class StopCommand extends AbstractCommand {
public StopCommand() {
setName("stop");
setSyntax("stop");
setRequiredArguments(0, 0);
isProcedural = true;
}
// <--[command]
// @Name Stop
// @Syntax stop
// @Required 0
// @Maximum 0
// @Short Stops the current queue.
// @Group queue
//
// @Description
// This will immediately stop the current queue, preventing it from processing any further.
//
// @Tags
// <queue> to get the current queue.
//
// @Usage
// Use to stop the current queue.
// - stop
// -->
@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
for (Argument arg : scriptEntry.getProcessedArgs()) {
arg.reportUnhandled();
}
}
@Override
public void execute(ScriptEntry scriptEntry) {
if (scriptEntry.dbCallShouldDebug()) {
Debug.report(scriptEntry, getName(), new QueueTag(scriptEntry.getResidingQueue()).debug());
}
scriptEntry.getResidingQueue().clear();
scriptEntry.getResidingQueue().stop();
}
}