mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-25 05:55:13 +01:00
parent
38c36729db
commit
af89cbc2be
@ -33,6 +33,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -94,10 +95,15 @@ public abstract class AuctionUpdatingPagedGUI<T> extends BaseGUI {
|
|||||||
if (this.items != null) {
|
if (this.items != null) {
|
||||||
AuctionHouse.newChain().asyncFirst(() -> {
|
AuctionHouse.newChain().asyncFirst(() -> {
|
||||||
this.fillSlots().forEach(slot -> setItem(slot, getDefaultItem()));
|
this.fillSlots().forEach(slot -> setItem(slot, getDefaultItem()));
|
||||||
|
|
||||||
|
List<T> itemsCopy;
|
||||||
|
synchronized (this.items) {
|
||||||
|
itemsCopy = new ArrayList<>(this.items);
|
||||||
|
}
|
||||||
|
|
||||||
prePopulate();
|
prePopulate();
|
||||||
|
|
||||||
final List<T> itemsToFill = this.items.stream().skip((page - 1) * (long) this.fillSlots().size()).limit(this.fillSlots().size()).collect(Collectors.toList());
|
return itemsCopy.stream().skip((page - 1) * (long) this.fillSlots().size()).limit(this.fillSlots().size()).collect(Collectors.toCollection(ArrayList::new));
|
||||||
return itemsToFill;
|
|
||||||
}).asyncLast((data) -> {
|
}).asyncLast((data) -> {
|
||||||
pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) this.fillSlots().size()));
|
pages = (int) Math.max(1, Math.ceil(this.items.size() / (double) this.fillSlots().size()));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user