Skip to content

Commit

Permalink
Merge pull request #87 from Y2Kwastaken/main
Browse files Browse the repository at this point in the history
Beautify Chat Styling / Add Consistent Coloring
  • Loading branch information
mfnalex authored Feb 10, 2024
2 parents a37c1ca + da93e7a commit 0f323af
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.github.spigotbasics.core.messages
import com.github.spigotbasics.core.messages.tags.MessageTagProvider
import com.github.spigotbasics.core.messages.tags.TagResolverFactory
import com.github.spigotbasics.pipe.SerializedMiniMessage
import net.kyori.adventure.platform.bukkit.BukkitComponentSerializer
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.JoinConfiguration
import net.kyori.adventure.text.minimessage.MiniMessage
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import org.bukkit.command.CommandSender
import org.bukkit.entity.Player

Expand Down Expand Up @@ -175,7 +175,11 @@ data class Message(
private val miniMessage = MiniMessage.miniMessage()

private val legacyComponentSerializer =
BukkitComponentSerializer.legacy()
LegacyComponentSerializer
.builder()
.hexColors()
.useUnusualXRepeatedCharacterHexFormat() // They are not unusual (+1)
.build()

private val bungeeComponentSerializer = BungeeComponentSerializer.get()
}
Expand Down
27 changes: 21 additions & 6 deletions core/src/main/resources/custom-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,35 @@
# This example lets you use <player-dm> to insert a clickable version of a player's name
player-dm:
type: parsed
value: "<gold><click:suggest_command:/msg <player-name> ><hover:show_text:Message <player-name>><player-display-name></hover></click></gold>"
value: "<click:suggest_command:/msg <player-name> ><hover:show_text:'Message <player-name>'><lite_text><player-display-name></lite_text></hover></click>"

# Player name with gold color
player-name-gold:
player-name-colored:
type: parsed
value: "<gold><player-name></gold>"
value: "<important_word><player-name></important_word>"

error:
type: parsed
value: "<color:#ff2222>Error: </color>"
value: "<error_red>Error: </error_red>"

bright_green:
type: color
value: "#CCFFCC"

lite_text:
type: color
value: "#DCE7EA"
negative_text:
type: color
value: "#3A97B7"
dark_text:
type: color
value: "#23739C"
def_text:
type: color
value: "#68CDE1"
error_red:
type: color
value: "#FF2222"
bright_red:
type: color
value: "#FF8888"
value: "#FF8888"
12 changes: 6 additions & 6 deletions modules/basics-announcements/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ interval: 2 minutes
pick-random: true
show-in-console: true
messages:
- "<i><gradient:#00ff00:#00cc00>\"OMG YOU'RE USING BASICS???!!!\"</gradient></i> Basics makes players wet since 2024!"
- "<rainbow>Check out the Basics repo on <click:open_url:https://github.com/SpigotBasics/basics><hover:show_text:'Click to visit GitHub'><red>GitHub</red></hover>!</rainbow>"
- "\"With <bold>Basics</bold>, server management has never been this simple. Say goodbye to headaches and hello to a smooth gaming experience!\"\n- CMarco (AI)"
- "<gradient:#ff0000:#cc0000>\"Basics is the best plugin ever!\"</gradient>\n- <gradient:#0000ff:#0000cc>mfnalex</gradient>"
- "<gray>(You can customize these messages in the basics-announcements module)</gray>"
- "<green2>If you got PlaceholderAPI installed, you can use any placeholder: <papi:%server_tps%></green2>"
- "<lite_text>Welcome</lite_text><def_text>, to the Basics plugin! We have worked hard we hope you enjoy the plugin!</def_text>"
- "<lite_text>Did you know?</lite_text> <def_text>You can check out the basics repo on <click:open_url:https://github.com/SpigotBasics/basics><hover:show_text:'<dark_text>Click to visit GitHub'><dark_text>GitHub</dark_text></hover></def_text>"
- "<def_text>\"With <bold>Basics</bold>, server management has never been this <lite_text>simple</lite_text>. Say goodbye to headaches and hello to a smooth gaming experience!\"\n- CMarco (AI)</def_text>"
- "<def_text>You can customize these messages in the basics-announcements module</def_text>"
- "<def_text>If you have PlaceholderAPI installed, you can use any placeholder! <papi:%server_tps%></def_text>"
- "<def_text>Basics utilizes <click:open_url:https://docs.advntr.dev/minimessage/index.html><hover:show_text:'<def_text>Click to see the MiniMessage Documentation</def_text>'>MiniMessage!</hover></click></def_text>"
2 changes: 1 addition & 1 deletion modules/basics-chat-format/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Tags: <#message>
chat-format: "<player-dm> <gray>»<reset> <#message>"
chat-format: "<player-dm> <dark_text>»<reset> <#message>"
7 changes: 4 additions & 3 deletions modules/basics-enchant/src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
enchanted-self: "<green>Enchanted your <bright_green><#item></bright_green> with <bright_green><#enchantment> <#roman-level></bright_green>!"
enchanted-others: "<green>Enchanted <gold><player-name></gold><player-name-genitive-suffix> <bright_green><#item></bright_green> with <bright_green><#enchantment> <#roman-level></bright_green>!"
removed-self: "<red>Removed <bright_red><#enchantment></bright_red> from your <bright_green><#item></bright_green>!"
# Tags: <#item>
enchanted-self: "<def_text>Enchanted your <lite_text><#item></lite_text> with <lite_text><#enchantment> <#roman-level></lite_text>!</def_text>"
enchanted-others: "<def_text>Enchanted <player-name-colored><player-name-genitive-suffix> <lite_text><#item></lite_text> with <lite_text><#enchantment> <#roman-level></lite_text>!</def_text>"
removed-self: "<dark_text>Removed <dark_text><#enchantment></dark_text> from your <dark_text><#item></dark_text>!"
6 changes: 3 additions & 3 deletions modules/basics-gamemode/src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Tags: <#new-gamemode>
gamemode-changed-others: "<gray>Set <player-dm><player-name-genitive-suffix> game mode to <yellow><#new-gamemode></yellow>."
gamemode-changed-self: "<gray>Set <gold>your</gold> game mode to <yellow><#new-gamemode></yellow>."
gamemode-changed-others: "<def_text>Set <player-dm><player-name-genitive-suffix> game mode to <lite_text><#new-gamemode></lite_text>."
gamemode-changed-self: "<def_text>Set <lite_text>your</lite_text> game mode to <lite_text><#new-gamemode></lite_text>."

