mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
Added method to get the fullName from job
This commit is contained in:
parent
f19138db4d
commit
ab9ae0da1b
@ -1988,7 +1988,7 @@ public class ItemManager {
|
||||
stack.setAmount(amount);
|
||||
return stack;
|
||||
}
|
||||
ItemStack stack = new ItemStack(mat == null ? Material.STONE : mat, 1, (short) this.getLegacyData());
|
||||
ItemStack stack = new ItemStack(mat == null ? Material.STONE : mat, 1, this.getLegacyData());
|
||||
stack.setAmount(amount);
|
||||
return stack;
|
||||
}
|
||||
|
@ -69,14 +69,14 @@ public class exp implements Cmd {
|
||||
switch (action) {
|
||||
case Add:
|
||||
total = (prog.getExperience() + amount);
|
||||
prog.addExperience(amount);
|
||||
prog.addExperience(total);
|
||||
break;
|
||||
case Set:
|
||||
prog.setExperience(amount);
|
||||
break;
|
||||
case Take:
|
||||
total = (prog.getExperience() - amount);
|
||||
prog.takeExperience(amount);
|
||||
prog.takeExperience(total);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -418,7 +418,7 @@ public class ConfigManager {
|
||||
try {
|
||||
conf.load(s);
|
||||
s.close();
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
Jobs.getPluginLogger().severe("==================== Jobs ====================");
|
||||
Jobs.getPluginLogger().severe("Unable to load jobConfig.yml!");
|
||||
Jobs.getPluginLogger().severe("Check your config for formatting issues!");
|
||||
@ -438,19 +438,23 @@ public class ConfigManager {
|
||||
Jobs.getPluginLogger().severe("==============================================");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String jobKey : jobsSection.getKeys(false)) {
|
||||
|
||||
// Ignoring example job
|
||||
if (jobKey.equalsIgnoreCase("exampleJob"))
|
||||
continue;
|
||||
|
||||
// Translating unicode
|
||||
jobKey = StringEscapeUtils.unescapeJava(jobKey);
|
||||
|
||||
ConfigurationSection jobSection = jobsSection.getConfigurationSection(jobKey);
|
||||
String jobName = jobSection.getString("fullname", null);
|
||||
String jobFullName = jobSection.getString("fullname", null);
|
||||
|
||||
// Translating unicode
|
||||
jobName = StringEscapeUtils.unescapeJava(jobName);
|
||||
jobFullName = StringEscapeUtils.unescapeJava(jobFullName);
|
||||
|
||||
if (jobName == null) {
|
||||
if (jobFullName == null) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid fullname property. Skipping job!");
|
||||
continue;
|
||||
}
|
||||
@ -603,7 +607,7 @@ public class ConfigManager {
|
||||
if (matId != null) {
|
||||
material = CMIMaterial.get(matId);
|
||||
if (material != null) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " is using GUI item ID: " + item + "!");
|
||||
Jobs.getPluginLogger().warning("Job " + jobFullName + " is using GUI item ID: " + item + "!");
|
||||
Jobs.getPluginLogger().warning("Please use the Material name instead: " + material.toString() + "!");
|
||||
}
|
||||
}
|
||||
@ -850,7 +854,7 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
Job job = new Job(jobName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, vipmaxLevel, maxSlots, jobPermissions, jobCommand,
|
||||
Job job = new Job(jobKey, jobFullName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, vipmaxLevel, maxSlots, jobPermissions, jobCommand,
|
||||
jobConditions, jobItems, jobLimitedItems, JobsCommandOnJoin, JobsCommandOnLeave, GUIitem, bossbar, rejoinCd);
|
||||
|
||||
job.setFullDescription(fDescription);
|
||||
@ -873,7 +877,7 @@ public class ConfigManager {
|
||||
KeyValues kv = null;
|
||||
if (sqsection.isString("Target")) {
|
||||
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
||||
kv = getKeyValue(sqsection.getString("Target"), actionType, jobName);
|
||||
kv = getKeyValue(sqsection.getString("Target"), actionType, jobFullName);
|
||||
|
||||
if (kv != null) {
|
||||
int amount = sqsection.getInt("Amount", 1);
|
||||
@ -892,7 +896,7 @@ public class ConfigManager {
|
||||
}
|
||||
try {
|
||||
ActionType actionType = ActionType.getByName(split[0]);
|
||||
kv = getKeyValue(split[1], actionType, jobName);
|
||||
kv = getKeyValue(split[1], actionType, jobFullName);
|
||||
if (kv != null) {
|
||||
int amount = Integer.parseInt(split[2]);
|
||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(), kv.getType() + kv.getSubType(), amount);
|
||||
@ -924,12 +928,12 @@ public class ConfigManager {
|
||||
quests.add(quest);
|
||||
|
||||
} catch (Throwable e) {
|
||||
Jobs.consoleMsg("&c[Jobs] Can't load " + one + " quest for " + jobName);
|
||||
Jobs.consoleMsg("&c[Jobs] Can't load " + one + " quest for " + jobFullName);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Jobs.consoleMsg("&e[Jobs] Loaded " + quests.size() + " quests for " + jobName);
|
||||
Jobs.consoleMsg("&e[Jobs] Loaded " + quests.size() + " quests for " + jobFullName);
|
||||
job.setQuests(quests);
|
||||
}
|
||||
job.setMaxDailyQuests(jobSection.getInt("maxDailyQuests", 1));
|
||||
|
@ -35,43 +35,28 @@ import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
public class Job {
|
||||
// job info
|
||||
|
||||
private EnumMap<ActionType, List<JobInfo>> jobInfo = new EnumMap<>(ActionType.class);
|
||||
// permissions
|
||||
private List<JobPermission> jobPermissions;
|
||||
// commands
|
||||
private List<JobCommands> jobCommands;
|
||||
// conditions
|
||||
private List<JobConditions> jobConditions;
|
||||
// items
|
||||
private HashMap<String, JobItems> jobItems;
|
||||
// limited items
|
||||
private HashMap<String, JobLimitedItems> jobLimitedItems;
|
||||
// job name
|
||||
private String jobName = "N/A";
|
||||
private String fullName;
|
||||
// job short name (for use in multiple jobs)
|
||||
private String jobShortName;
|
||||
// short description of the job
|
||||
private String description;
|
||||
// job chat colour
|
||||
private ChatColor jobColour;
|
||||
// job leveling equation
|
||||
private Parser maxExpEquation;
|
||||
// display method
|
||||
private DisplayMethod displayMethod;
|
||||
// max level
|
||||
private int maxLevel;
|
||||
// vip max level
|
||||
private int vipmaxLevel = 0;
|
||||
// max number of people allowed with this job on the server.
|
||||
private Integer maxSlots;
|
||||
// Commands to be performed on player job join
|
||||
private List<String> CmdOnJoin = new ArrayList<>();
|
||||
// Commands to be performed on player job leave
|
||||
private List<String> CmdOnLeave = new ArrayList<>();
|
||||
// Item for GUI
|
||||
private ItemStack GUIitem;
|
||||
// Item for GUI
|
||||
private Long rejoinCd = 0L;
|
||||
|
||||
private int totalPlayers = -1;
|
||||
@ -90,6 +75,7 @@ public class Job {
|
||||
/**
|
||||
* Constructor
|
||||
* @param jobName - the name of the job
|
||||
* @param fullName - the full name of the job
|
||||
* @param jobShortName - the shortened version of the name of the job.
|
||||
* @param description - a short description of the job.
|
||||
* @param jobColour - the colour of the job title as displayed in chat.
|
||||
@ -106,10 +92,11 @@ public class Job {
|
||||
* @param CmdOnLeave - commands performed on player leave
|
||||
* @param jobConditions - jobs conditions
|
||||
*/
|
||||
public Job(String jobName, String jobShortName, String description, ChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
|
||||
public Job(String jobName, String fullName, String jobShortName, String description, ChatColor 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, String bossbar, Long rejoinCD) {
|
||||
this.jobName = jobName;
|
||||
this.fullName = fullName;
|
||||
this.jobShortName = jobShortName;
|
||||
this.description = description;
|
||||
this.jobColour = jobColour;
|
||||
@ -243,6 +230,14 @@ public class Job {
|
||||
return jobName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the job full name
|
||||
* @return the job full name
|
||||
*/
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the shortened version of the jobName
|
||||
* @return the shortened version of the jobName
|
||||
|
Loading…
Reference in New Issue
Block a user