Implement basic functional diceroll command
This commit is contained in:
45
src/main/java/wtf/beatrice/hidekobot/objects/Dice.java
Normal file
45
src/main/java/wtf/beatrice/hidekobot/objects/Dice.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package wtf.beatrice.hidekobot.objects;
|
||||
|
||||
import wtf.beatrice.hidekobot.util.RandomUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class Dice
|
||||
{
|
||||
private final int sides;
|
||||
private int value = 0;
|
||||
private final UUID uuid;
|
||||
|
||||
public Dice(int sides)
|
||||
{
|
||||
this.sides = sides;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public Dice(Dice old)
|
||||
{
|
||||
this.sides = old.sides;
|
||||
this.value = old.value;
|
||||
this.uuid = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getSides()
|
||||
{
|
||||
return sides;
|
||||
}
|
||||
|
||||
public void roll()
|
||||
{
|
||||
value = RandomUtil.getRandomNumber(1, sides);
|
||||
}
|
||||
|
||||
public UUID getUUID()
|
||||
{
|
||||
return uuid;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user