Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. @Schedule(hour="*", minute="*/15", second="*", persistent=true)
  2. public void restockAllShopsMaybe() {
  3. Random rand = new Random();
  4. List<NPCRestockConfigs> rcfgs = CommerceBLL.getAllRestockConfigs();
  5. for(int i = 0; i < rcfgs.length(); i++){
  6. 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.
  7. if(rand.nextDouble() <= rcfgs[i].getPercentOdds()){
  8. CommerceBLL.restock(rcfgs[i]);
  9. }
  10. }
  11. }
  12. }
  13.  
  14. protected void restock(NPCRestockConfiguration restock){
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement