File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
bukkit/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/entityculling Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -106,16 +106,19 @@ class UserCullData(
106106
107107 private fun updateChanges () {
108108 if (terminated) return
109- if (pendingChanges.isEmpty()) return
110109
111- val list = pendingChanges.toList()
112- pendingChanges.clear()
110+ val changes = synchronized(hiddenEntities) {
111+ if (pendingChanges.isEmpty()) return
112+ val temp = pendingChanges.toTypedArray()
113+ pendingChanges.clear()
114+ temp
115+ }
113116 if (plugin.isEnabled) {
114117 if (! player.connected)
115118 Bukkit .getPlayer(player.uniqueId)?.let { player = it }
116119 Scheduler .schedule(player) {
117120 val raytraceHandler = raytraceHandler
118- for (change in list ) {
121+ for (change in changes ) {
119122 if (! raytraceHandler.isValid(change.entity)) continue
120123 if (! change.entity.checkTickThread()) {
121124 // Not on tick thread, we can only reflect to make changes,
You can’t perform that action at this time.
0 commit comments