survival: "<gradient:#00AA00:#00FF00>survival</gradient>"
creative: "<gradient:#5555FF:#87BEDB>creative</gradient>"
adventure: "<gradient:#FF8C00:#FFD700>adventure</gradient>"
spectator: "<gradient:#A9A9A9:#D3D3D3>spectator</gradient>"
spectator: "<gradient:#A9A9A9:#D3D3D3>spectator</gradient>"
24 changes: 12 additions & 12 deletions modules/basics-homes/src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# TODO: Add some system to auto-apply all home-related placeholders, not just name
# Tags: <#home> // later / TODO: <#limit> <#regex> <#name> <#homes> <#x> <#y> <#z> <#world>
home-set: "<green>Set home <bright_green><#home></bright_green> to your current location.</green>"
home-deleted: "<green>Deleted home <bright_red><#home></bright_red>.</green>"
home-teleported: "<green>Teleported to home <bright_green><#home></bright_green>.</green>"
home-not-found: "<error><red>Home <bright_red><#home></bright_red> not found.</red>"
home-set: "<def_text>Set home <lite_text><#home></lite_text> to your current location.</def_text>"
home-deleted: "<dark_text>Deleted home <lite_text><#home></lite_text>.</dark_text>"
home-teleported: "<def_text>Teleported to home <lite_text><#home></lite_text>.</def_text>"
home-not-found: "<error><error_red>Home <bright_red><#home></bright_red> not found.</error_red>"

home-none-set: "<error><red>You don't have any homes set.</red>"
home-none-set: "<error><error_red>You don't have any homes set.</error_red>"

# Tags: <#limit>
home-limit-reached: "<error><red>You cannot set more than <bright_red><#limit></bright_red> homes.</red>"
home-limit-reached: "<error><error_red>You cannot set more than <bright_red><#limit></bright_red> homes.</error_red>"

# Tags: <#world> // TODO: Move to core messages
home-world-not-loaded: "<error><red>World <bright_red><#world></bright_red> is not loaded.</red>"
home-world-not-loaded: "<error><error_red>World <bright_red><#world></bright_red> is not loaded.</error_red>"

# Tags: <#regex>
home-invalid-name: "<error><red>Invalid home name. Home names must match the following regex: <bright_red><#regex></bright_red></red>"
home-invalid-name: "<error><error_red>Invalid home name. Home names must match the following regex: <bright_red><#regex></bright_red></error_red>"

# Tags: <#homes> (= home-list-entry + home-list-separator)
home-list:
- "<green>Available homes <gray>(Click to teleport)</gray>:</green>"
- "<#homes>"
- "<def_text>Available homes <lite_text>(Click to teleport)</lite_text>:</def_text>"
- " <#homes>"

