Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Schedule(hour="*", minute="*/15", second="*", persistent=true)
- public void restockAllShopsMaybe() {
- Random rand = new Random();
- List<NPCRestockConfigs> rcfgs = CommerceBLL.getAllRestockConfigs();
- for(int i = 0; i < rcfgs.length(); i++){
- if(rand.nextInt(97) == 7){ //why 7? why not? its a 1 in 96 chance and thats all I care about. 1 in 96 because this job happens every quarter hour and I really only want it to happen once per day per rule.
- if(rand.nextDouble() <= rcfgs[i].getPercentOdds()){
- CommerceBLL.restock(rcfgs[i]);
- }
- }
- }
- }
- protected void restock(NPCRestockConfiguration restock){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement