title: While compiling Java+Scala project got java.lang.AssertionError: NoDenotation.owner
body: <p>That's my project on writing the Minecraft plugin using <strong>Scala</strong> as the main language, supported by <strong>Java</strong>. I'm using <strong>Gradle</strong> and some settings <em>to combine</em> <strong>Scala and Java</strong>.
  I've had a working prototype of one of the modules and then added some refactoring, that somehow called the exception. As far as I've researched, there are only 3 to 8 results on the search, related to the <strong>&quot;NoDenotation.owner&quot;</strong> exception. Now I have no idea how to resolve it and there are no comments on it on the StackOverflow as well.</p>
  <p>Here is my build.gradle file (I'll fix shadowing part later):</p>
  <pre><code>plugins {
      id 'java'
      id 'scala'
      id 'com.github.johnrengelman.shadow' version '7.1.2'
  }
  
  group = 'com.danikvitek'
  version = '1.0'
  
  sourceSets {
      main {
          scala.srcDirs = [&quot;$projectDir/src/main/mixed&quot;]
          resources.srcDirs = [&quot;$projectDir/src/main/resources&quot;]
      }
      test {
          scala.srcDirs = [&quot;$projectDir/src/test/mixed&quot;]
          resources.srcDirs = [&quot;$projectDir/src/test/resources&quot;]
      }
  }
  
  repositories {
      mavenCentral()
      maven {
          name = 'papermc-repo'
          url = 'https://papermc.io/repo/repository/maven-public/'
      }
      maven {
          name = 'sonatype'
          url = 'https://oss.sonatype.org/content/groups/public/'
      }
      maven {
          name = 'codemc-snapshots'
          url = 'https://repo.codemc.io/repository/maven-snapshots/'
      }
      maven { url &quot;https://repo.dmulloy2.net/repository/public/&quot; }
  }
  
  dependencies {
      implementation 'org.hibernate:hibernate-core:5.6.3.Final'
      implementation 'org.hibernate:hibernate-entitymanager:5.6.3.Final'
      implementation 'mysql:mysql-connector-java:8.0.25'
      implementation 'net.wesjd:anvilgui:1.5.3-SNAPSHOT'
      compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
  //    compileOnly group: &quot;com.comphenix.protocol&quot;, name: &quot;ProtocolLib&quot;, version: &quot;4.7.0&quot;;
      compileOnly group: 'org.scala-lang', name: 'scala3-library_3', version: '3.1.0'
      testImplementation group: 'org.scala-lang', name: 'scala3-library_3', version: '3.1.0'
  }
  
  jar {
      duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  }
  
  def targetJavaVersion = 16
  java {
      def javaVersion = JavaVersion.toVersion(targetJavaVersion)
      sourceCompatibility = javaVersion
      targetCompatibility = javaVersion
      if (JavaVersion.current() &lt; javaVersion) {
          toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
      }
  }
  
  tasks.withType(JavaCompile).configureEach {
      if (targetJavaVersion &gt;= 10 || JavaVersion.current().isJava10Compatible()) {
          options.release = targetJavaVersion
      }
  }
  
  processResources {
      def props = [version: version]
      inputs.properties props
      filteringCharset 'UTF-8'
      filesMatching('plugin.yml') {
          expand props
      }
  }
  </code></pre>
  <p>And here is the exception stacktrace:</p>
  <pre><code>## Exception when compiling 84 sources to D:\Desktop\Minecraft plugins\PoliticsCountryS\build\classes\scala\main
  java.lang.AssertionError: NoDenotation.owner
  dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2503)
  dotty.tools.dotc.typer.Typer.canAssign$1(Typer.scala:959)
  dotty.tools.dotc.typer.Typer.typedAssign(Typer.scala:996)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2762)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2936)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
  dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1027)
  dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1031)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2763)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
  dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$5(ProtoTypes.scala:431)
  dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:359)
  dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:432)
  dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
  dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:853)
  dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:544)
  dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
  dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
  dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:609)
  dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:447)
  dotty.tools.dotc.typer.Applications$TypedApply.&lt;init&gt;(Applications.scala:735)
  dotty.tools.dotc.typer.Applications$ApplyToUntyped.&lt;init&gt;(Applications.scala:852)
  dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1060)
  dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:317)
  dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:107)
  dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:907)
  dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:986)
  dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:3011)
  dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:997)
  dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1035)
  dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:317)
  dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:107)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2755)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
  dotty.tools.dotc.typer.Typer.typedParent$2(Typer.scala:2321)
  dotty.tools.dotc.typer.Typer.$anonfun$40(Typer.scala:2396)
  dotty.tools.dotc.core.Decorators$ListDecorator$.loop$1(Decorators.scala:92)
  dotty.tools.dotc.core.Decorators$ListDecorator$.mapconserve$extension(Decorators.scala:108)
  dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2396)
  dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2743)
  dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2747)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2817)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
  dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2909)
  dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2959)
  dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2532)
  dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2788)
  dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2818)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2883)
  dotty.tools.dotc.typer.Typer.typed(Typer.scala:2887)
  dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3003)
  dotty.tools.dotc.typer.TyperPhase.liftedTree1$1(TyperPhase.scala:56)
  dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:62)
  dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:411)
  dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:63)
  dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$1(TyperPhase.scala:105)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.collection.immutable.List.foreach(List.scala:333)
  dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:105)
  dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:261)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
  dotty.tools.dotc.Run.runPhases$5(Run.scala:272)
  dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
  scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
  dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
  dotty.tools.dotc.Run.compileUnits(Run.scala:289)
  dotty.tools.dotc.Run.compileSources(Run.scala:222)
  dotty.tools.dotc.Run.compile(Run.scala:206)
  dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
  dotty.tools.dotc.Driver.process(Driver.scala:199)
  dotty.tools.dotc.Main.process(Main.scala)
  xsbt.CachedCompilerImpl.run(CachedCompilerImpl.java:67)
  xsbt.CompilerInterface.run(CompilerInterface.java:59)
  java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.base/java.lang.reflect.Method.invoke(Method.java:568)
  sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:248)
  sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:122)
  sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:95)
  sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:91)
  scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
  sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:186)
  sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:82)
  sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3$adapted(MixedAnalyzingCompiler.scala:77)
  sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:215)
  sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:77)
  sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:146)
  sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:343)
  sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:343)
  sbt.internal.inc.Incremental$.doCompile(Incremental.scala:120)
  sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:100)
  sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:180)
  sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:98)
  sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:102)
  sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:155)
  sbt.internal.inc.Incremental$.compile(Incremental.scala:92)
  sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:75)
  sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:348)
  sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:301)
  sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:168)
  sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:248)
  sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:74)
  org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:157)
  org.gradle.api.internal.tasks.scala.ZincScalaCompilerFacade.execute(ZincScalaCompilerFacade.java:47)
  org.gradle.api.internal.tasks.scala.ZincScalaCompilerFacade.execute(ZincScalaCompilerFacade.java:32)
  org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
  org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
  org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
  org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
  org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
  org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
  org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
  org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
  org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:85)
  org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:55)
  org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
  org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
  org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
  java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  java.base/java.lang.reflect.Method.invoke(Method.java:568)
  org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
  org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
  org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
  org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
  org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
  org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
  org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
  java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:61)
  java.base/java.lang.Thread.run(Thread.java:833)
             
  </code></pre>
  <p>Here are the places, where the new code was added:</p>
  <p>PMenuCommand.scala:</p>
  <pre><code>package com.danikvitek.politicscountry.ui.command
  
  import com.danikvitek.politicscountry.ui.gui.prefab.PMenu
  import com.danikvitek.politicscountry.ui.gui.{Menu, MenuHandler}
  import com.danikvitek.politicscountry.utils.Translation
  import org.bukkit.{Bukkit, ChatColor}
  import org.bukkit.command.{Command, CommandSender, TabExecutor}
  import org.bukkit.entity.Player
  import org.bukkit.inventory.Inventory
  
  import java.util
  
  class PMenuCommand extends TabExecutor {
      override def onCommand(sender: CommandSender, command: Command,
                             alias: String, args: Array[String]): Boolean = {
          sender match {
              case player: Player =&gt;
                  if player hasPermission &quot;politicscountry.command.pmenu&quot; then {
                      val menu: Menu = new PMenu(player)
                      MenuHandler.openMenu(player, menu)
                  }
                  else
                      player sendMessage Translation.`you have no permission to use this command`
              case _ =&gt; sender sendMessage (ChatColor.RED.toString + &quot;You need to be a player to use this command&quot;)
          }
          true
      }
  
      override def onTabComplete(sender: CommandSender, command: Command,
                                 alias: String, args: Array[String]): util.List[String] = {
          new util.ArrayList[String]
      }
  }
  </code></pre>
  <p>PMenu.scala:</p>
  <pre><code>package com.danikvitek.politicscountry.ui.gui.prefab
  
  import com.danikvitek.politicscountry.ui.gui.{Button, Menu, MenuHandler}
  import com.danikvitek.politicscountry.utils.{ItemBuilder, Translation}
  import org.bukkit.{Bukkit, ChatColor, Material}
  import org.bukkit.event.inventory.InventoryClickEvent
  import org.bukkit.inventory.{Inventory, ItemStack}
  import com.danikvitek.politicscountry.api.controller.{FormationManager, ResidentManager}
  import com.danikvitek.politicscountry.RichPlayer
  import com.danikvitek.politicscountry.gameplay.residency.Resident
  import net.kyori.adventure.text.Component
  import net.wesjd.anvilgui.AnvilGUI
  import org.bukkit.entity.Player
  
  import scala.collection.mutable
  
  class PMenu(player: Player)
      extends DoubleChestMenu(Component.text(Translation.`pmenu inventory title`)) {
  
      private lazy val resident = player.toResident
  
      private lazy val statusButton = new Button(Material.RED_STAINED_GLASS_PANE, Translation.`status`) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = {
              event setCancelled true
  
              val statusMenu: Menu = new Status(resident)
  
              MenuHandler.closeMenu(player)
              MenuHandler.openMenu(player, statusMenu)
          }
      }
  
      private lazy val createFormationButton = new Button(Material.RED_STAINED_GLASS_PANE, Translation.`create formation`) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = {
              event setCancelled true
  
              var title: String = null
  
              new AnvilGUI.Builder()
                  .title(Translation.`create formation`)
                  .itemLeft(new ItemStack(Material.PAPER))
                  .text(Translation.`input formation title`)
                  .onClose { p =&gt;
                      MenuHandler.closeMenu(p)
                      p.performCommand(&quot;pmenu&quot;)
                  }
                  .onComplete { (p, t) =&gt;
                      title = t
                      AnvilGUI.Response.close()
                  }
                  .open(player)
  
              val chunk = player.getLocation.getChunk()
              FormationManager.create(title, chunk, resident)
          }
      }
  
      setButton(24, statusButton)
  
      if resident.feud.isEmpty then
          setButton(13, createFormationButton)
  }
  </code></pre>
  <p>SingleChestMenu.scala:</p>
  <pre><code>package com.danikvitek.politicscountry.ui.gui.prefab
  
  import com.danikvitek.politicscountry.ui.gui.{Button, Menu}
  import com.danikvitek.politicscountry.utils.Translation
  import net.kyori.adventure.text.Component
  import org.bukkit.{Bukkit, Material}
  import org.bukkit.event.inventory.InventoryClickEvent
  
  abstract class SingleChestMenu(title: Component)
      extends Menu(Bukkit.createInventory(null, 27, title)) {
  
      def this(title: String) = this(Component.text(title))
  
      for {
          slot &lt;- Seq(0, 1, 7, 8, 18, 19, 25, 26)
      } setButton(slot, new Button(Material.BLUE_STAINED_GLASS_PANE, &quot; &quot;) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = event setCancelled true
      })
  }
  </code></pre>
  <p>DoubleChestMenu.scala:</p>
  <pre><code>package com.danikvitek.politicscountry.ui.gui.prefab
  
  import com.danikvitek.politicscountry.ui.gui.{Button, Menu}
  import com.danikvitek.politicscountry.utils.Translation
  import net.kyori.adventure.text.Component
  import org.bukkit.event.inventory.InventoryClickEvent
  import org.bukkit.{Bukkit, Material}
  
  abstract class DoubleChestMenu(title: Component)
      extends Menu(Bukkit.createInventory(null, 54, title)) {
  
      def this(title: String) = this(Component text title)
  
      for {
          slot &lt;- Seq(0, 1, 2, 6, 7, 8, 9, 17, 36, 44, 45, 46, 47, 51, 52, 53)
      } setButton(slot, new Button(Material.BLUE_STAINED_GLASS_PANE, &quot; &quot;) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = event setCancelled true
      })
  }
  </code></pre>
  <p>Status.scala:</p>
  <pre><code>package com.danikvitek.politicscountry.ui.gui.prefab
  
  import com.danikvitek.politicscountry.gameplay.residency.Resident
  import com.danikvitek.politicscountry.ui.gui.{Button, Menu, MenuHandler}
  import com.danikvitek.politicscountry.utils.{ItemBuilder, Translation}
  import com.danikvitek.politicscountry.api.controller.ResidentManager
  import com.danikvitek.politicscountry.data.model.FormationType
  import net.kyori.adventure.text.Component
  import net.kyori.adventure.text.format.{NamedTextColor, TextColor}
  import net.kyori.adventure.util.RGBLike
  import org.bukkit.{Bukkit, ChatColor, Material}
  import org.bukkit.event.inventory.InventoryClickEvent
  
  class Status(resident: Resident) extends SingleChestMenu(Translation.`status`) {
  
      private val residentStatus = resident.getStatus
  
      setButton(11, new Button(
          new ItemBuilder(Material.RED_STAINED_GLASS_PANE)
              .setDisplayName(Translation.`status - resident role`)
              .addLore(Translation.`status - resident role map`(residentStatus._1))
              .build
      ) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = event setCancelled true
      })
  
      setButton(13, new Button(
          new ItemBuilder(Material.RED_STAINED_GLASS_PANE)
              .setDisplayName(Translation.`status - formation`)
              .setLore {
                  val feud = residentStatus._2
                  val commonwealth = residentStatus._3
                  val state = residentStatus._4
                  val alliance = residentStatus._5
  
                  var lore = List.empty[String]
                  feud foreach { f =&gt;
                      val typeName = f.typeName
                          .getOrElse(Translation.`status - formation type map`(FormationType.FEUD))
                      lore = lore :+
                          (Translation.`status - formation type color` + typeName + &quot;: &quot; + f.title)
                  }
                  commonwealth foreach { c =&gt;
                      val typeName = c.typeName
                          .getOrElse(Translation.`status - formation type map`(FormationType.COMMONWEALTH))
                      lore = lore :+
                          (Translation.`status - formation type color` + typeName + &quot;: &quot; + c.title)
                  }
                  state foreach { s =&gt;
                      val typeName = s.typeName
                          .getOrElse(Translation.`status - formation type map`(FormationType.STATE))
                      lore = lore :+
                          (Translation.`status - formation type color` + typeName + &quot;: &quot; + s.title)
                  }
                  alliance foreach { a =&gt;
                      val typeName = a.typeName
                          .getOrElse(Translation.`status - formation type map`(FormationType.ALLIANCE))
                      lore = lore :+
                          (Translation.`status - formation type color` + typeName + &quot;: &quot; + a.title)
                  }
                  if lore.sizeIs == 0 then lore = lore :+
                      (Translation.`status - formation type color` + Translation.`status - formation type nothing`)
  
                  lore
              }
              .build
      ) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = event setCancelled true
      })
  
      setButton(15, new Button(
          new ItemBuilder(Material.RED_STAINED_GLASS_PANE)
              .setDisplayName(Translation.`status - resident plots`)
              .setLore {
                  val distances = residentStatus._6
                      .toSeq
                      .map { rp =&gt;
                          val homePlotChunk = resident.feud.get.homePlot.chunk
                          math.hypot(homePlotChunk.getX - rp.chunk.getX, homePlotChunk.getZ - rp.chunk.getZ)
                      }
                  val chunks = residentStatus._6
                      .toSeq
                      .map(_.chunk)
                  var plotsList = (distances zip chunks)
                      .sortWith(_._1 &lt; _._1)
                      .map(_._2)
                      .map { chunk =&gt;
                          Translation.`status - resident plot color` + Translation.`status - plot at` +
                              s&quot; (${chunk.getX}, ${chunk.getZ})&quot;
                      }
  
                  if plotsList.sizeIs == 0 then plotsList = plotsList :+
                      (Translation.`status - resident plot color` + Translation.`status - no plots`)
  
                  plotsList
              }
              .build
      ) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = event setCancelled true
      })
  
      setButton(19, new Button(
          Material.YELLOW_STAINED_GLASS_PANE,
          Translation.`menu - back`
      ) {
          override def onClick(menu: Menu, event: InventoryClickEvent): Unit = {
              event setCancelled true
  
              val player = resident.player
              MenuHandler closeMenu player
              player performCommand &quot;pmenu&quot;
          }
      })
  }
  </code></pre>