/
DisengageCommand.java
39 lines (29 loc) · 1.38 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
package net.aufdemrand.denizen.scripts.commands.npc;
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.exceptions.CommandExecutionException;
import net.aufdemrand.denizencore.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizencore.scripts.ScriptEntry;
import net.aufdemrand.denizencore.scripts.commands.AbstractCommand;
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 (((BukkitScriptEntryData) scriptEntry.entryData).getNPC() == null) {
throw new InvalidArgumentsException("This command requires a linked NPC!");
}
}
@Override
public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
// Report to dB
dB.report(scriptEntry, getName(),
((BukkitScriptEntryData) scriptEntry.entryData).getNPC().debug());
// Set Disengaged
EngageCommand.setEngaged(((BukkitScriptEntryData) scriptEntry.entryData).getNPC().getCitizen(), false);
}
}