# Tags: <#name> <#x> <#y> <#z> <#world>
home-list-entry: "<hover:show_text:'<gold><#home></gold>\nX: <gold><#x></gold> <gray>|</gray> Y: <gold><#y></gold> <gray>|</gray> Z: <gold><#z></gold> <gray>|</gray> <gold><#world></gold>\n<color:#994499>Click to teleport</color>'><gold><click:run_command:'/home <#home>'><#home></click></gold></hover>"
home-list-separator: "<gray>, </gray>"
home-list-entry: "<hover:show_text:'<lite_text><#home></lite_text>\nX: <lite_text><#x></lite_text> <dark_text>|</dark_text> Y: <lite_text><#y></lite_text> <dark_text>|</dark_text> Z: <lite_text><#z></lite_text> <dark_text>|</dark_text> <lite_text><#world></lite_text>\n<dark_text>Click to teleport</dark_text>'><lite_text><click:run_command:'/home <#home>'><#home></click></lite_text></hover>"
home-list-separator: "<dark_text>, </dark_text>"
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
## Quit message shown to console
#quit-console: "<red- <yellow>%player_name% left the game"

join: "<green>+ <gold><player-dm></gold> <gradient:dark_green:green>joined the game</gradient>"
quit: "<red>- <gold><player-name></gold> <gradient:red:dark_red>left the game</gradient>"
join: "<dark_text>+ <player-dm> <gradient:dark_green:green>joined the game</gradient>"
quit: "<negative_text>-</negative_text> <dark_text><player-name></dark_text> <gradient:red:dark_red>left the game</gradient>"
8 changes: 4 additions & 4 deletions modules/basics-msg/src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tags: <#message>
format-received: "<gray>[ <gold><player-dm></gold> » <gray>you</gray> ]</gray><reset> <#cdcdcd><#message>"
format-sent: "<gray>[ <gray>you</gray> » <gold><player-dm></gold> ]</gray><reset> <#cdcdcd><#message>"
format-self: "<gray>[ you » yourself ]</gray><reset> <#cdcdcd><#message>"
format-console: "<gray>[ <red>Console</red> » you ]</gray><reset> <#cdcdcd><#message>"
format-received: "<dark_text>[ <negative_text><player-dm></negative_text> » <negative_text>You</negative_text> ]</dark_text><reset> <negative_text><#message>"
format-sent: "<dark_text>[ <negative_text>You</negative_text> » <negative_text><player-dm></negative_text> ]</dark_text><reset> <negative_text><#message>"
format-self: "<dark_text>[ <negative_text>You » Yourself</negative_text> ]</dark_text><reset> <negative_text><#message>"
format-console: "<dark_text>[ <red>Console</red> » you ]</dark_text><reset> <negative_text><#message>"
8 changes: 4 additions & 4 deletions modules/basics-repair/src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Repair message sent to you when repairing another player's hand
repair-hand-other: "<green>Repaired <gold><player-dm><player-name-genitive-suffix></gold> hand"
repair-hand-other: "<def_text>Repaired <lite_text><player-dm><player-name-genitive-suffix></lite_text> hand"

# Repair message sent when you repair your own hand
repair-hand-self: "<green>Repaired <gold>your</gold> hand"
repair-hand-self: "<def_text>Repaired <lite_text>your</lite_text> hand"

# Repair message sent when you repair another player's inventory
repair-all-other: "<green>Repaired <gold><player-dm><player-name-genitive-suffix></gold> inventory"
repair-all-other: "<def_text>Repaired <lite_text><player-dm><player-name-genitive-suffix></lite_text> inventory"

# Repair message sent when you repair your own inventory
repair-all-self: "<green>Repaired <gold>your</gold> inventory"
repair-all-self: "<def_text>Repaired <lite_text>your</lite_text> inventory"
8 changes: 4 additions & 4 deletions modules/basics-world/src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tags: <#world>
world-teleported: "<green>Teleported to world <bright_green><#world></bright_green>!</green>"
already-in-world: "<gray>You are already in world <bright_green><#world></bright_green>!</gray>"
starting-teleport: "<gray>Teleporting to world <bright_green><#world></bright_green> ...</gray>"
teleport-unsuccessful: "<red>Teleportation to world <bright_red><#world></bright_red> was unsuccessful!</red>"
world-teleported: "<def_text>Teleported to world <lite_text><#world></lite_text>!</def_text>"
already-in-world: "<dark_text>You are already in world <lite_text><#world></lite_text>!</dark_text>"
starting-teleport: "<dark_text>Teleporting to world <lite_text><#world></lite_text> ...</dark_text>"
teleport-unsuccessful: "<error_red>Teleportation to world <bright_red><#world></bright_red> was unsuccessful!</error_red>"

0 comments on commit 0f323af

Please sign in to comment.