mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-21 07:31:26 +01:00
Added a placeholder %titlename% to display the current title name, #344
- Fix NPE when someone removed the Jobs section from the jobConfig file and throws exception - SelectionTool now in material name not ID - save-on-disconnect now saving successfully - Fix NPE when jobs items not found - Fix jobs GUI when filled with stone not the specified
This commit is contained in:
parent
256fc873b0
commit
cee99ce850
@ -973,7 +973,7 @@ public class ItemManager {
|
|||||||
GREEN_GLAZED_TERRACOTTA(248, 0, 6958, "Green Glazed Terracotta"),
|
GREEN_GLAZED_TERRACOTTA(248, 0, 6958, "Green Glazed Terracotta"),
|
||||||
GREEN_SHULKER_BOX(232, 0, 9377, "Green Shulker Box"),
|
GREEN_SHULKER_BOX(232, 0, 9377, "Green Shulker Box"),
|
||||||
GREEN_STAINED_GLASS(95, 13, 22503, "Green Stained Glass"),
|
GREEN_STAINED_GLASS(95, 13, 22503, "Green Stained Glass"),
|
||||||
GREEN_STAINED_GLASS_PANE(160, 13, 4767, "Green Stained Glass Pane", "STAINED_GLASS_PANE"),
|
GREEN_STAINED_GLASS_PANE(160, 13, 4767, "Green Stained Glass Pane"),
|
||||||
GREEN_TERRACOTTA(159, 13, 4105, "Green Terracotta"),
|
GREEN_TERRACOTTA(159, 13, 4105, "Green Terracotta"),
|
||||||
GREEN_WALL_BANNER(177, 2, 15046, "Green Banner"),
|
GREEN_WALL_BANNER(177, 2, 15046, "Green Banner"),
|
||||||
GREEN_WOOL(35, 13, 25085, "Green Wool"),
|
GREEN_WOOL(35, 13, 25085, "Green Wool"),
|
||||||
|
@ -21,8 +21,8 @@ import com.gamingmesh.jobs.container.JobItems;
|
|||||||
|
|
||||||
public class ItemBoostManager {
|
public class ItemBoostManager {
|
||||||
|
|
||||||
private static HashMap<String, JobItems> items = new HashMap<String, JobItems>();
|
private static HashMap<String, JobItems> items = new HashMap<>();
|
||||||
private static HashMap<String, JobItems> legacy = new HashMap<String, JobItems>();
|
private static HashMap<String, JobItems> legacy = new HashMap<>();
|
||||||
|
|
||||||
public ItemBoostManager() {
|
public ItemBoostManager() {
|
||||||
|
|
||||||
@ -137,14 +137,14 @@ public class ItemBoostManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
if (cfg.getC().getStringList(one + ".lore") != null && !cfg.getC().getStringList(one + ".lore").isEmpty()) {
|
if (cfg.getC().contains(one + ".lore") && !cfg.getC().getStringList(one + ".lore").isEmpty()) {
|
||||||
for (String eachLine : cfg.get(one + ".lore", Arrays.asList(""))) {
|
for (String eachLine : cfg.get(one + ".lore", Arrays.asList(""))) {
|
||||||
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
lore.add(org.bukkit.ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
if (cfg.getC().getStringList(one + ".enchants") != null && !cfg.getC().getStringList(one + ".enchants").isEmpty())
|
if (cfg.getC().contains(one + ".enchants") && !cfg.getC().getStringList(one + ".enchants").isEmpty())
|
||||||
for (String eachLine : cfg.get(one + ".enchants", Arrays.asList(""))) {
|
for (String eachLine : cfg.get(one + ".enchants", Arrays.asList(""))) {
|
||||||
if (!eachLine.contains("="))
|
if (!eachLine.contains("="))
|
||||||
continue;
|
continue;
|
||||||
|
@ -35,6 +35,7 @@ import com.gamingmesh.jobs.container.Job;
|
|||||||
import com.gamingmesh.jobs.container.JobInfo;
|
import com.gamingmesh.jobs.container.JobInfo;
|
||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.container.Title;
|
||||||
import com.gamingmesh.jobs.stuff.PageInfo;
|
import com.gamingmesh.jobs.stuff.PageInfo;
|
||||||
|
|
||||||
public class JobsCommands implements CommandExecutor {
|
public class JobsCommands implements CommandExecutor {
|
||||||
@ -491,11 +492,17 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
* @return the message
|
* @return the message
|
||||||
*/
|
*/
|
||||||
public String jobStatsMessage(JobProgression jobProg) {
|
public String jobStatsMessage(JobProgression jobProg) {
|
||||||
|
Title t = null;
|
||||||
|
for (Title title : new ArrayList<Title>()) {
|
||||||
|
if (t == null)
|
||||||
|
t = title;
|
||||||
|
}
|
||||||
String message = Jobs.getLanguage().getMessage("command.stats.output",
|
String message = Jobs.getLanguage().getMessage("command.stats.output",
|
||||||
"%joblevel%", jobProg.getLevel(),
|
"%joblevel%", jobProg.getLevel(),
|
||||||
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
|
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
|
||||||
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
|
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
|
||||||
"%jobmaxxp%", jobProg.getMaxExperience());
|
"%jobmaxxp%", jobProg.getMaxExperience(),
|
||||||
|
"%titlename%", t == null ? "" : t.getName());
|
||||||
return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message;
|
return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,8 @@ public class area implements Cmd {
|
|||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
RestrictedAreaManager ra = Jobs.getRestrictedAreaManager();
|
RestrictedAreaManager ra = Jobs.getRestrictedAreaManager();
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ public class area implements Cmd {
|
|||||||
double bonus = 0D;
|
double bonus = 0D;
|
||||||
try {
|
try {
|
||||||
bonus = Double.parseDouble(args[2]);
|
bonus = Double.parseDouble(args[2]);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Boolean wg = false;
|
Boolean wg = false;
|
||||||
@ -53,7 +52,7 @@ public class area implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!wg && !Jobs.getSelectionManager().hasPlacedBoth(player)) {
|
if (!wg && !Jobs.getSelectionManager().hasPlacedBoth(player)) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.select", "%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTooldID).getName()));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.select", "%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class employ implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
if (job.getMaxSlots() != null && Jobs.getUsedSlots(job) >= job.getMaxSlots()) {
|
||||||
String message = Jobs.getLanguage().getMessage("command.join.error.fullslots");
|
String message = Jobs.getLanguage().getMessage("command.employ.error.fullslots");
|
||||||
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
message = message.replace("%jobname%", job.getChatColor() + job.getName());
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
return true;
|
return true;
|
||||||
|
@ -437,9 +437,13 @@ public class ConfigManager {
|
|||||||
//conf.options().header(new StringBuilder().append("Jobs configuration.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator")).append("Stores information about each job.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator")).append("For example configurations, visit http://dev.bukkit.org/bukkit-plugins/jobs-reborn/.").append(System.getProperty("line.separator")).toString());
|
//conf.options().header(new StringBuilder().append("Jobs configuration.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator")).append("Stores information about each job.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator")).append("For example configurations, visit http://dev.bukkit.org/bukkit-plugins/jobs-reborn/.").append(System.getProperty("line.separator")).toString());
|
||||||
|
|
||||||
ConfigurationSection jobsSection = conf.getConfigurationSection("Jobs");
|
ConfigurationSection jobsSection = conf.getConfigurationSection("Jobs");
|
||||||
//if (jobsSection == null) {
|
if (jobsSection == null) {
|
||||||
// jobsSection = conf.createSection("Jobs");
|
Jobs.getPluginLogger().severe("==================== Jobs ====================");
|
||||||
//}
|
Jobs.getPluginLogger().severe("Jobs section not found in jobConfig file!");
|
||||||
|
Jobs.getPluginLogger().severe("Check the config for fix the issue.");
|
||||||
|
Jobs.getPluginLogger().severe("==============================================");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (String jobKey : jobsSection.getKeys(false)) {
|
for (String jobKey : jobsSection.getKeys(false)) {
|
||||||
|
|
||||||
// Ignoring example job
|
// Ignoring example job
|
||||||
|
@ -67,7 +67,7 @@ public class GeneralConfigManager {
|
|||||||
public boolean PaymentMethodsPoints;
|
public boolean PaymentMethodsPoints;
|
||||||
public boolean PaymentMethodsExp;
|
public boolean PaymentMethodsExp;
|
||||||
private HashMap<CurrencyType, Double> generalMulti = new HashMap<>();
|
private HashMap<CurrencyType, Double> generalMulti = new HashMap<>();
|
||||||
public int getSelectionTooldID;
|
private String getSelectionTool = "";
|
||||||
|
|
||||||
private int ResetTimeHour;
|
private int ResetTimeHour;
|
||||||
private int ResetTimeMinute;
|
private int ResetTimeMinute;
|
||||||
@ -357,10 +357,10 @@ public class GeneralConfigManager {
|
|||||||
Jobs.setNameTranslatorManager();
|
Jobs.setNameTranslatorManager();
|
||||||
Jobs.getNameTranslatorManager().load();
|
Jobs.getNameTranslatorManager().load();
|
||||||
// signs information
|
// signs information
|
||||||
Jobs.setSignUtil(this.plugin);
|
Jobs.setSignUtil(plugin);
|
||||||
Jobs.getSignUtil().LoadSigns();
|
Jobs.getSignUtil().LoadSigns();
|
||||||
// Schedule
|
// Schedule
|
||||||
Jobs.setScheduleManager(this.plugin);
|
Jobs.setScheduleManager(plugin);
|
||||||
// Shop
|
// Shop
|
||||||
Jobs.setShopManager();
|
Jobs.setShopManager();
|
||||||
Jobs.getShopManager().load();
|
Jobs.getShopManager().load();
|
||||||
@ -374,12 +374,12 @@ public class GeneralConfigManager {
|
|||||||
private synchronized void loadGeneralSettings() {
|
private synchronized void loadGeneralSettings() {
|
||||||
try {
|
try {
|
||||||
c = new ConfigReader("generalConfig.yml");
|
c = new ConfigReader("generalConfig.yml");
|
||||||
} catch (Exception e1) {
|
} catch (Throwable t) {
|
||||||
e1.printStackTrace();
|
t.printStackTrace();
|
||||||
}
|
}
|
||||||
if (c == null){
|
if (c == null)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
c.header(Arrays.asList("General configuration.",
|
c.header(Arrays.asList("General configuration.",
|
||||||
" The general configuration for the jobs plugin mostly includes how often the plugin",
|
" The general configuration for the jobs plugin mostly includes how often the plugin",
|
||||||
" saves user data (when the user is in the game), the storage method, whether",
|
" saves user data (when the user is in the game), the storage method, whether",
|
||||||
@ -392,11 +392,10 @@ public class GeneralConfigManager {
|
|||||||
localeString = c.get("locale-language", "en");
|
localeString = c.get("locale-language", "en");
|
||||||
try {
|
try {
|
||||||
int i = localeString.indexOf('_');
|
int i = localeString.indexOf('_');
|
||||||
if (i == -1) {
|
if (i == -1)
|
||||||
locale = new Locale(localeString);
|
locale = new Locale(localeString);
|
||||||
} else {
|
else
|
||||||
locale = new Locale(localeString.substring(0, i), localeString.substring(i + 1));
|
locale = new Locale(localeString.substring(0, i), localeString.substring(i + 1));
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
locale = Locale.getDefault();
|
locale = Locale.getDefault();
|
||||||
Jobs.getPluginLogger().warning("Invalid locale \"" + localeString + "\" defaulting to " + locale.getLanguage());
|
Jobs.getPluginLogger().warning("Invalid locale \"" + localeString + "\" defaulting to " + locale.getLanguage());
|
||||||
@ -404,25 +403,6 @@ public class GeneralConfigManager {
|
|||||||
|
|
||||||
Jobs.getDBManager().start();
|
Jobs.getDBManager().start();
|
||||||
|
|
||||||
// c.getW().addComment("storage-method", "storage method, can be MySQL, sqlite");
|
|
||||||
// storageMethod = c.get("storage-method", "sqlite");
|
|
||||||
// if (storageMethod.equalsIgnoreCase("mysql")) {
|
|
||||||
// startMysql();
|
|
||||||
// } else if (storageMethod.equalsIgnoreCase("sqlite")) {
|
|
||||||
// startSqlite();
|
|
||||||
// } else {
|
|
||||||
// Jobs.getPluginLogger().warning("Invalid storage method! Changing method to sqlite!");
|
|
||||||
// c.getC().set("storage-method", "sqlite");
|
|
||||||
// startSqlite();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// c.getW().addComment("mysql-username", "Requires Mysql.");
|
|
||||||
// c.get("mysql-username", "root");
|
|
||||||
// c.get("mysql-password", "");
|
|
||||||
// c.get("mysql-hostname", "localhost:3306");
|
|
||||||
// c.get("mysql-database", "minecraft");
|
|
||||||
// c.get("mysql-table-prefix", "jobs_");
|
|
||||||
|
|
||||||
c.addComment("save-period", "How often in minutes you want it to save. This must be a non-zero number");
|
c.addComment("save-period", "How often in minutes you want it to save. This must be a non-zero number");
|
||||||
c.get("save-period", 10);
|
c.get("save-period", 10);
|
||||||
if (c.getInt("save-period") <= 0) {
|
if (c.getInt("save-period") <= 0) {
|
||||||
@ -436,18 +416,15 @@ public class GeneralConfigManager {
|
|||||||
"Only enable this if you have a multi-server setup, or have a really good reason for enabling this.", "Turning this on will decrease database performance.");
|
"Only enable this if you have a multi-server setup, or have a really good reason for enabling this.", "Turning this on will decrease database performance.");
|
||||||
saveOnDisconnect = c.get("save-on-disconnect", false);
|
saveOnDisconnect = c.get("save-on-disconnect", false);
|
||||||
|
|
||||||
c.addComment("selectionTool", "Tool used when selecting bounds for restricted area");
|
c.addComment("selectionTool", "Tool used when selecting bounds for restricted area.");
|
||||||
if (CMIMaterial.get(getSelectionTooldID) == null)
|
getSelectionTool = c.get("selectionTool", "golden_hoe");
|
||||||
getSelectionTooldID = 294;
|
|
||||||
else
|
|
||||||
getSelectionTooldID = c.get("selectionTool", 294);
|
|
||||||
|
|
||||||
c.addComment("MultiServerCompatability", "Enable if you are using one data base for multiple servers across bungee network",
|
c.addComment("MultiServerCompatability", "Enable if you are using one data base for multiple servers across bungee network",
|
||||||
"This will force to load players data every time he is logging in to have most up to date data instead of having preloaded data",
|
"This will force to load players data every time he is logging in to have most up to date data instead of having preloaded data",
|
||||||
"This will enable automatically save-on-disconnect feature");
|
"This will enable automatically save-on-disconnect feature");
|
||||||
MultiServerCompatability = c.get("MultiServerCompatability", false);
|
MultiServerCompatability = c.get("MultiServerCompatability", false);
|
||||||
if (MultiServerCompatability)
|
if (MultiServerCompatability)
|
||||||
saveOnDisconnect = true;
|
c.set("save-on-disconnect", true);
|
||||||
|
|
||||||
c.addComment("Optimizations.NewVersion",
|
c.addComment("Optimizations.NewVersion",
|
||||||
"When set to true staff will be informed about new Jobs plugin version", "You need to have jobs.versioncheck permission node");
|
"When set to true staff will be informed about new Jobs plugin version", "You need to have jobs.versioncheck permission node");
|
||||||
@ -600,7 +577,7 @@ public class GeneralConfigManager {
|
|||||||
DynamicPaymentEquation.setVariable("totaljobs", 10);
|
DynamicPaymentEquation.setVariable("totaljobs", 10);
|
||||||
DynamicPaymentEquation.setVariable("jobstotalplayers", 10);
|
DynamicPaymentEquation.setVariable("jobstotalplayers", 10);
|
||||||
DynamicPaymentEquation.getValue();
|
DynamicPaymentEquation.getValue();
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
Jobs.consoleMsg("&cDynamic payment equation has an invalid property. Disabling feature!");
|
Jobs.consoleMsg("&cDynamic payment equation has an invalid property. Disabling feature!");
|
||||||
useDynamicPayment = false;
|
useDynamicPayment = false;
|
||||||
}
|
}
|
||||||
@ -654,7 +631,7 @@ public class GeneralConfigManager {
|
|||||||
Equation.setVariable("totallevel", 1);
|
Equation.setVariable("totallevel", 1);
|
||||||
Equation.getValue();
|
Equation.getValue();
|
||||||
limit.setMaxEquation(Equation);
|
limit.setMaxEquation(Equation);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!");
|
Jobs.getPluginLogger().warning("MoneyLimit has an invalid value. Disabling money limit!");
|
||||||
limit.setEnabled(false);
|
limit.setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -688,7 +665,7 @@ public class GeneralConfigManager {
|
|||||||
Equation.setVariable("totallevel", 1);
|
Equation.setVariable("totallevel", 1);
|
||||||
Equation.getValue();
|
Equation.getValue();
|
||||||
limit.setMaxEquation(Equation);
|
limit.setMaxEquation(Equation);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
Jobs.getPluginLogger().warning("PointLimit has an invalid value. Disabling money limit!");
|
Jobs.getPluginLogger().warning("PointLimit has an invalid value. Disabling money limit!");
|
||||||
limit.setEnabled(false);
|
limit.setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -722,7 +699,7 @@ public class GeneralConfigManager {
|
|||||||
Equation.setVariable("totallevel", 1);
|
Equation.setVariable("totallevel", 1);
|
||||||
Equation.getValue();
|
Equation.getValue();
|
||||||
limit.setMaxEquation(Equation);
|
limit.setMaxEquation(Equation);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
Jobs.getPluginLogger().warning("ExpLimit has an invalid value. Disabling money limit!");
|
Jobs.getPluginLogger().warning("ExpLimit has an invalid value. Disabling money limit!");
|
||||||
limit.setEnabled(false);
|
limit.setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -928,7 +905,7 @@ public class GeneralConfigManager {
|
|||||||
tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
|
tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
|
||||||
guiBackButton = tmat == null ? CMIMaterial.JACK_O_LANTERN.newItemStack() : tmat.newItemStack();
|
guiBackButton = tmat == null ? CMIMaterial.JACK_O_LANTERN.newItemStack() : tmat.newItemStack();
|
||||||
|
|
||||||
tmat = CMIMaterial.get(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));
|
tmat = CMIMaterial.get(c.get("JobsGUI.Filler.Material", "GREEN_STAINED_GLASS_PANE"));
|
||||||
guiFiller = tmat == null ? CMIMaterial.GREEN_STAINED_GLASS_PANE.newItemStack() : tmat.newItemStack();
|
guiFiller = tmat == null ? CMIMaterial.GREEN_STAINED_GLASS_PANE.newItemStack() : tmat.newItemStack();
|
||||||
|
|
||||||
// c.addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost?");
|
// c.addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost?");
|
||||||
@ -937,8 +914,8 @@ public class GeneralConfigManager {
|
|||||||
c.save();
|
c.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectionTooldID() {
|
public String getSelectionTool() {
|
||||||
return getSelectionTooldID;
|
return getSelectionTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowNewVersion() {
|
public boolean isShowNewVersion() {
|
||||||
|
@ -17,7 +17,6 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
@ -322,7 +321,7 @@ public class ShopManager {
|
|||||||
|
|
||||||
ConfigurationSection ConfCategory = f.getConfigurationSection("Items");
|
ConfigurationSection ConfCategory = f.getConfigurationSection("Items");
|
||||||
ArrayList<String> categoriesList = new ArrayList<>(ConfCategory.getKeys(false));
|
ArrayList<String> categoriesList = new ArrayList<>(ConfCategory.getKeys(false));
|
||||||
if (categoriesList.size() == 0)
|
if (categoriesList.isEmpty())
|
||||||
return;
|
return;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int y = 1;
|
int y = 1;
|
||||||
@ -433,13 +432,13 @@ public class ShopManager {
|
|||||||
name = ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name"));
|
name = ChatColor.translateAlternateColorCodes('&', itemSection.getString("Name"));
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
if (itemSection.getStringList("Lore") != null && !itemSection.getStringList("Lore").isEmpty())
|
if (itemSection.contains("Lore") && !itemSection.getStringList("Lore").isEmpty())
|
||||||
for (String eachLine : itemSection.getStringList("Lore")) {
|
for (String eachLine : itemSection.getStringList("Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', eachLine));
|
lore.add(ChatColor.translateAlternateColorCodes('&', eachLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
if (itemSection.getStringList("Enchants") != null && !itemSection.getStringList("Enchants").isEmpty())
|
if (itemSection.contains("Enchants") && !itemSection.getStringList("Enchants").isEmpty())
|
||||||
for (String eachLine : itemSection.getStringList("Enchants")) {
|
for (String eachLine : itemSection.getStringList("Enchants")) {
|
||||||
|
|
||||||
if (!eachLine.contains("="))
|
if (!eachLine.contains("="))
|
||||||
@ -487,9 +486,8 @@ public class ShopManager {
|
|||||||
public void CloseInventories() {
|
public void CloseInventories() {
|
||||||
for (Entry<String, Integer> one : GuiList.entrySet()) {
|
for (Entry<String, Integer> one : GuiList.entrySet()) {
|
||||||
Player player = Bukkit.getPlayer(one.getKey());
|
Player player = Bukkit.getPlayer(one.getKey());
|
||||||
if (player != null) {
|
if (player != null)
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
|||||||
public class JobItems {
|
public class JobItems {
|
||||||
private String node;
|
private String node;
|
||||||
private String legacyKey = null;
|
private String legacyKey = null;
|
||||||
ItemStack item;
|
private ItemStack item;
|
||||||
private BoostMultiplier boostMultiplier = new BoostMultiplier();
|
private BoostMultiplier boostMultiplier = new BoostMultiplier();
|
||||||
private List<Job> jobs = new ArrayList<Job>();
|
private List<Job> jobs = new ArrayList<>();
|
||||||
private int fromLevel = 0;
|
private int fromLevel = 0;
|
||||||
private int untilLevel = Integer.MAX_VALUE;
|
private int untilLevel = Integer.MAX_VALUE;
|
||||||
|
|
||||||
@ -48,24 +48,29 @@ public class JobItems {
|
|||||||
item = mat.newItemStack();
|
item = mat.newItemStack();
|
||||||
item.setAmount(amount);
|
item.setAmount(amount);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
if (meta == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (name != null)
|
if (name != null)
|
||||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
||||||
if (lore != null && !lore.isEmpty()) {
|
if (lore != null && !lore.isEmpty())
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
}
|
|
||||||
if (enchants != null)
|
if (enchants != null) {
|
||||||
if (mat == CMIMaterial.ENCHANTED_BOOK) {
|
if (mat == CMIMaterial.ENCHANTED_BOOK) {
|
||||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
||||||
for (Entry<Enchantment, Integer> oneEnch : bookMeta.getEnchants().entrySet()) {
|
for (Entry<Enchantment, Integer> oneEnch : bookMeta.getEnchants().entrySet()) {
|
||||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
|
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
|
||||||
meta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
|
meta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
item = Jobs.getReflections().setNbt(item, "JobsItemBoost", node);
|
item = Jobs.getReflections().setNbt(item, "JobsItemBoost", node);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +85,7 @@ public class JobItems {
|
|||||||
|
|
||||||
public ItemStack getItemStack(Player player) {
|
public ItemStack getItemStack(Player player) {
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return this.item;
|
return item;
|
||||||
try {
|
try {
|
||||||
ItemStack item = this.item.clone();
|
ItemStack item = this.item.clone();
|
||||||
|
|
||||||
@ -96,8 +101,7 @@ public class JobItems {
|
|||||||
}
|
}
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,12 @@ public class PointsData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(UUID uuid, double points, double total) {
|
public void addPlayer(UUID uuid, double points, double total) {
|
||||||
addPlayer(uuid, new PlayerPoints(points,total));
|
addPlayer(uuid, new PlayerPoints(points, total));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(UUID uuid, PlayerPoints points) {
|
public void addPlayer(UUID uuid, PlayerPoints points) {
|
||||||
if (Jobs.getGCManager().MultiServerCompatability()&&Pointbase.containsKey(uuid)) Pointbase.remove(uuid);
|
if (Jobs.getGCManager().MultiServerCompatability() && Pointbase.containsKey(uuid))
|
||||||
|
Pointbase.remove(uuid);
|
||||||
if (!Pointbase.containsKey(uuid))
|
if (!Pointbase.containsKey(uuid))
|
||||||
Pointbase.put(uuid, points);
|
Pointbase.put(uuid, points);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ import org.bukkit.permissions.PermissionDefault;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
||||||
import com.gamingmesh.jobs.Gui.GuiInfoList;
|
import com.gamingmesh.jobs.Gui.GuiInfoList;
|
||||||
import com.gamingmesh.jobs.api.JobsAreaSelectionEvent;
|
import com.gamingmesh.jobs.api.JobsAreaSelectionEvent;
|
||||||
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
||||||
@ -149,9 +150,7 @@ public class JobsListener implements Listener {
|
|||||||
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
||||||
if (iih == null || iih.getType() == Material.AIR)
|
if (iih == null || iih.getType() == Material.AIR)
|
||||||
return;
|
return;
|
||||||
@SuppressWarnings("deprecation")
|
if (!iih.getType().equals(CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getMaterial()))
|
||||||
int heldItemId = iih.getType().getId();
|
|
||||||
if (heldItemId != Jobs.getGCManager().getSelectionTooldID())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!player.hasPermission("jobs.area.select"))
|
if (!player.hasPermission("jobs.area.select"))
|
||||||
|
@ -32,9 +32,9 @@ general:
|
|||||||
fromconsole: '&cEz a parancs csak a konzolon használható!'
|
fromconsole: '&cEz a parancs csak a konzolon használható!'
|
||||||
worldisdisabled: '&cNem tudsz használni parancsot ebben a világban!'
|
worldisdisabled: '&cNem tudsz használni parancsot ebben a világban!'
|
||||||
newFurnaceRegistration: '&eA kemence új tulajdonosa regisztrálva &7[current]&e/&f[max]'
|
newFurnaceRegistration: '&eA kemence új tulajdonosa regisztrálva &7[current]&e/&f[max]'
|
||||||
newBrewingRegistration: '&eA Potions Support új tulajdonosa regisztrálva &7[current]&e/&f[max]'
|
newBrewingRegistration: '&eA főzőállvány új tulajdonosa regisztrálva &7[current]&e/&f[max]'
|
||||||
noFurnaceRegistration: '&cElérted a kemencék maximális számát!'
|
noFurnaceRegistration: '&cElérted a kemencék maximális számát!'
|
||||||
noBrewingRegistration: '&cElérted a bájital főzés maximális számát!'
|
noBrewingRegistration: '&cElérted a főzőállvány regisztrációk maximális számát!'
|
||||||
command:
|
command:
|
||||||
help:
|
help:
|
||||||
output:
|
output:
|
||||||
@ -91,6 +91,8 @@ command:
|
|||||||
args: ''
|
args: ''
|
||||||
output:
|
output:
|
||||||
list: '&e[jobname]: %money% %points% %exp%'
|
list: '&e[jobname]: %money% %points% %exp%'
|
||||||
|
hover: '&7%itemtype%'
|
||||||
|
hoverLevelLimits: '&7Szinttől kezdve: %from% \n&7Eddig a szintig: %until%'
|
||||||
edititembonus:
|
edititembonus:
|
||||||
help:
|
help:
|
||||||
info: 'Tárgybónusz szerkesztése.'
|
info: 'Tárgybónusz szerkesztése.'
|
||||||
|
Loading…
Reference in New Issue
Block a user