mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
Lets support Hex color codes in titles
This commit is contained in:
parent
6dc5fb9ba1
commit
dc85541107
@ -522,7 +522,6 @@ public class CMIChatColor {
|
||||
if (or.contains(colorCodePrefix)) {
|
||||
Matcher match = hexColorRegexPatternLast.matcher(or);
|
||||
if (match.find()) {
|
||||
|
||||
return new CMIChatColor(match.group(2));
|
||||
}
|
||||
match = hexColorNamePatternLast.matcher(or);
|
||||
|
@ -25,6 +25,7 @@ import com.gamingmesh.jobs.container.JobInfo;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.Title;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.PageInfo;
|
||||
import com.gamingmesh.jobs.stuff.Sorting;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
@ -81,7 +82,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
if (!hasCommandPermission(sender, cmd)) {
|
||||
if (sender instanceof Player) {
|
||||
new RawMessage().addText(Jobs.getLanguage().getMessage("general.error.permission"))
|
||||
.addHover("&2" + label + ".command." + cmd).show(sender);
|
||||
.addHover("&2" + label + ".command." + cmd).show(sender);
|
||||
} else
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
|
||||
return true;
|
||||
@ -199,7 +200,6 @@ public class JobsCommands implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static Class<?> getClass(String cmd) {
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.PlayerManager.BoostOf;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.RawMessage;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
@ -12,7 +13,6 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
public class bonus implements Cmd {
|
||||
|
||||
@ -75,7 +75,7 @@ public class bonus implements Cmd {
|
||||
}
|
||||
|
||||
private static void printBoost(CommandSender sender, Boost boost, BoostOf type) {
|
||||
String prefix = ChatColor.GOLD + "*";
|
||||
String prefix = CMIChatColor.GOLD + "*";
|
||||
if (type != BoostOf.NearSpawner && type != BoostOf.PetPay)
|
||||
prefix = "";
|
||||
|
||||
|
@ -7,11 +7,11 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.RawMessage;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.PageInfo;
|
||||
|
||||
public class browse implements Cmd {
|
||||
@ -201,7 +201,7 @@ public class browse implements Cmd {
|
||||
builder.append(job.getChatColor().toString());
|
||||
builder.append(job.getName());
|
||||
if (job.getMaxLevel(sender) > 0) {
|
||||
builder.append(ChatColor.WHITE.toString());
|
||||
builder.append(CMIChatColor.WHITE.toString());
|
||||
builder.append(Jobs.getLanguage().getMessage("command.info.help.max"));
|
||||
builder.append(job.getMaxLevel(sender));
|
||||
}
|
||||
|
@ -5,11 +5,11 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
public class demote implements Cmd {
|
||||
|
||||
@ -42,7 +42,7 @@ public class demote implements Cmd {
|
||||
Player player = Bukkit.getServer().getPlayer(jPlayer.getUniqueId());
|
||||
if (player != null) {
|
||||
String message = Jobs.getLanguage().getMessage("command.demote.output.target",
|
||||
"%jobname%", job.getNameWithColor() + ChatColor.WHITE,
|
||||
"%jobname%", job.getNameWithColor() + CMIChatColor.WHITE,
|
||||
"%levelslost%", levelsLost);
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gamingmesh.jobs.ItemBoostManager;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.CMIReflections;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
@ -15,7 +16,6 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
public class edititembonus implements Cmd {
|
||||
|
||||
@ -103,9 +103,9 @@ public class edititembonus implements Cmd {
|
||||
|
||||
BoostMultiplier boost = item.getBoost();
|
||||
|
||||
String mc = ChatColor.DARK_GREEN.toString(),
|
||||
pc = ChatColor.GOLD.toString(),
|
||||
ec = ChatColor.YELLOW.toString();
|
||||
String mc = CMIChatColor.DARK_GREEN.toString(),
|
||||
pc = CMIChatColor.GOLD.toString(),
|
||||
ec = CMIChatColor.YELLOW.toString();
|
||||
|
||||
for (Job one : item.getJobs()) {
|
||||
String msg = Jobs.getLanguage().getMessage("command.itembonus.output.list",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||
import com.gamingmesh.jobs.CMILib.RawMessage;
|
||||
|
||||
@ -68,9 +68,9 @@ public class itembonus implements Cmd {
|
||||
if (!any)
|
||||
continue;
|
||||
|
||||
String mc = ChatColor.DARK_GREEN.toString(),
|
||||
pc = ChatColor.GOLD.toString(),
|
||||
ec = ChatColor.YELLOW.toString(),
|
||||
String mc = CMIChatColor.DARK_GREEN.toString(),
|
||||
pc = CMIChatColor.GOLD.toString(),
|
||||
ec = CMIChatColor.YELLOW.toString(),
|
||||
msg = null;
|
||||
|
||||
if (jPlayer.isInJob(one))
|
||||
|
@ -61,8 +61,8 @@ public class limit implements Cmd {
|
||||
continue;
|
||||
}
|
||||
if (limit.GetLeftTime(type) > 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(limit.GetLeftTime(type))));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(limit.GetLeftTime(type))));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
||||
"%current%", (int) (limit.GetAmount(type) * 100) / 100D,
|
||||
"%total%", JPlayer.getLimit(type)));
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import com.gamingmesh.jobs.ItemBoostManager;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.*;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
@ -450,22 +449,22 @@ public class ConfigManager {
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (actionType == ActionType.STRIPLOGS && Version.isCurrentLower(Version.v1_13_R1))
|
||||
return null;
|
||||
if (actionType == ActionType.STRIPLOGS && Version.isCurrentLower(Version.v1_13_R1))
|
||||
return null;
|
||||
|
||||
if (material != null && material.getMaterial() != null && material.isAir()) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " " + actionType.getName() + " can't recognize material! (" + myKey + ")");
|
||||
return null;
|
||||
}
|
||||
if (material != null && material.getMaterial() != null && material.isAir()) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " " + actionType.getName() + " can't recognize material! (" + myKey + ")");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (material != null && Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty())
|
||||
meta = String.valueOf(material.getData());
|
||||
if (material != null && Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty())
|
||||
meta = String.valueOf(material.getData());
|
||||
|
||||
c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) {
|
||||
c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) {
|
||||
// Need to include those ones and count as regular blocks
|
||||
switch (myKey.replace("_", "").toLowerCase()) {
|
||||
case "itemframe":
|
||||
@ -490,9 +489,9 @@ public class ConfigManager {
|
||||
// Break and Place actions MUST be blocks
|
||||
if (actionType == ActionType.BREAK || actionType == ActionType.PLACE || actionType == ActionType.STRIPLOGS) {
|
||||
if (!material.isBlock()) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " has an invalid " + actionType.getName() + " type property: " + material
|
||||
+ " (" + myKey + ")! Material must be a block! Use \"/jobs blockinfo\" on a target block");
|
||||
return null;
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " has an invalid " + actionType.getName() + " type property: " + material
|
||||
+ " (" + myKey + ")! Material must be a block! Use \"/jobs blockinfo\" on a target block");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,7 +521,7 @@ public class ConfigManager {
|
||||
|
||||
type = material.getMaterial().toString();
|
||||
id = material.getId();
|
||||
} else if (actionType == ActionType.KILL || actionType == ActionType.TAME || actionType == ActionType.BREED || actionType == ActionType.MILK) {
|
||||
} else if (actionType == ActionType.KILL || actionType == ActionType.TAME || actionType == ActionType.BREED || actionType == ActionType.MILK) {
|
||||
// check entities
|
||||
CMIEntityType entity = CMIEntityType.getByName(myKey);
|
||||
|
||||
@ -540,8 +539,8 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
// Pre 1.13 checks for custom names
|
||||
if (entity == null) {
|
||||
// Pre 1.13 checks for custom names
|
||||
if (entity == null) {
|
||||
switch (myKey.toLowerCase()) {
|
||||
case "skeletonwither":
|
||||
type = CMIEntityType.WITHER_SKELETON.name();
|
||||
@ -741,16 +740,16 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
ChatColor color = ChatColor.WHITE;
|
||||
CMIChatColor color = CMIChatColor.WHITE;
|
||||
if (jobSection.contains("ChatColour")) {
|
||||
String c = jobSection.getString("ChatColour", "");
|
||||
|
||||
color = ChatColor.matchColor(c);
|
||||
color = CMIChatColor.getColor(c);
|
||||
if (color == null && !c.isEmpty())
|
||||
color = ChatColor.matchColor(c.charAt(0));
|
||||
color = CMIChatColor.getColor(String.valueOf("&" + c.charAt(0)));
|
||||
|
||||
if (color == null) {
|
||||
color = ChatColor.WHITE;
|
||||
color = CMIChatColor.WHITE;
|
||||
log.warning("Job " + jobKey + " has an invalid ChatColour property. Defaulting to WHITE!");
|
||||
}
|
||||
}
|
||||
@ -872,24 +871,24 @@ public class ConfigManager {
|
||||
} else
|
||||
log.warning("Job " + jobKey + " has an invalid Gui property. Please fix this if you want to use it!");
|
||||
|
||||
if (guiSection.isList("Enchantments")) {
|
||||
for (String str4 : guiSection.getStringList("Enchantments")) {
|
||||
String[] id = str4.split(":");
|
||||
if (GUIitem.getItemMeta() instanceof EnchantmentStorageMeta) {
|
||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
||||
enchantMeta.addStoredEnchant(CMIEnchantment.getEnchantment(id[0]), Integer.parseInt(id[1]), true);
|
||||
GUIitem.setItemMeta(enchantMeta);
|
||||
} else
|
||||
GUIitem.addUnsafeEnchantment(CMIEnchantment.getEnchantment(id[0]), Integer.parseInt(id[1]));
|
||||
if (guiSection.isList("Enchantments")) {
|
||||
for (String str4 : guiSection.getStringList("Enchantments")) {
|
||||
String[] id = str4.split(":");
|
||||
if (GUIitem.getItemMeta() instanceof EnchantmentStorageMeta) {
|
||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
||||
enchantMeta.addStoredEnchant(CMIEnchantment.getEnchantment(id[0]), Integer.parseInt(id[1]), true);
|
||||
GUIitem.setItemMeta(enchantMeta);
|
||||
} else
|
||||
GUIitem.addUnsafeEnchantment(CMIEnchantment.getEnchantment(id[0]), Integer.parseInt(id[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (guiSection.isString("CustomSkull")) {
|
||||
GUIitem = Util.getSkull(guiSection.getString("CustomSkull"));
|
||||
}
|
||||
if (guiSection.isString("CustomSkull")) {
|
||||
GUIitem = Util.getSkull(guiSection.getString("CustomSkull"));
|
||||
}
|
||||
|
||||
if (guiSection.getInt("slot", -1) >= 0)
|
||||
guiSlot = guiSection.getInt("slot");
|
||||
if (guiSection.getInt("slot", -1) >= 0)
|
||||
guiSlot = guiSection.getInt("slot");
|
||||
}
|
||||
|
||||
// Permissions
|
||||
@ -1205,8 +1204,8 @@ public class ConfigManager {
|
||||
|
||||
int id = keyValue.getId();
|
||||
String type = keyValue.getType(),
|
||||
subType = keyValue.getSubType(),
|
||||
meta = keyValue.getMeta();
|
||||
subType = keyValue.getSubType(),
|
||||
meta = keyValue.getMeta();
|
||||
|
||||
if (actionType == ActionType.TNTBREAK)
|
||||
Jobs.getGCManager().setTntFinder(true);
|
||||
|
@ -7,9 +7,9 @@ import java.util.List;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.ConfigReader;
|
||||
import com.gamingmesh.jobs.container.Title;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
public class TitleManager {
|
||||
|
||||
@ -55,12 +55,13 @@ public class TitleManager {
|
||||
c.header(Arrays.asList(
|
||||
"Title configuration",
|
||||
"Stores the titles people gain at certain levels.",
|
||||
"Each title requres to have a name, short name (used when the player has more than",
|
||||
"1 job) the colour of the title and the level requrirement to attain the title.",
|
||||
"Each title requires to have a name, short name (used when the player has more than 1 job)",
|
||||
"the colour of the title and the level requirement to attain the title.",
|
||||
"Colour can ether be a word like Brown, can be color character like &5 or hex color code like {#6600cc}",
|
||||
"It is recommended but not required to have a title at level 0.",
|
||||
"Titles are completely optional.",
|
||||
"Posible variable are {level} to add current jobs level.",
|
||||
"Optionaly you can set different titles based by job.",
|
||||
"Possible variable are {level} to add current jobs level.",
|
||||
"Optionally you can set different titles based by job.",
|
||||
" JobName: Miner"));
|
||||
|
||||
ConfigurationSection titleSection = c.getC().getConfigurationSection("Titles");
|
||||
@ -70,56 +71,56 @@ public class TitleManager {
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Novice.Name", "N"),
|
||||
c.get("Titles.Novice.ShortName", "N"),
|
||||
ChatColor.matchColor(c.get("Titles.Novice.ChatColour", "YELLOW")),
|
||||
CMIChatColor.getColor(c.get("Titles.Novice.ChatColour", "YELLOW")),
|
||||
c.get("Titles.Novice.levelReq", 0),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Apprentice.Name", "A"),
|
||||
c.get("Titles.Apprentice.ShortName", "A"),
|
||||
ChatColor.matchColor(c.get("Titles.Apprentice.ChatColour", "WHITE")),
|
||||
CMIChatColor.getColor(c.get("Titles.Apprentice.ChatColour", "WHITE")),
|
||||
c.get("Titles.Apprentice.levelReq", 25),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Initiate.Name", "I"),
|
||||
c.get("Titles.Initiate.ShortName", "I"),
|
||||
ChatColor.matchColor(c.get("Titles.Initiate.ChatColour", "GOLD")),
|
||||
CMIChatColor.getColor(c.get("Titles.Initiate.ChatColour", "GOLD")),
|
||||
c.get("Titles.Initiate.levelReq", 50),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Journeyman.Name", "J"),
|
||||
c.get("Titles.Journeyman.ShortName", "J"),
|
||||
ChatColor.matchColor(c.get("Titles.Journeyman.ChatColour", "DARK_GREEN")),
|
||||
CMIChatColor.getColor(c.get("Titles.Journeyman.ChatColour", "DARK_GREEN")),
|
||||
c.get("Titles.Journeyman.levelReq", 75),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Adept.Name", "Ad"),
|
||||
c.get("Titles.Adept.ShortName", "Ad"),
|
||||
ChatColor.matchColor(c.get("Titles.Adept.ChatColour", "DARK_PURPLE")),
|
||||
CMIChatColor.getColor(c.get("Titles.Adept.ChatColour", "DARK_PURPLE")),
|
||||
c.get("Titles.Adept.levelReq", 100),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Master.Name", "M"),
|
||||
c.get("Titles.Master.ShortName", "M"),
|
||||
ChatColor.matchColor(c.get("Titles.Master.ChatColour", "GRAY")),
|
||||
CMIChatColor.getColor(c.get("Titles.Master.ChatColour", "GRAY")),
|
||||
c.get("Titles.Master.levelReq", 125),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Grandmaster.Name", "GM"),
|
||||
c.get("Titles.Grandmaster.ShortName", "GM"),
|
||||
ChatColor.matchColor(c.get("Titles.Grandmaster.ChatColour", "DARK_GRAY")),
|
||||
CMIChatColor.getColor(c.get("Titles.Grandmaster.ChatColour", "DARK_GRAY")),
|
||||
c.get("Titles.Grandmaster.levelReq", 150),
|
||||
null));
|
||||
|
||||
titles.add(new Title(
|
||||
c.get("Titles.Legendary.Name", "L"),
|
||||
c.get("Titles.Legendary.ShortName", "L"),
|
||||
ChatColor.matchColor(c.get("Titles.Legendary.ChatColour", "BLACK")),
|
||||
CMIChatColor.getColor(c.get("Titles.Legendary.ChatColour", "BLACK")),
|
||||
c.get("Titles.Legendary.levelReq", 200),
|
||||
null));
|
||||
c.save();
|
||||
@ -128,7 +129,7 @@ public class TitleManager {
|
||||
String jobName = null;
|
||||
String titleName = titleSection.getString(titleKey + ".Name");
|
||||
String titleShortName = titleSection.getString(titleKey + ".ShortName");
|
||||
ChatColor titleColor = ChatColor.matchColor(titleSection.getString(titleKey + ".ChatColour", ""));
|
||||
CMIChatColor titleColor = CMIChatColor.getColor(titleSection.getString(titleKey + ".ChatColour", ""));
|
||||
int levelReq = titleSection.getInt(titleKey + ".levelReq", -1);
|
||||
|
||||
if (titleSection.isString(titleKey + ".JobName"))
|
||||
|
@ -19,10 +19,10 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -51,7 +51,7 @@ public class Job {
|
||||
private String jobShortName;
|
||||
private String description;
|
||||
|
||||
private ChatColor jobColour;
|
||||
private CMIChatColor jobColour;
|
||||
private Parser maxExpEquation;
|
||||
private DisplayMethod displayMethod;
|
||||
|
||||
@ -85,7 +85,7 @@ public class Job {
|
||||
|
||||
private int id = 0;
|
||||
|
||||
public Job(String jobName, String fullName, String jobShortName, String description, ChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
|
||||
public Job(String jobName, String fullName, String jobShortName, String description, CMIChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
|
||||
int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, HashMap<String, JobItems> jobItems,
|
||||
HashMap<String, JobLimitedItems> jobLimitedItems, List<String> CmdOnJoin, List<String> CmdOnLeave, ItemStack GUIitem, int guiSlot, String bossbar, Long rejoinCD, List<String> worldBlacklist) {
|
||||
this.jobName = jobName == null ? "" : jobName;
|
||||
@ -294,7 +294,7 @@ public class Job {
|
||||
* Get the Color of the job for chat
|
||||
* @return the Color of the job for chat
|
||||
*/
|
||||
public ChatColor getChatColor() {
|
||||
public CMIChatColor getChatColor() {
|
||||
return jobColour;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ import com.gamingmesh.jobs.Signs.SignTopType;
|
||||
import com.gamingmesh.jobs.dao.JobsDAO;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
|
||||
@ -678,7 +677,7 @@ public class JobsPlayer {
|
||||
if (numJobs == 1) {
|
||||
if (method == DisplayMethod.FULL || method == DisplayMethod.TITLE) {
|
||||
if (title != null) {
|
||||
String honorificpart = title.getChatColor() + title.getName() + ChatColor.WHITE;
|
||||
String honorificpart = title.getChatColor() + title.getName() + CMIChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", String.valueOf(prog.getLevel()));
|
||||
builder.append(honorificpart);
|
||||
@ -691,7 +690,7 @@ public class JobsPlayer {
|
||||
builder.append(" ");
|
||||
}
|
||||
|
||||
String honorificpart = prog.getJob().getNameWithColor() + ChatColor.WHITE;
|
||||
String honorificpart = prog.getJob().getNameWithColor() + CMIChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", String.valueOf(prog.getLevel()));
|
||||
|
||||
@ -703,7 +702,7 @@ public class JobsPlayer {
|
||||
if (numJobs > 1 && (method == DisplayMethod.FULL) || method == DisplayMethod.TITLE || method == DisplayMethod.SHORT_FULL || method == DisplayMethod.SHORT_TITLE) {
|
||||
// add title to honorific
|
||||
if (title != null) {
|
||||
String honorificpart = title.getChatColor() + title.getShortName() + ChatColor.WHITE;
|
||||
String honorificpart = title.getChatColor() + title.getShortName() + CMIChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", String.valueOf(prog.getLevel()));
|
||||
|
||||
@ -712,9 +711,8 @@ public class JobsPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
if (numJobs > 1 && (method == DisplayMethod.FULL) || method == DisplayMethod.JOB || method == DisplayMethod.SHORT_FULL || method ==
|
||||
DisplayMethod.SHORT_JOB) {
|
||||
String honorificpart = prog.getJob().getChatColor() + prog.getJob().getShortName() + ChatColor.WHITE;
|
||||
if (numJobs > 1 && (method == DisplayMethod.FULL) || method == DisplayMethod.JOB || method == DisplayMethod.SHORT_FULL || method == DisplayMethod.SHORT_JOB) {
|
||||
String honorificpart = prog.getJob().getChatColor() + prog.getJob().getShortName() + CMIChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", String.valueOf(prog.getLevel()));
|
||||
|
||||
@ -727,7 +725,7 @@ public class JobsPlayer {
|
||||
if (nonejob != null) {
|
||||
DisplayMethod metod = nonejob.getDisplayMethod();
|
||||
if (metod == DisplayMethod.FULL || metod == DisplayMethod.TITLE) {
|
||||
String honorificpart = Jobs.getNoneJob().getChatColor() + Jobs.getNoneJob().getName() + ChatColor.WHITE;
|
||||
String honorificpart = Jobs.getNoneJob().getChatColor() + Jobs.getNoneJob().getName() + CMIChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", "");
|
||||
|
||||
@ -735,7 +733,7 @@ public class JobsPlayer {
|
||||
}
|
||||
|
||||
if (metod == DisplayMethod.SHORT_FULL || metod == DisplayMethod.SHORT_TITLE || metod == DisplayMethod.SHORT_JOB) {
|
||||
String honorificpart = Jobs.getNoneJob().getChatColor() + Jobs.getNoneJob().getShortName() + ChatColor.WHITE;
|
||||
String honorificpart = Jobs.getNoneJob().getChatColor() + Jobs.getNoneJob().getShortName() + CMIChatColor.WHITE;
|
||||
if (honorificpart.contains("{level}"))
|
||||
honorificpart = honorificpart.replace("{level}", "");
|
||||
|
||||
@ -1225,7 +1223,7 @@ public class JobsPlayer {
|
||||
|
||||
public int getMaxFurnacesAllowed(CMIMaterial type) {
|
||||
String perm = "jobs.max" + (type == CMIMaterial.FURNACE || type == CMIMaterial.LEGACY_BURNING_FURNACE
|
||||
? "furnaces" : type == CMIMaterial.BLAST_FURNACE ? "blastfurnaces" : type == CMIMaterial.SMOKER ? "smokers" : "");
|
||||
? "furnaces" : type == CMIMaterial.BLAST_FURNACE ? "blastfurnaces" : type == CMIMaterial.SMOKER ? "smokers" : "");
|
||||
if (perm.isEmpty())
|
||||
return 0;
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
/**
|
||||
* Jobs Plugin for Bukkit
|
||||
* Copyright (C) 2011 Zak Ford <zak.j.ford@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.gamingmesh.jobs.stuff;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public enum ChatColor {
|
||||
BLACK('0', 0),
|
||||
DARK_BLUE('1', 1),
|
||||
DARK_GREEN('2', 2),
|
||||
DARK_AQUA('3', 3),
|
||||
DARK_RED('4', 4),
|
||||
DARK_PURPLE('5', 5),
|
||||
GOLD('6', 6),
|
||||
GRAY('7', 7),
|
||||
DARK_GRAY('8', 8),
|
||||
BLUE('9', 9),
|
||||
GREEN('a', 10),
|
||||
AQUA('b', 11),
|
||||
RED('c', 12),
|
||||
LIGHT_PURPLE('d', 13),
|
||||
YELLOW('e', 14),
|
||||
WHITE('f', 15),
|
||||
BOLD('l', 16),
|
||||
ITALIC('o', 17),
|
||||
UNDERLINE('n', 18),
|
||||
RESET('r', 19),
|
||||
STRIKETHROUGH('m', 20);
|
||||
|
||||
private static final char COLOR_CHAR = '\u00A7';
|
||||
private final char code;
|
||||
private final int intCode;
|
||||
private final String toString;
|
||||
private final static Map<Integer, ChatColor> intMap = new HashMap<>();
|
||||
private final static Map<Character, ChatColor> charMap = new HashMap<>();
|
||||
private final static Map<String, ChatColor> stringMap = new HashMap<>();
|
||||
|
||||
private ChatColor(char code, int intCode) {
|
||||
this.code = code;
|
||||
this.intCode = intCode;
|
||||
this.toString = new String(new char[] { COLOR_CHAR, code });
|
||||
}
|
||||
|
||||
public char getChar() {
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString;
|
||||
}
|
||||
|
||||
public static ChatColor matchColor(char code) {
|
||||
return charMap.get(code);
|
||||
}
|
||||
|
||||
public static ChatColor matchColor(int code) {
|
||||
return intMap.get(code);
|
||||
}
|
||||
|
||||
public static ChatColor matchColor(String name) {
|
||||
return stringMap.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
static {
|
||||
for (ChatColor color : values()) {
|
||||
intMap.put(color.intCode, color);
|
||||
charMap.put(color.code, color);
|
||||
stringMap.put(color.name().toLowerCase(), color);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user