Removed stream usage from RequestCollectionRegister clientpacket.

This commit is contained in:
MobiusDevelopment
2023-01-08 12:19:27 +00:00
parent 65e4bffeb0
commit 7c8a32d266
6 changed files with 94 additions and 10 deletions

View File

@@ -91,7 +91,15 @@ public class RequestCollectionRegister implements ClientPacket
player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index)); player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index));
if (player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).count() == collection.getCompleteCount()) int completeCount = 0;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
completeCount++;
}
}
if (completeCount == collection.getCompleteCount())
{ {
player.sendPacket(new ExCollectionComplete(_collectionId)); player.sendPacket(new ExCollectionComplete(_collectionId));

View File

@@ -88,7 +88,16 @@ public class RequestCollectionRegister implements ClientPacket
return; return;
} }
PlayerCollectionData currentColl = player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).findAny().orElse(null); PlayerCollectionData currentColl = null;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
currentColl = coll;
break;
}
}
if ((currentColl != null) && (currentColl.getIndex() == _index)) if ((currentColl != null) && (currentColl.getIndex() == _index))
{ {
player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel()))); player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel())));
@@ -103,7 +112,15 @@ public class RequestCollectionRegister implements ClientPacket
player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index)); player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index));
if (player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).count() == collection.getCompleteCount()) int completeCount = 0;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
completeCount++;
}
}
if (completeCount == collection.getCompleteCount())
{ {
player.sendPacket(new ExCollectionComplete(_collectionId)); player.sendPacket(new ExCollectionComplete(_collectionId));

View File

@@ -88,7 +88,16 @@ public class RequestCollectionRegister implements ClientPacket
return; return;
} }
PlayerCollectionData currentColl = player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).findAny().orElse(null); PlayerCollectionData currentColl = null;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
currentColl = coll;
break;
}
}
if ((currentColl != null) && (currentColl.getIndex() == _index)) if ((currentColl != null) && (currentColl.getIndex() == _index))
{ {
player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel()))); player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel())));
@@ -103,7 +112,15 @@ public class RequestCollectionRegister implements ClientPacket
player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index)); player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index));
if (player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).count() == collection.getCompleteCount()) int completeCount = 0;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
completeCount++;
}
}
if (completeCount == collection.getCompleteCount())
{ {
player.sendPacket(new ExCollectionComplete(_collectionId)); player.sendPacket(new ExCollectionComplete(_collectionId));

View File

@@ -91,7 +91,15 @@ public class RequestCollectionRegister implements ClientPacket
player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index)); player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index));
if (player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).count() == collection.getCompleteCount()) int completeCount = 0;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
completeCount++;
}
}
if (completeCount == collection.getCompleteCount())
{ {
player.sendPacket(new ExCollectionComplete(_collectionId)); player.sendPacket(new ExCollectionComplete(_collectionId));

View File

@@ -88,7 +88,16 @@ public class RequestCollectionRegister implements ClientPacket
return; return;
} }
PlayerCollectionData currentColl = player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).findAny().orElse(null); PlayerCollectionData currentColl = null;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
currentColl = coll;
break;
}
}
if ((currentColl != null) && (currentColl.getIndex() == _index)) if ((currentColl != null) && (currentColl.getIndex() == _index))
{ {
player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel()))); player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel())));
@@ -103,7 +112,15 @@ public class RequestCollectionRegister implements ClientPacket
player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index)); player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index));
if (player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).count() == collection.getCompleteCount()) int completeCount = 0;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
completeCount++;
}
}
if (completeCount == collection.getCompleteCount())
{ {
player.sendPacket(new ExCollectionComplete(_collectionId)); player.sendPacket(new ExCollectionComplete(_collectionId));

View File

@@ -88,7 +88,16 @@ public class RequestCollectionRegister implements ClientPacket
return; return;
} }
PlayerCollectionData currentColl = player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).findAny().orElse(null); PlayerCollectionData currentColl = null;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
currentColl = coll;
break;
}
}
if ((currentColl != null) && (currentColl.getIndex() == _index)) if ((currentColl != null) && (currentColl.getIndex() == _index))
{ {
player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel()))); player.sendPacket(new ExCollectionRegister(false, _collectionId, _index, new ItemEnchantHolder(item.getId(), count, item.getEnchantLevel())));
@@ -103,7 +112,15 @@ public class RequestCollectionRegister implements ClientPacket
player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index)); player.getCollections().add(new PlayerCollectionData(_collectionId, item.getId(), _index));
if (player.getCollections().stream().filter(it -> it.getCollectionId() == _collectionId).count() == collection.getCompleteCount()) int completeCount = 0;
for (PlayerCollectionData coll : player.getCollections())
{
if (coll.getCollectionId() == _collectionId)
{
completeCount++;
}
}
if (completeCount == collection.getCompleteCount())
{ {
player.sendPacket(new ExCollectionComplete(_collectionId)); player.sendPacket(new ExCollectionComplete(_collectionId));