forbid removing local player entity by id

This commit is contained in:
Moritz Zwerger 2023-12-10 01:25:39 +01:00
parent ba1affae6b
commit d83dac4f93
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 6 additions and 3 deletions

View File

@ -112,8 +112,11 @@ class WorldEntities : Iterable<Entity> {
lock.unlock() lock.unlock()
return return
} }
if (entity !is LocalPlayerEntity) { if (entity is LocalPlayerEntity) {
entities -= entity idEntityMap.put(entityId, entity)
lock.unlock()
return
} }
entityIdMap.removeInt(entity) entityIdMap.removeInt(entity)
val uuid = entityUUIDMap.remove(entity) val uuid = entityUUIDMap.remove(entity)

View File

@ -50,6 +50,6 @@ class EntityDestroyS2CP(buffer: PlayInByteBuffer) : PlayS2CPacket {
if (reducedLog) { if (reducedLog) {
return return
} }
Log.log(LogMessageType.NETWORK_IN, level = LogLevels.VERBOSE) { "Entity destroy (entityIds=$entityIds)" } Log.log(LogMessageType.NETWORK_IN, level = LogLevels.VERBOSE) { "Entity destroy (entityIds=${entityIds.contentToString()})" }
} }
} }