mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	Cache on fail as well
This commit is contained in:
		@@ -1414,15 +1414,42 @@ public class PlayerEvents extends PlotListener implements Listener {
 | 
				
			|||||||
            if (mobs == null) {
 | 
					            if (mobs == null) {
 | 
				
			||||||
                mobs = plot.countEntities();
 | 
					                mobs = plot.countEntities();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (mobs[i]++ >= cap) {
 | 
					            if (mobs[i] >= cap) {
 | 
				
			||||||
 | 
					                plot.setMeta("EntityCount", mobs);
 | 
				
			||||||
 | 
					                plot.setMeta("EntityCountTime", System.currentTimeMillis());
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        for (IntegerFlag flag : flags) {
 | 
				
			||||||
 | 
					            int i;
 | 
				
			||||||
 | 
					            switch (flag.getName()) {
 | 
				
			||||||
 | 
					                case "entity-cap":
 | 
				
			||||||
 | 
					                    i = 0;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "mob-cap":
 | 
				
			||||||
 | 
					                    i = 3;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "hostile-cap":
 | 
				
			||||||
 | 
					                    i = 2;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "animal-cap":
 | 
				
			||||||
 | 
					                    i = 1;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "vehicle-cap":
 | 
				
			||||||
 | 
					                    i = 4;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                case "misc-cap":
 | 
				
			||||||
 | 
					                    i = 5;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                default:
 | 
				
			||||||
 | 
					                    i = 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            mobs[i]++;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (mobs != null) {
 | 
					        if (mobs != null) {
 | 
				
			||||||
            plot.setMeta("EntityCount", mobs);
 | 
					            plot.setMeta("EntityCount", mobs);
 | 
				
			||||||
            plot.setMeta("EntityCountTime", System.currentTimeMillis());
 | 
					            plot.setMeta("EntityCountTime", System.currentTimeMillis());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user