Skip to content

Commit

Permalink
Fixes to RESET command.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Nov 10, 2013
1 parent aaa2670 commit 264080a
Showing 1 changed file with 17 additions and 14 deletions.
Expand Up @@ -43,9 +43,9 @@ else if (arg.matchesArgumentType(dScript.class))
scriptEntry.addObject("script", arg.asType(dScript.class));

else if (arg.matchesArgumentList(dPlayer.class))
scriptEntry.addObject("players", ((dList) arg.asType(dList.class)).filter(dPlayer.class));
scriptEntry.addObject("players", arg.asType(dList.class));

else throw new InvalidArgumentsException("Unknown argument '" + arg + "'!");
else arg.reportUnhandled();
}

// Use attached player if none is specified, and we're not resetting GLOBAL_COOLDOWN
Expand Down Expand Up @@ -83,23 +83,26 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

// Now deal with the rest
for (String object : players) {

dPlayer resettable = dPlayer.valueOf(object);
if (resettable.isValid()) {

switch (Type.valueOf(type.asString())) {
case FAIL:
FailCommand.resetFails(resettable.getName(), script.getName());
return;
switch (Type.valueOf(type.asString())) {
case FAIL:
FailCommand.resetFails(resettable.getName(), script.getName());
return;

case FINISH:
FinishCommand.resetFinishes(resettable.getName(), script.getName());
return;
case FINISH:
FinishCommand.resetFinishes(resettable.getName(), script.getName());
return;

case PLAYER_COOLDOWN:
CooldownCommand.setCooldown(resettable.getName(), Duration.ZERO, script.getName(), false);
return;
case PLAYER_COOLDOWN:
CooldownCommand.setCooldown(resettable.getName(), Duration.ZERO, script.getName(), false);
return;

case SAVES:
DenizenAPI.getCurrentInstance().getSaves().set("Players." + resettable.getName(), null);
case SAVES:
DenizenAPI.getCurrentInstance().getSaves().set("Players." + resettable.getName(), null);
}
}

}
Expand Down

0 comments on commit 264080a

Please sign in to comment.