Skip to content

Commit

Permalink
Merge branch 'master' into ver/1.20.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle.kts
#	src/main/java/com/github/mori01231/lifecore/util/MapUtil.kt
  • Loading branch information
acrylic-style committed Nov 9, 2024
2 parents 3d46ad9 + 6e3e052 commit edc0add
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = "net.azisaba"
version = "6.18.1+1.20.2"
version = "6.18.2+1.20.2"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/github/mori01231/lifecore/util/MapUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.bukkit.map.MapCanvas
import org.bukkit.map.MapRenderer
import org.bukkit.map.MapView
import org.bukkit.plugin.java.JavaPlugin
import java.util.Collections

object MapUtil {
private fun convertCanvasToSerializable(canvas: MapCanvas) =
Expand Down Expand Up @@ -56,7 +57,7 @@ object MapUtil {
return null
}

private val renderedMapViews = mutableListOf<Pair<Player, CraftMapView>>()
private val renderedMapViews = Collections.synchronizedList(mutableListOf<Pair<Player, CraftMapView>>())

fun initializeMapRenderer(player: Player, item: ItemStack) {
if (item.type != Material.FILLED_MAP) return
Expand All @@ -65,10 +66,10 @@ object MapUtil {
val hasRenderer = mapView.renderers.isNotEmpty()
if (hasRenderer && mapView.renderers[0] !is CraftMapRenderer) {
if (mapView is CraftMapView) {
if (renderedMapViews.contains(player to mapView)) return
renderedMapViews.add(player to mapView)
Bukkit.getScheduler().runTask(JavaPlugin.getPlugin(LifeCore::class.java), Runnable {
if (renderedMapViews.contains(player to mapView)) return@Runnable
mapView.render(player as CraftPlayer)
renderedMapViews.add(player to mapView)
})
}
return
Expand Down

0 comments on commit edc0add

Please sign in to comment.