-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...main/kotlin/net/horizonsend/ion/server/features/multiblock/type/DisplayNameMultilblock.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
package net.horizonsend.ion.server.features.multiblock.type | ||
|
||
import net.horizonsend.ion.common.utils.text.toComponent | ||
import net.horizonsend.ion.common.utils.text.wrap | ||
import net.horizonsend.ion.server.features.multiblock.Multiblock | ||
import net.horizonsend.ion.server.miscellaneous.utils.updateDisplayName | ||
import net.horizonsend.ion.server.miscellaneous.utils.updateLore | ||
import net.kyori.adventure.text.Component | ||
import org.bukkit.Material | ||
import org.bukkit.inventory.ItemStack | ||
|
||
interface DisplayNameMultilblock { | ||
val displayName: Component | ||
val description: Component | ||
|
||
// val iconModel: Key | ||
|
||
companion object { | ||
fun Multiblock.getDisplayName() = if (this is DisplayNameMultilblock) displayName else javaClass.simpleName.toComponent() | ||
|
||
fun Multiblock.getIcon(): ItemStack { | ||
val base = ItemStack(Material.CHEST) | ||
.updateDisplayName(getDisplayName()) | ||
|
||
return if (this is DisplayNameMultilblock) base | ||
// .updateData(DataComponentTypes.ITEM_MODEL, iconModel) | ||
.updateLore(description.wrap(150)) | ||
else | ||
base | ||
} | ||
} | ||
} |