Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
api(component): with フォーマットを追加 #56
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed Apr 1, 2021
1 parent 76def2b commit 097cc92
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ repositories {
}
dependencies {
api('com.github.sya-ri:EasySpigotAPI:2.2.3') {
api('com.github.sya-ri:EasySpigotAPI:2.2.4') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
Expand All @@ -214,7 +214,7 @@ repositories {
}

dependencies {
api("com.github.sya-ri:EasySpigotAPI:2.2.3") {
api("com.github.sya-ri:EasySpigotAPI:2.2.4") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
}
Expand All @@ -240,7 +240,7 @@ configurations {
}
dependencies {
shadowApi('com.github.sya-ri:EasySpigotAPI:2.2.3') {
shadowApi('com.github.sya-ri:EasySpigotAPI:2.2.4') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
Expand All @@ -265,7 +265,7 @@ repositories {
}

dependencies {
shadowApi("com.github.sya-ri:EasySpigotAPI:2.2.3") {
shadowApi("com.github.sya-ri:EasySpigotAPI:2.2.4") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

group = "com.github.sya-ri.spigot.api"
version = "2.2.3"
version = "2.2.4"

bukkit {
name = "EasySpigotAPI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import net.md_5.bungee.api.chat.hover.content.Text
import org.bukkit.Material
import org.bukkit.inventory.ItemStack

typealias BungeeChatColor = net.md_5.bungee.api.ChatColor

/**
* @see TextComponentBuilder
* @since 1.6.0
Expand All @@ -34,6 +36,33 @@ fun <T : BaseComponent> T.with(
clickEvent = click
}

/**
* フォーマットを変更する。
* @param color 文字色
* @param bold 太字
* @param italic 斜体
* @param underline 下線
* @param strike 取り消し線
* @param obfuscate 難読化
* @return [T]
* @since 2.2.3
*/
fun <T : BaseComponent> T.with(
color: BungeeChatColor? = getColor(),
bold: Boolean = isBold,
italic: Boolean = isItalic,
underline: Boolean = isUnderlined,
strike: Boolean = isStrikethrough,
obfuscate: Boolean = isObfuscated,
) = apply {
setColor(color)
isBold = bold
isItalic = italic
isUnderlined = underline
isStrikethrough = strike
isObfuscated = obfuscate
}

/**
* @param text 文字列
* @param hover [HoverEvent] default: null
Expand Down

0 comments on commit 097cc92

Please sign in to comment.