mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-21 04:32:28 +00:00
All (most ?) of the strings are not sent over the network anymore.
Everything is cached and synchronized.
This commit is contained in:
1 parent
f42d86ba11
commit
2f5d92f22a
7 files changed
+33
-26
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user