Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Make InventoryDecorator extend IndexedSeq[Int] to allow sugared itera…
Browse files Browse the repository at this point in the history
…tion

Signed-off-by: Iltotore <rafbodaha@gmail.com>
  • Loading branch information
Iltotore committed Aug 1, 2020
1 parent 15a764a commit 7100eba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions build.gradle
Expand Up @@ -57,6 +57,15 @@ shadowJar {
archiveClassifier = ''
}

spigot {
desc {
main 'io.github.iltotore.scala.spigot.Plugin'
load 'STARTUP'
}
}

processResources.finalizedBy(spigotPlugin)

publishing {
publications {
mavenScala(MavenPublication) {
Expand Down
Expand Up @@ -31,7 +31,7 @@ object Implicits {
def color(char: Char = '&'): String = ChatColor.translateAlternateColorCodes(char, base)
}

implicit class InventoryDecorator(base: Inventory) {
implicit class InventoryDecorator(base: Inventory) extends IndexedSeq[Int] {

/**
* Operator alias of Inventory#addItem
Expand Down Expand Up @@ -191,13 +191,15 @@ object Implicits {

/**
* Get the score of an entry for the wrapped Objective as Int.
*
* @param entry the entry to get score of.
* @return the score of the given entry for the wrapped Objective.
*/
def apply(entry: String): Int = base.getScore(entry).getScore

/**
* Set the score of an entry for the wrapped Objective.
*
* @param entry the entry to set score of.
* @param score the new score.
*/
Expand Down

0 comments on commit 7100eba

Please sign in to comment.