mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2026-01-04 15:41:45 +00:00
Support for 1.19.3
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
package com.hibiscusmc.hmccosmetics.util;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.GameMode;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class ServerUtils {
|
||||
|
||||
private static String COLOR_CHAR = "&";
|
||||
|
||||
/**
|
||||
* Converts a bukkit gamemode into an integer for use in packets
|
||||
* @param gamemode Bukkit gamemode to convert.
|
||||
@@ -22,4 +28,15 @@ public class ServerUtils {
|
||||
public static org.bukkit.entity.Entity getEntity(int entityId) {
|
||||
return NMSHandlers.getHandler().getEntity(entityId);
|
||||
}
|
||||
|
||||
public static Color hex2Rgb(String colorStr) {
|
||||
try {
|
||||
return Color.fromRGB(
|
||||
Integer.valueOf(colorStr.substring(1, 3), 16),
|
||||
Integer.valueOf(colorStr.substring(3, 5), 16),
|
||||
Integer.valueOf(colorStr.substring(5, 7), 16));
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user