Use collection for this

Former-commit-id: 6208cbb258ca4ecf12f39cff06c0d7d45a357761 [formerly 34818e711b6a6d1bd11430728c415807f5acfdda]
Former-commit-id: 285feec82013eed5e90fb500d58de411d00d4828
This commit is contained in:
Ghost_chu committed 2019-10-02 19:39:39 +08:00
1 parent a4de1e3262
commit c9bbdb7eae
1 file changed
+14 -16
@@ -5,10 +5,8 @@ import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Shop.Shop;
import org.maxgamer.quickshop.Util.Util;
import java.util.ArrayList;
import java.util.Iterator;
class DisplayRunnable implements Runnable {
@Override
@@ -45,20 +43,20 @@ public class DisplayWatcher {
plugin.getLogger()
.severe("Shop.display-items-check-ticks is too low! It may cause HUGE lag! Pick a number > 3000");
}
Iterator<Shop> it = plugin.getShopManager().getShopIterator();
while (it.hasNext()) {
Shop shop = it.next();
if (shop == null) {
continue;
}
if (!shop.isLoaded()) {
continue;
}
if (!Util.isLoaded(shop.getLocation())) {
continue;
}
pendingCheckDisplay.add(shop);
}
// Iterator<Shop> it = plugin.getShopManager().getShopIterator();
// while (it.hasNext()) {
// Shop shop = it.next();
// if (shop == null) {
// continue;
// }
// if (!shop.isLoaded()) {
// continue;
// }
// if (!Util.isLoaded(shop.getLocation())) {
// continue;
// }
pendingCheckDisplay.addAll(plugin.getShopManager().getLoadedShops());
//}
Bukkit.getScheduler().runTask(plugin, new DisplayRunnable());
}
}.runTaskTimerAsynchronously(plugin, 1L, plugin.getDisplayItemCheckTicks());