I don't really like or understand the traditional way gambling is done on servers, so I decided to take a RuneScape-style approach to it .
VIDEO
Here's the runes and their values + how it gets the random rune:
Code:
/**
* Is using the Magic class for the IDs too repetitive?
*/
private enum Rune {
AIR(Magic.AIR_RUNE, 1),
MIND(Magic.MIND_RUNE, 2),
WATER(Magic.WATER_RUNE, 3),
EARTH(Magic.EARTH_RUNE, 4),
FIRE(Magic.FIRE_RUNE, 5),
BODY(Magic.BODY_RUNE, 6),
COSMIC(Magic.COSMIC_RUNE, 7),
CHAOS(Magic.CHAOS_RUNE, 8),
NATURE(Magic.NATURE_RUNE, 9),
DEATH(Magic.DEATH_RUNE, -1);
private static final List<Rune> VALUES = Collections.unmodifiableList(Arrays.asList(values( )));
private static final int SIZE = VALUES.size();
//@formatter:off
private @Getter int id;
private @Getter int value;
//@formatter:on
Rune(int id, int value) {
this.id = id;
this.value = value;
}
public static Rune getRandomRune() {
return VALUES.get(Utils.random(SIZE));
}
}
By the way, clem585 is awesome, so go look at him and his project too.