mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 18:11:52 +01:00
Fix rgb color codes getting stripped in some cases (#5076)
This commit is contained in:
parent
4ab3e20a0c
commit
ca4077b204
@ -29,6 +29,10 @@ dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
testLogging.showStandardStreams = true
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include (dependency('io.papermc:paperlib'))
|
||||
|
@ -226,12 +226,12 @@ public final class FormatUtil {
|
||||
final EnumSet<ChatColor> strip = EnumSet.complementOf(supported);
|
||||
|
||||
final boolean rgb = user.isAuthorized(permBase + ".rgb");
|
||||
if (!supported.isEmpty() || rgb) {
|
||||
message = replaceColor(message, supported, rgb);
|
||||
}
|
||||
if (!strip.isEmpty()) {
|
||||
message = stripColor(message, strip);
|
||||
}
|
||||
if (!supported.isEmpty() || rgb) {
|
||||
message = replaceColor(message, supported, rgb);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ public final class VersionUtil {
|
||||
if (!Bukkit.getName().equals("Essentials Fake Server")) {
|
||||
throw new IllegalArgumentException(string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||
}
|
||||
matcher = VERSION_PATTERN.matcher(v1_14_R01.toString());
|
||||
matcher = VERSION_PATTERN.matcher(v1_16_1_R01.toString());
|
||||
Preconditions.checkArgument(matcher.matches(), string + " is not in valid version format. e.g. 1.8.8-R0.1");
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,17 @@ public class FormatUtilTest {
|
||||
checkFormatPerms("§aT§Aest", "§aT§Aest", "color");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatHexColors() {
|
||||
checkFormatPerms("&#ffffff", "&#ffffff");
|
||||
checkFormatPerms("&#ffffff", "§x§f§f§f§f§f§f", "color", "rgb");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "color");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "white");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "black");
|
||||
checkFormatPerms("&#ff0000test", "§x§f§f§0§0§0§0test", "rgb", "black", "white");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFormatCategoryPerms() {
|
||||
checkFormatPerms("Test", "Test");
|
||||
|
Loading…
Reference in New Issue
Block a user