add back old-algorithm and can make user switch to it.

Former-commit-id: 728d028cb85b9560557f07be510453135821018f [formerly f86514c80aac345056bbecdf0f3d584dcab604a5]
Former-commit-id: 4578b0ede4abcdaff20b21fc18d2082f60f468fc
This commit is contained in:
Ghost_chu committed 2018-11-21 11:42:50 +08:00
1 parent 5be642c86f
commit 675613c0f8
2 files changed
+20 -12

No files matched your search

@@ -251,23 +251,28 @@ public class ShopManager {
}
}
if (plugin.limit) {
int owned = 0;
for (HashMap<ShopChunk, HashMap<Location, Shop>> shopmap : getShops().values()) {
for (HashMap<Location, Shop> shopLocs : shopmap.values()) {
for (Shop shop : shopLocs.values()) {
if (shop.getOwner().equals(p.getUniqueId())&&shop.isUnlimited()) {
owned++;
if (!plugin.getConfig().getBoolean("limits.old-algorithm")) {
for (HashMap<ShopChunk, HashMap<Location, Shop>> shopmap : getShops().values()) {
for (HashMap<Location, Shop> shopLocs : shopmap.values()) {
for (Shop shop : shopLocs.values()) {
if (shop.getOwner().equals(p.getUniqueId())&&shop.isUnlimited()) {
owned++;
}
}
}
}
}else {
Iterator<Shop> it = getShopIterator();
while (it.hasNext()) {
if (it.next().getOwner().equals(p.getUniqueId())) {
owned++;
}
}
}
// Iterator<Shop> it = getShopIterator();
// while (it.hasNext()) {
// if (it.next().getOwner().equals(p.getUniqueId())) {
// owned++;
// }
// }
int max = plugin.getShopLimit(p);
if (owned + 1 > max) {
//p.sendMessage(ChatColor.RED + "You have already created a maximum of " + owned + "/" + max + " shops!");