diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt index 7ba17a8fc..5f88105b4 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/MatteryBlockEntity.kt @@ -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 @@ -662,9 +663,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") + } + } } } @@ -737,6 +747,7 @@ abstract class MatteryBlockEntity(p_155228_: BlockEntityType<*>, p_155229_: Bloc private val playerMap = WeakHashMap>() private val tickingMap = WeakHashMap>() + private val player2ResubCount = Reference2IntArrayMap() private val vec2Dir = Int2ObjectOpenHashMap() private val LOGGER = LogManager.getLogger()