This commit is contained in:
DBotThePony 2024-01-13 12:02:37 +07:00
commit d9b18ddaa6
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -7,6 +7,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap
import it.unimi.dsi.fastutil.objects.ObjectArraySet
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
import it.unimi.dsi.fastutil.objects.Reference2IntArrayMap
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
@ -658,9 +659,18 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
veto.add(player)
recheckPlayer(player)
} else if (player !in veto) {
LOGGER.warn("$player got subscribed to ${ChunkPos(chunkPos)} multiple times without unsubscribing, forcefully resubscribing")
LOGGER.debug("{} got subscribed to {} without prior unsubscribing, forcefully resubscribing", player, ChunkPos(chunkPos))
player2ResubCount[player] = player2ResubCount.getInt(player) + 1
unsubscribe(player)
subscribe(player)
onceServer(20) {
val rem = player2ResubCount.removeInt(player)
if (rem > 0) {
LOGGER.warn("$player got subscribed to $rem chunks without prior unsubscribing, details in debug log")
}
}
}
}
@ -733,6 +743,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc
private val playerMap = WeakHashMap<ServerLevel, Long2ObjectOpenHashMap<ChunkSubscribers>>()
private val tickingMap = WeakHashMap<ServerLevel, WeakHashSet<ChunkSubscribers>>()
private val player2ResubCount = Reference2IntArrayMap<ServerPlayer>()
private val vec2Dir = Int2ObjectOpenHashMap<Direction>()
private val LOGGER = LogManager.getLogger()