/
DisengageCommand.java
48 lines (36 loc) · 1.54 KB
/
DisengageCommand.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
package net.aufdemrand.denizen.scripts.commands.npc;
import net.aufdemrand.denizen.exceptions.CommandExecutionException;
import net.aufdemrand.denizen.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizen.scripts.ScriptEntry;
import net.aufdemrand.denizen.scripts.commands.AbstractCommand;
import net.aufdemrand.denizen.objects.aH;
import net.aufdemrand.denizen.scripts.commands.npc.EngageCommand;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizen.utilities.debugging.dB.Messages;
/**
* Unsets the Denizen from the Engage List.
* When ENGAGEd, a Denizen will not interact with a Player until DISENGAGEd (or timed out).
*
* @author aufdemrand
*/
public class DisengageCommand extends AbstractCommand {
/* DISENGAGE (NPCID:#) */
/* Arguments: [] - Required, () - Optional
* (NPCID:#) Changes the Denizen affected to the Citizens2 NPCID specified
*
*/
@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
// Make sure NPC is available
if (scriptEntry.getNPC() == null)
throw new InvalidArgumentsException(Messages.ERROR_NO_NPCID);
}
@Override
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
// Report to dB
dB.report(getName(),
aH.debugObj("NPC", scriptEntry.getNPC().toString()));
// Set Disengaged
EngageCommand.setEngaged(scriptEntry.getNPC().getCitizen(), false);
}
}