diff --git a/build.gradle.kts b/build.gradle.kts index ef889c9..d632a2f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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)) diff --git a/src/main/java/com/github/mori01231/lifecore/util/MapUtil.kt b/src/main/java/com/github/mori01231/lifecore/util/MapUtil.kt index 131f514..d3ab6d9 100644 --- a/src/main/java/com/github/mori01231/lifecore/util/MapUtil.kt +++ b/src/main/java/com/github/mori01231/lifecore/util/MapUtil.kt @@ -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) = @@ -56,7 +57,7 @@ object MapUtil { return null } - private val renderedMapViews = mutableListOf>() + private val renderedMapViews = Collections.synchronizedList(mutableListOf>()) fun initializeMapRenderer(player: Player, item: ItemStack) { if (item.type != Material.FILLED_MAP) return @@ -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