-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
MarkCommand.java
46 lines (34 loc) · 1.4 KB
/
MarkCommand.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
package net.aufdemrand.denizencore.scripts.commands.core;
import net.aufdemrand.denizencore.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizencore.objects.Element;
import net.aufdemrand.denizencore.objects.aH;
import net.aufdemrand.denizencore.scripts.ScriptEntry;
import net.aufdemrand.denizencore.scripts.commands.AbstractCommand;
import net.aufdemrand.denizencore.utilities.debugging.dB;
public class MarkCommand extends AbstractCommand {
@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
// Interpret arguments
for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {
if (!scriptEntry.hasObject("m_name")) {
scriptEntry.addObject("m_name", arg.asElement());
}
else {
arg.reportUnhandled();
}
}
// Check for required information
if (!scriptEntry.hasObject("m_name")) {
throw new InvalidArgumentsException("Must have a mark name!");
}
}
@Override
public void execute(ScriptEntry scriptEntry) {
// Fetch required objects
Element mName = scriptEntry.getElement("m_name");
// Debug the execution
if (scriptEntry.dbCallShouldDebug()) {
dB.report(scriptEntry, getName(), mName.debug());
}
}
}