Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void refillAllChests() {
- for(Chunk chunk : Bukkit.getWorld("world").getLoadedChunks()) {
- for(BlockState bs : chunk.getTileEntities()) {
- if(bs instanceof Chest) {
- Chest coffre = (Chest) bs.getBlock().getState();
- Inventory inv = coffre.getInventory();
- inv.clear();
- for(int i = 0; i <4; i++) {
- ItemStack randomItem = API_RandomItem.getRandomItem();
- Random r = new Random();
- int limit = inv.getSize() - 1;
- int randomSlot = r.nextInt(limit);
- inv.setItem(randomSlot, randomItem);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement