mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-28 12:55:34 +01:00
Improved performance of ItemStack merging (fix #385)
This commit is contained in:
parent
e0d65453b6
commit
d200616fe1
@ -457,15 +457,19 @@ public class Util extends Queue {
|
|||||||
try {
|
try {
|
||||||
int c1 = 0;
|
int c1 = 0;
|
||||||
for (ItemStack o1 : items) {
|
for (ItemStack o1 : items) {
|
||||||
|
if (o1 != null) {
|
||||||
|
if (o1.getAmount() != 0) {
|
||||||
int c2 = 0;
|
int c2 = 0;
|
||||||
for (ItemStack o2 : items) {
|
for (ItemStack o2 : items) {
|
||||||
if (o1 != null && o2 != null && c2 > c1 && o1.isSimilar(o2) && !Util.isAir(o1.getType())) { // Ignores amount
|
if (o2 != null && c2 > c1 && o1.isSimilar(o2) && !Util.isAir(o1.getType())) { // Ignores amount
|
||||||
int namount = o1.getAmount() + o2.getAmount();
|
int namount = o1.getAmount() + o2.getAmount();
|
||||||
o1.setAmount(namount);
|
o1.setAmount(namount);
|
||||||
o2.setAmount(0);
|
o2.setAmount(0);
|
||||||
}
|
}
|
||||||
c2++;
|
c2++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
c1++;
|
c1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user