Examples

How to get object of specified reward

Getting a reward

Also you can get the reward and parse it as valid type. like in this example, where I take a reward called 'exampleTimeReward':

final Optional<Reward> rewardOptional = UltimateReward.getRewardByName("exampleTimeReward");
if (rewardOptional.isPresent()) {
    TimeReward timeReward = (TimeReward) rewardOptional.get();
}

Checking if reward exists

boolean exists = UltimateReward.getRewardByName("rewardName").isPresent();

or you can also use the old method which is not allocating anything:

boolean exists = UltimateReward.isReward("rewardName");

Last updated