All (most ?) of the strings are not sent over the network anymore.

Everything is cached and synchronized.
This commit is contained in:
ProfMobius committed 2014-04-11 16:56:18 +02:00
1 parent f42d86ba11
commit 2f5d92f22a
7 files changed
+33 -26

No files matched your search

+10 -3
View File
@@ -47,15 +47,22 @@ public enum StringCache implements IMessageHandler {
}
public void syncCache(Player player){
// NEED TO AUTO SPLIT THE PACKET !
PacketDispatcher.sendPacketToPlayer(NetDataList.create(Message.STATUS_STRINGUPD_FULL, this.toSend).packet, player);
int i = 0;
while (i < this.toSend.size()){
PacketDispatcher.sendPacketToPlayer(NetDataList.create(Message.STATUS_STRINGUPD_FULL, this.toSend.subList(i, Math.min(i + 50, this.toSend.size()))).packet, player);
i += 50;
}
}
@Override
public boolean handleMessage(Message msg, NetDataRaw rawdata) {
switch(msg){
case STATUS_STRINGUPD:{
modOpis.log.info("Received String Cache update");
//modOpis.log.info("Received String Cache update");
DataStringUpdate data = (DataStringUpdate)rawdata.value;
this.cache.put(data.index, data.str);
break;