mirror of
https://github.com/5vl/Staff.git
synced 2025-05-24 10:56:59 +00:00
Added utils class and changed features
This commit is contained in:
parent
2eec2367bd
commit
c419963a41
@ -20,7 +20,6 @@ class Main : JavaPlugin() {
|
|||||||
- Staff mode (Invisibility, fly, items)
|
- Staff mode (Invisibility, fly, items)
|
||||||
- Freeze (Command and freeze wand in staff mode)
|
- Freeze (Command and freeze wand in staff mode)
|
||||||
- Open inventory (Command and wand in staff mode) with permission for being able to edit it
|
- 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)
|
- Knockback Stick (Extra, useful to check if the player has no kb)
|
||||||
- PlaceholderAPI support
|
- PlaceholderAPI support
|
||||||
*/
|
*/
|
||||||
|
20
src/main/java/me/fivevl/staff/Utils.kt
Normal file
20
src/main/java/me/fivevl/staff/Utils.kt
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user