mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
So lets properly recognize materials with name and data
This commit is contained in:
parent
ecb189b03e
commit
76b050a788
@ -1406,7 +1406,18 @@ public enum CMIMaterial {
|
|||||||
id = split[0];
|
id = split[0];
|
||||||
|
|
||||||
CMIMaterial mat = ItemManager.byName.get(id + ":" + data);
|
CMIMaterial mat = ItemManager.byName.get(id + ":" + data);
|
||||||
if (mat != null && mat.getLegacyId() > 0 && (mat = get(mat.getLegacyId(), data)) != null) {
|
|
||||||
|
if (mat == null)
|
||||||
|
mat = ItemManager.byName.get(id);
|
||||||
|
|
||||||
|
if (mat != null) {
|
||||||
|
if (mat.getLegacyId() > 0) {
|
||||||
|
CMIMaterial m = get(mat.getLegacyId(), data);
|
||||||
|
|
||||||
|
if (m != null)
|
||||||
|
mat = m;
|
||||||
|
}
|
||||||
|
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
|
@ -44,7 +44,7 @@ public class HookEconomyTask implements Runnable {
|
|||||||
Jobs.getPluginLogger().severe("Vault is required by this plugin for economy support!");
|
Jobs.getPluginLogger().severe("Vault is required by this plugin for economy support!");
|
||||||
Jobs.getPluginLogger().severe("Please install them first!");
|
Jobs.getPluginLogger().severe("Please install them first!");
|
||||||
Jobs.getPluginLogger().severe("You can find the latest versions here:");
|
Jobs.getPluginLogger().severe("You can find the latest versions here:");
|
||||||
Jobs.getPluginLogger().severe("https://www.spigotmc.org/resources/vault.34315/");
|
Jobs.getPluginLogger().severe("https://www.spigotmc.org/resources/34315/");
|
||||||
Jobs.getPluginLogger().severe("==============================================");
|
Jobs.getPluginLogger().severe("==============================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,11 @@ public class PermissionManager {
|
|||||||
* @return the max value
|
* @return the max value
|
||||||
*/
|
*/
|
||||||
public double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force, boolean cumulative) {
|
public double getMaxPermission(JobsPlayer jPlayer, String perm, boolean force, boolean cumulative) {
|
||||||
if (jPlayer == null || jPlayer.getPlayer() == null)
|
if (jPlayer == null)
|
||||||
|
return 0D;
|
||||||
|
|
||||||
|
Player player = jPlayer.getPlayer();
|
||||||
|
if (player == null)
|
||||||
return 0D;
|
return 0D;
|
||||||
|
|
||||||
perm = perm.toLowerCase();
|
perm = perm.toLowerCase();
|
||||||
@ -165,7 +169,7 @@ public class PermissionManager {
|
|||||||
|
|
||||||
Map<String, Boolean> permissions = jPlayer.getPermissionsCache();
|
Map<String, Boolean> permissions = jPlayer.getPermissionsCache();
|
||||||
if (force || permissions == null || getDelay(perm) + jPlayer.getLastPermissionUpdate() < System.currentTimeMillis()) {
|
if (force || permissions == null || getDelay(perm) + jPlayer.getLastPermissionUpdate() < System.currentTimeMillis()) {
|
||||||
permissions = getAll(jPlayer.getPlayer());
|
permissions = getAll(player);
|
||||||
jPlayer.setPermissionsCache(permissions);
|
jPlayer.setPermissionsCache(permissions);
|
||||||
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@ -190,12 +194,16 @@ public class PermissionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(JobsPlayer jPlayer, String perm) {
|
public boolean hasPermission(JobsPlayer jPlayer, String perm) {
|
||||||
if (jPlayer == null || jPlayer.getPlayer() == null)
|
if (jPlayer == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Player player = jPlayer.getPlayer();
|
||||||
|
if (player == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Map<String, Boolean> permissions = jPlayer.getPermissionsCache();
|
Map<String, Boolean> permissions = jPlayer.getPermissionsCache();
|
||||||
if (permissions == null || getDelay(perm) + jPlayer.getLastPermissionUpdate() < System.currentTimeMillis()) {
|
if (permissions == null || getDelay(perm) + jPlayer.getLastPermissionUpdate() < System.currentTimeMillis()) {
|
||||||
permissions = getAll(jPlayer.getPlayer());
|
permissions = getAll(player);
|
||||||
jPlayer.setPermissionsCache(permissions);
|
jPlayer.setPermissionsCache(permissions);
|
||||||
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
jPlayer.setLastPermissionUpdate(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ public class ConfigManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Break and Place actions MUST be blocks
|
// These actions MUST be blocks
|
||||||
if (actionType == ActionType.BREAK || actionType == ActionType.PLACE || actionType == ActionType.STRIPLOGS) {
|
if (actionType == ActionType.BREAK || actionType == ActionType.PLACE || actionType == ActionType.STRIPLOGS) {
|
||||||
if (!material.isBlock() || material.getMaterial().toString().equalsIgnoreCase("AIR")) {
|
if (!material.isBlock() || material.getMaterial().toString().equalsIgnoreCase("AIR")) {
|
||||||
Jobs.getPluginLogger().warning("Job " + jobName + " has an invalid " + actionType.getName() + " type property: " + material
|
Jobs.getPluginLogger().warning("Job " + jobName + " has an invalid " + actionType.getName() + " type property: " + material
|
||||||
@ -987,16 +987,13 @@ public class ConfigManager {
|
|||||||
|
|
||||||
String description = CMIChatColor.translate(jobSection.getString("description", ""));
|
String description = CMIChatColor.translate(jobSection.getString("description", ""));
|
||||||
|
|
||||||
List<String> fDescription = new ArrayList<>();
|
List<String> fDescription = jobSection.getStringList("FullDescription");
|
||||||
if (jobSection.contains("FullDescription")) {
|
|
||||||
if (jobSection.isString("FullDescription"))
|
|
||||||
fDescription.add(jobSection.getString("FullDescription"));
|
|
||||||
else if (jobSection.isList("FullDescription"))
|
|
||||||
fDescription.addAll(jobSection.getStringList("FullDescription"));
|
|
||||||
|
|
||||||
for (int i = 0; i < fDescription.size(); i++) {
|
if (jobSection.isString("FullDescription"))
|
||||||
fDescription.set(i, CMIChatColor.translate(fDescription.get(i)));
|
fDescription.add(jobSection.getString("FullDescription"));
|
||||||
}
|
|
||||||
|
for (int i = 0; i < fDescription.size(); i++) {
|
||||||
|
fDescription.set(i, CMIChatColor.translate(fDescription.get(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMIChatColor color = CMIChatColor.WHITE;
|
CMIChatColor color = CMIChatColor.WHITE;
|
||||||
@ -1218,11 +1215,10 @@ public class ConfigManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = commandSection.getStringList("command");
|
||||||
|
|
||||||
if (commandSection.isString("command"))
|
if (commandSection.isString("command"))
|
||||||
commands.add(commandSection.getString("command"));
|
commands.add(commandSection.getString("command"));
|
||||||
else if (commandSection.isList("command"))
|
|
||||||
commands.addAll(commandSection.getStringList("command"));
|
|
||||||
|
|
||||||
int levelFrom = commandSection.getInt("levelFrom", 0);
|
int levelFrom = commandSection.getInt("levelFrom", 0);
|
||||||
int levelUntil = commandSection.getInt("levelUntil", maxLevel);
|
int levelUntil = commandSection.getInt("levelUntil", maxLevel);
|
||||||
@ -1374,83 +1370,72 @@ public class ConfigManager {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
Quest quest = new Quest(sqsection.getString("Name", one), job);
|
Quest quest = new Quest(sqsection.getString("Name", one), job);
|
||||||
|
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
||||||
|
|
||||||
if (sqsection.isString("Target")) {
|
if (actionType != null) {
|
||||||
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
|
||||||
|
|
||||||
if (actionType == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
KeyValues kv = getKeyValue(sqsection.getString("Target").toUpperCase(), actionType, jobFullName);
|
KeyValues kv = getKeyValue(sqsection.getString("Target").toUpperCase(), actionType, jobFullName);
|
||||||
|
|
||||||
if (kv != null) {
|
if (kv != null) {
|
||||||
int amount = sqsection.getInt("Amount", 1);
|
int amount = sqsection.getInt("Amount", 1);
|
||||||
quest.addObjective(new QuestObjective(actionType, kv.getId(), kv.getMeta(), (kv.getType() + kv.getSubType()).toUpperCase(), amount));
|
quest.addObjective(new QuestObjective(actionType, kv.getId(), kv.getMeta(), (kv.getType() + kv.getSubType()).toUpperCase(), amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sqsection.isList("Objectives")) {
|
for (String oneObjective : sqsection.getStringList("Objectives")) {
|
||||||
for (String oneObjective : sqsection.getStringList("Objectives")) {
|
String[] split = oneObjective.split(";", 3);
|
||||||
String[] split = oneObjective.split(";", 3);
|
|
||||||
|
|
||||||
if (split.length < 2) {
|
if (split.length < 2) {
|
||||||
log.warning("Job " + jobKey + " has incorrect quest objective (" + oneObjective + ")!");
|
log.warning("Job " + jobKey + " has incorrect quest objective (" + oneObjective + ")!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ((actionType = ActionType.getByName(split[0])) == null)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
String mats = split[1].toUpperCase();
|
||||||
ActionType actionType = ActionType.getByName(split[0]);
|
String[] co = mats.split(",");
|
||||||
if (actionType == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
String mats = split[1].toUpperCase();
|
int amount = 1;
|
||||||
String[] co = mats.split(",");
|
if (split.length <= 3)
|
||||||
|
amount = Integer.parseInt(split[2]);
|
||||||
|
|
||||||
int amount = 1;
|
if (co.length > 0) {
|
||||||
if (split.length <= 3) {
|
for (String materials : co) {
|
||||||
amount = Integer.parseInt(split[2]);
|
KeyValues kv = getKeyValue(materials, actionType, jobFullName);
|
||||||
|
|
||||||
|
if (kv == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
|
||||||
|
(kv.getType() + kv.getSubType()).toUpperCase(), amount);
|
||||||
|
quest.addObjective(objective);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
KeyValues kv = getKeyValue(mats, actionType, jobFullName);
|
||||||
|
|
||||||
if (co.length > 0) {
|
if (kv != null) {
|
||||||
for (String materials : co) {
|
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
|
||||||
KeyValues kv = getKeyValue(materials, actionType, jobFullName);
|
(kv.getType() + kv.getSubType()).toUpperCase(), amount);
|
||||||
if (kv == null) {
|
quest.addObjective(objective);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
|
|
||||||
(kv.getType() + kv.getSubType()).toUpperCase(), amount);
|
|
||||||
quest.addObjective(objective);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
KeyValues kv = getKeyValue(mats, actionType, jobFullName);
|
|
||||||
if (kv != null) {
|
|
||||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
|
|
||||||
(kv.getType() + kv.getSubType()).toUpperCase(), amount);
|
|
||||||
quest.addObjective(objective);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
log.warning("Job " + jobKey + " has incorrect quest objective (" + oneObjective + ")!");
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warning("Job " + jobKey + " has incorrect quest objective (" + oneObjective + ")!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int chance = sqsection.getInt("Chance", 100);
|
|
||||||
|
|
||||||
List<String> commands = sqsection.getStringList("RewardCommands"),
|
|
||||||
desc = sqsection.getStringList("RewardDesc"),
|
|
||||||
areas = sqsection.getStringList("RestrictedAreas");
|
|
||||||
|
|
||||||
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
||||||
|
|
||||||
if (sqsection.isInt("toLevel"))
|
if (sqsection.isInt("toLevel"))
|
||||||
quest.setMaxLvl(sqsection.getInt("toLevel"));
|
quest.setMaxLvl(sqsection.getInt("toLevel"));
|
||||||
|
|
||||||
quest.setConfigName(one);
|
quest.setConfigName(one);
|
||||||
quest.setChance(chance);
|
quest.setChance(sqsection.getInt("Chance", 100));
|
||||||
quest.setRewardCmds(commands);
|
quest.setRewardCmds(sqsection.getStringList("RewardCommands"));
|
||||||
quest.setDescription(desc);
|
quest.setDescription(sqsection.getStringList("RewardDesc"));
|
||||||
quest.setRestrictedArea(areas);
|
quest.setRestrictedArea(sqsection.getStringList("RestrictedAreas"));
|
||||||
|
|
||||||
quests.add(quest);
|
quests.add(quest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Jobs.consoleMsg("&c[Jobs] Can't load " + one + " quest for " + jobFullName);
|
Jobs.consoleMsg("&c[Jobs] Can't load " + one + " quest for " + jobFullName);
|
||||||
|
@ -46,35 +46,9 @@ public class NameTranslatorManager {
|
|||||||
case BREW:
|
case BREW:
|
||||||
case FISH:
|
case FISH:
|
||||||
case STRIPLOGS:
|
case STRIPLOGS:
|
||||||
|
String matName = materialName;
|
||||||
materialName = materialName.replace(" ", "");
|
materialName = materialName.replace(" ", "");
|
||||||
|
|
||||||
if (meta != null && !meta.isEmpty()) {
|
|
||||||
CMIMaterial mat = CMIMaterial.get(materialName + ":" + meta);
|
|
||||||
NameList nameLs = listOfNames.get(mat);
|
|
||||||
|
|
||||||
if (nameLs == null) {
|
|
||||||
mat = CMIMaterial.get(materialName.replace(" ", ""));
|
|
||||||
|
|
||||||
if ((nameLs = listOfNames.get(mat)) != null) {
|
|
||||||
NameList nameMeta = listOfNames.get(CMIMaterial.get(meta.replace(" ", "")));
|
|
||||||
|
|
||||||
if (nameMeta != null) {
|
|
||||||
return nameLs + ":" + nameMeta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mat == CMIMaterial.NONE) {
|
|
||||||
String fallbackMaterialName = Arrays.stream(materialName.split("\\s|:"))
|
|
||||||
.map(word -> word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase())
|
|
||||||
.collect(Collectors.joining(" ")); // returns capitalized word (from this -> To This)
|
|
||||||
|
|
||||||
return fallbackMaterialName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mat.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CMIMaterial mat = CMIMaterial.get(materialName);
|
CMIMaterial mat = CMIMaterial.get(materialName);
|
||||||
NameList nameLs = listOfNames.get(mat);
|
NameList nameLs = listOfNames.get(mat);
|
||||||
|
|
||||||
@ -88,6 +62,30 @@ public class NameTranslatorManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (meta != null && !meta.isEmpty()) {
|
||||||
|
mat = CMIMaterial.get(materialName + ":" + meta);
|
||||||
|
|
||||||
|
if ((nameLs = listOfNames.get(mat)) == null) {
|
||||||
|
mat = CMIMaterial.get(materialName.replace(" ", ""));
|
||||||
|
|
||||||
|
if ((nameLs = listOfNames.get(mat)) != null) {
|
||||||
|
NameList nameMeta = listOfNames.get(CMIMaterial.get(meta.replace(" ", "")));
|
||||||
|
|
||||||
|
if (nameMeta != null) {
|
||||||
|
return nameLs.getName() + ":" + nameMeta.getMeta();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mat == CMIMaterial.NONE) {
|
||||||
|
return Arrays.stream(matName.split("\\s|:"))
|
||||||
|
.map(word -> word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase())
|
||||||
|
.collect(Collectors.joining(" ")); // returns capitalized word (from this -> To This)
|
||||||
|
}
|
||||||
|
|
||||||
|
return mat.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (id > 0 && meta != null && !meta.isEmpty()) {
|
if (id > 0 && meta != null && !meta.isEmpty()) {
|
||||||
mat = CMIMaterial.get(id + ":" + meta);
|
mat = CMIMaterial.get(id + ":" + meta);
|
||||||
nameLs = listOfNames.get(mat);
|
nameLs = listOfNames.get(mat);
|
||||||
@ -145,10 +143,9 @@ public class NameTranslatorManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String fallbackColorName = Arrays.stream(name.split("\\s|:|-"))
|
return name == null ? "nocolor" : Arrays.stream(name.split("\\s|:|-"))
|
||||||
.map(word -> word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase())
|
.map(word -> word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase())
|
||||||
.collect(Collectors.joining(" ")); // returns capitalized word (from this -> To This)
|
.collect(Collectors.joining(" ")); // returns capitalized word (from this -> To This)
|
||||||
return fallbackColorName;
|
|
||||||
case MMKILL:
|
case MMKILL:
|
||||||
NameList got = listOfMMEntities.get(materialName.toLowerCase());
|
NameList got = listOfMMEntities.get(materialName.toLowerCase());
|
||||||
|
|
||||||
@ -311,56 +308,40 @@ public class NameTranslatorManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String n = mat.getLegacyId() + (mat.getLegacyData() == -1 ? "" : ":" + mat.getLegacyData());
|
String n = mat.getLegacyId() + (mat.getLegacyData() == -1 ? "" : ":" + mat.getLegacyData());
|
||||||
String name = null;
|
String name = c.getC().getString("ItemList." + mat.toString());
|
||||||
|
|
||||||
if (c.getC().isString("ItemList." + mat.toString())) {
|
if (name == null) {
|
||||||
name = c.getC().getString("ItemList." + mat.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == null && c.getC().isConfigurationSection("ItemList." + n)) {
|
|
||||||
name = c.getC().getString("ItemList." + n + ".Name");
|
name = c.getC().getString("ItemList." + n + ".Name");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n = mat.getLegacyId() + ":" + mat.getLegacyData();
|
n = mat.getLegacyId() + ":" + mat.getLegacyData();
|
||||||
if (c.getC().isConfigurationSection("ItemList." + n)) {
|
name = c.getC().getString("ItemList." + n + ".Name");
|
||||||
name = c.getC().getString("ItemList." + n + ".Name");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n = String.valueOf(mat.getLegacyId());
|
n = String.valueOf(mat.getLegacyId());
|
||||||
if (c.getC().isConfigurationSection("ItemList." + n)) {
|
name = c.getC().getString("ItemList." + n + ".Name");
|
||||||
name = c.getC().getString("ItemList." + n + ".Name");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n = String.valueOf(mat.getId());
|
n = String.valueOf(mat.getId());
|
||||||
if (c.getC().isConfigurationSection("ItemList." + n)) {
|
name = c.getC().getString("ItemList." + n + ".Name");
|
||||||
name = c.getC().getString("ItemList." + n + ".Name");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n = mat.getLegacyId() + ":" + mat.getLegacyData() + "-" + mat.getBukkitName();
|
n = mat.getLegacyId() + ":" + mat.getLegacyData() + "-" + mat.getBukkitName();
|
||||||
if (c.getC().isString("ItemList." + n)) {
|
name = c.getC().getString("ItemList." + n);
|
||||||
name = c.getC().getString("ItemList." + n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n = String.valueOf(mat.getLegacyId()) + "-" + mat.getBukkitName();
|
n = mat.getLegacyId() + "-" + mat.getBukkitName();
|
||||||
if (c.getC().isString("ItemList." + n)) {
|
name = c.getC().getString("ItemList." + n);
|
||||||
name = c.getC().getString("ItemList." + n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n = String.valueOf(mat.getId()) + "-" + mat.getBukkitName();
|
n = mat.getId() + "-" + mat.getBukkitName();
|
||||||
if (c.getC().isString("ItemList." + n)) {
|
name = c.getC().getString("ItemList." + n);
|
||||||
name = c.getC().getString("ItemList." + n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
@ -376,18 +357,11 @@ public class NameTranslatorManager {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
String n = Integer.toString(ent.getId());
|
String n = Integer.toString(ent.getId());
|
||||||
|
String name = c.getC().getString("EntityList." + n + ".Name");
|
||||||
String name = null;
|
|
||||||
|
|
||||||
if (c.getC().isConfigurationSection("EntityList." + n)) {
|
|
||||||
name = c.getC().getString("EntityList." + n + ".Name");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
n += "-" + ent.toString();
|
n += "-" + ent.toString();
|
||||||
if (c.getC().isConfigurationSection("EntityList." + n)) {
|
name = c.getC().getString("EntityList." + n);
|
||||||
name = c.getC().getString("EntityList." + n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@ -399,7 +399,7 @@ public class ShopManager {
|
|||||||
if (itemSection.isString("Id"))
|
if (itemSection.isString("Id"))
|
||||||
id = itemSection.getString("Id");
|
id = itemSection.getString("Id");
|
||||||
else {
|
else {
|
||||||
Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid GiveItems name property. Skipping!");
|
Jobs.getPluginLogger().severe("Shop item " + category + " has an invalid GiveItems item id property. Skipping!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +54,15 @@ public enum ActionType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ActionType getByName(String name) {
|
public static ActionType getByName(String name) {
|
||||||
name = name.replace("_", "");
|
if (name != null) {
|
||||||
for (ActionType one : ActionType.values()) {
|
name = name.replace("_", "");
|
||||||
if (one.name.equalsIgnoreCase(name))
|
|
||||||
return one;
|
for (ActionType one : ActionType.values()) {
|
||||||
|
if (one.name.equalsIgnoreCase(name))
|
||||||
|
return one;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user