mirror of
https://github.com/TotalFreedomMC/TFGuilds.git
synced 2024-12-22 07:55:03 +00:00
support for hex color codes
This commit is contained in:
parent
07308de38d
commit
66ff1fc2b5
5 changed files with 23 additions and 6 deletions
|
@ -39,7 +39,7 @@ public class DisbandGuildCommand implements CommandExecutor
|
|||
|
||||
if (args.length == 0)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Are you sure you want to delete your guild? Type 'CONFIRM' to continue.");
|
||||
player.sendMessage(ChatColor.RED + "Are you sure you want to delete your guild? Type '/disbandguild CONFIRM' or '/deleteguild CONFIRM' to continue.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ public class GuildTagCommand extends GBase implements CommandExecutor
|
|||
|
||||
tag = tag.replace("%tag%", guild);
|
||||
|
||||
GUtil.setTag(GUtil.color(tag) + " ", guild);
|
||||
player.sendMessage(ChatColor.GREEN + "Guild tag set to \"" + GUtil.color(tag) + ChatColor.GREEN + "\"");
|
||||
GUtil.setTag(GUtil.translateHexColorCodes(tag) + " ", guild);
|
||||
player.sendMessage(ChatColor.GREEN + "Guild tag set to \"" + GUtil.translateHexColorCodes(tag) + ChatColor.GREEN + "\"");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class LeaveGuildCommand extends GBase implements CommandExecutor
|
|||
|
||||
if (args.length == 0)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Are you sure you want to leave your guild? Type 'CONFIRM' to continue.");
|
||||
player.sendMessage(ChatColor.RED + "Are you sure you want to leave your guild? Type '/leaveguild CONFIRM' or '/guildleave CONFIRM' to continue.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ import java.util.Arrays;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class GUtil
|
||||
{
|
||||
|
@ -229,4 +231,19 @@ public class GUtil
|
|||
{
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
public static String translateHexColorCodes(String message)
|
||||
{
|
||||
Pattern pattern = Pattern.compile("&#[a-f0-9A-F]{6}");
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
|
||||
while (matcher.find())
|
||||
{
|
||||
String color = matcher.group().replace("&", "");
|
||||
message = message.replace("&" + color, net.md_5.bungee.api.ChatColor.of(color) + "");
|
||||
}
|
||||
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
return message;
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ commands:
|
|||
aliases: [gchat]
|
||||
disbandguild:
|
||||
description: Deletes your guild
|
||||
usage: /<command>
|
||||
usage: /<command> <confirm>
|
||||
aliases: [deleteguild]
|
||||
guildteleport:
|
||||
description: Teleport to other guild members
|
||||
|
@ -36,7 +36,7 @@ commands:
|
|||
aliases: [guildinvite]
|
||||
leaveguild:
|
||||
description: Leave your guild
|
||||
usage: /<command>
|
||||
usage: /<command> <confirm>
|
||||
aliases: [guildleave]
|
||||
guildkick:
|
||||
description: Kicks a player from the guild
|
||||
|
|
Loading…
Reference in a new issue