🆙 Make Dice more Random and same roll time as habbo
This commit is contained in:
parent
c10431c50d
commit
2d528aaaac
@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -71,6 +72,7 @@ public final class Emulator {
|
||||
private static GameEnvironment gameEnvironment;
|
||||
private static PluginManager pluginManager;
|
||||
private static BadgeImager badgeImager;
|
||||
private static final SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
static {
|
||||
Thread hook = new Thread(new Runnable() {
|
||||
@ -360,7 +362,9 @@ public final class Emulator {
|
||||
public static Random getRandom() {
|
||||
return ThreadLocalRandom.current();
|
||||
}
|
||||
|
||||
public static SecureRandom getRandomDice() {
|
||||
return secureRandom;
|
||||
}
|
||||
public static BadgeImager getBadgeImager() {
|
||||
return badgeImager;
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ public class InteractionDice extends HabboItem {
|
||||
Emulator.getThreading().run(this);
|
||||
|
||||
if (event.result > 0) {
|
||||
Emulator.getThreading().run(new RandomDiceNumber(room, this, event.result), 1500);
|
||||
Emulator.getThreading().run(new RandomDiceNumber(room, this, event.result), 2000);
|
||||
} else {
|
||||
Emulator.getThreading().run(new RandomDiceNumber(this, room, this.getBaseItem().getStateCount()), 1500);
|
||||
Emulator.getThreading().run(new RandomDiceNumber(this, room, this.getBaseItem().getStateCount()), 2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class RandomDiceNumber implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.result <= 0)
|
||||
this.result = (Emulator.getRandom().nextInt(this.maxNumber) + 1);
|
||||
this.result = (Emulator.getRandomDice().nextInt(this.maxNumber) + 1);
|
||||
|
||||
this.item.setExtradata(this.result + "");
|
||||
this.item.needsUpdate(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user