@Override
public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
if (sentence.hasError()) {
fireSentenceError(player, sentence, npc);
} else {
ItemParserResult res = behaviour.parse(sentence);
// don't use res.wasFound() and avoid to call fireRequestError()
fireRequestOK(res, player, sentence, npc);
}
}
@Override
public void fireRequestOK(final ItemParserResult res, Player player, Sentence sentence, EventRaiser npc) {
stake = res.getAmount();
if (stake < MIN_STAKE) {
npc.say("You must stake at least " + MIN_STAKE + " pieces of gold.");
} else if (stake > MAX_STAKE) {
npc.say("You can't stake more than " + MAX_STAKE + " pieces of gold.");