Added utils class and changed features

This commit is contained in:
5vl 2022-04-06 22:34:02 +02:00
parent 2eec2367bd
commit c419963a41
No known key found for this signature in database
GPG Key ID: DA8938F22548E4D5
2 changed files with 20 additions and 1 deletions

View File

@ -20,7 +20,6 @@ class Main : JavaPlugin() {
- Staff mode (Invisibility, fly, items)
- Freeze (Command and freeze wand in staff mode)
- Open inventory (Command and wand in staff mode) with permission for being able to edit it
- Teleport to online players
- Knockback Stick (Extra, useful to check if the player has no kb)
- PlaceholderAPI support
*/

View File

@ -0,0 +1,20 @@
package me.fivevl.staff
import net.md_5.bungee.api.ChatColor
import java.util.regex.Pattern
object Utils {
@Suppress("deprecation")
fun hex(s: String): String {
var s2 = s
val pattern = Pattern.compile("#[a-fA-F0-9]{6}")
var match = pattern.matcher(s)
while (match.find()) {
val color = s.substring(match.start(), match.end())
s2 = s2.replace(color, ChatColor.of(color).toString() + "")
match = pattern.matcher(s2)
}
return ChatColor.translateAlternateColorCodes('&', s2)
}
}