mirror of
https://github.com/Zrips/Jobs.git
synced 2025-03-10 22:03:13 +01:00
Lets inform when we cant recognize enchant name for enchanter
Lets fix enchant name translation
This commit is contained in:
parent
be0bb1ef15
commit
f870e7f5dd
@ -873,9 +873,9 @@ public class ConfigManager {
|
||||
|
||||
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
||||
KeyValues kv = null;
|
||||
if (sqsection.isString("Target")){
|
||||
if (sqsection.isString("Target")) {
|
||||
kv = getKeyValue(sqsection.getString("Target"), actionType, jobName);
|
||||
}else if (sqsection.isList("Target")) {
|
||||
} else if (sqsection.isList("Target")) {
|
||||
List<String> list = sqsection.getStringList("Target");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
kv = getKeyValue(list.get(i), actionType, jobName);
|
||||
@ -949,7 +949,7 @@ public class ConfigManager {
|
||||
myKey = myKey.split("-")[0];
|
||||
}
|
||||
|
||||
CMIMaterial material = null;
|
||||
CMIMaterial material = CMIMaterial.NONE;
|
||||
|
||||
switch (actionType) {
|
||||
case KILL:
|
||||
@ -976,10 +976,10 @@ public class ConfigManager {
|
||||
case STRIPLOGS:
|
||||
material = CMIMaterial.get(myKey + (subType));
|
||||
|
||||
if (material == null)
|
||||
if (material == CMIMaterial.NONE)
|
||||
material = CMIMaterial.get(myKey.replace(" ", "_").toUpperCase());
|
||||
|
||||
if (material == null) {
|
||||
if (material == CMIMaterial.NONE) {
|
||||
// try integer method
|
||||
Integer matId = null;
|
||||
try {
|
||||
@ -1000,7 +1000,7 @@ public class ConfigManager {
|
||||
|
||||
}
|
||||
|
||||
c: if (material != null && material.getMaterial() != null) {
|
||||
c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) {
|
||||
|
||||
// Need to include those ones and count as regular blocks
|
||||
switch (key.replace("_", "").toLowerCase()) {
|
||||
@ -1111,7 +1111,7 @@ public class ConfigManager {
|
||||
}
|
||||
|
||||
} else if (actionType == ActionType.ENCHANT) {
|
||||
Enchantment enchant = Enchantment.getByName(myKey);
|
||||
Enchantment enchant = Enchantment.getByName(myKey.toUpperCase());
|
||||
if (enchant != null) {
|
||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrLower(Version.v1_12_R1)) {
|
||||
try {
|
||||
@ -1120,6 +1120,10 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (enchant == null && material == CMIMaterial.NONE) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "!");
|
||||
continue;
|
||||
}
|
||||
type = myKey;
|
||||
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.SHEAR || actionType == ActionType.MMKILL)
|
||||
type = myKey;
|
||||
@ -1145,7 +1149,6 @@ public class ConfigManager {
|
||||
}
|
||||
|
||||
if (type == null) {
|
||||
Jobs.consoleMsg("here2 " + material);
|
||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "!");
|
||||
continue;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.gamingmesh.jobs.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -23,7 +24,7 @@ public class NameTranslatorManager {
|
||||
public ArrayList<NameList> ListOfNames = new ArrayList<>();
|
||||
public ArrayList<NameList> ListOfPotionNames = new ArrayList<>();
|
||||
public ArrayList<NameList> ListOfEntities = new ArrayList<>();
|
||||
public ArrayList<NameList> ListOfEnchants = new ArrayList<>();
|
||||
public HashMap<String, NameList> ListOfEnchants = new HashMap<String, NameList>();
|
||||
public ArrayList<NameList> ListOfColors = new ArrayList<>();
|
||||
|
||||
public String Translate(String materialName, JobInfo info) {
|
||||
@ -80,27 +81,18 @@ public class NameTranslatorManager {
|
||||
}
|
||||
break;
|
||||
case ENCHANT:
|
||||
for (NameList one : ListOfEnchants) {
|
||||
String ids = one.getId();
|
||||
ids = one.getMinecraftName();
|
||||
if (ids.equalsIgnoreCase(info.getName().contains(":") ? info.getName().split(":")[0] : info.getName())) {
|
||||
return one.getName() + (info.getName().contains(":") ? ":" + info.getName().split(":")[1] : "");
|
||||
}
|
||||
|
||||
if (ids.equalsIgnoreCase(String.valueOf(info.getId()))) {
|
||||
return one.getName() + " " + info.getMeta();
|
||||
}
|
||||
ids = one.getId() + ":" + one.getMeta();
|
||||
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(info.getId() + ":" + info.getMeta()) && !one.getId().equalsIgnoreCase("0")) {
|
||||
return one.getName();
|
||||
}
|
||||
ids = one.getId();
|
||||
if (ids.equalsIgnoreCase(String.valueOf(info.getId())) && !one.getId().equalsIgnoreCase("0")) {
|
||||
return one.getName();
|
||||
}
|
||||
String name = materialName;
|
||||
String level = "";
|
||||
if (name.contains(":")) {
|
||||
name = materialName.split(":")[0];
|
||||
level = ":" + materialName.split(":")[1];
|
||||
}
|
||||
|
||||
break;
|
||||
NameList nameInfo = ListOfEnchants.get(name.toLowerCase().replace("_", ""));
|
||||
if (nameInfo != null) {
|
||||
return nameInfo.getMinecraftName() + level;
|
||||
}
|
||||
return materialName;
|
||||
case CUSTOMKILL:
|
||||
case EXPLORE:
|
||||
break;
|
||||
@ -176,7 +168,7 @@ public class NameTranslatorManager {
|
||||
ListOfEnchants.clear();
|
||||
for (String one : keys) {
|
||||
String name = section.getString(one);
|
||||
ListOfEnchants.add(new NameList(one, one, one, name));
|
||||
ListOfEnchants.put(one.replace("_", "").toLowerCase(), new NameList(one, one, one, name));
|
||||
}
|
||||
if (ListOfEnchants.size() > 0)
|
||||
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfEnchants.size() + " custom enchant names!");
|
||||
@ -375,82 +367,6 @@ public class NameTranslatorManager {
|
||||
c.get("EnchantList." + one.getName(), name);
|
||||
}
|
||||
|
||||
// // Enchant list
|
||||
// c.get("EnchantList.0.MCName", "PROTECTION_ENVIRONMENTAL");
|
||||
// c.get("EnchantList.0.Name", "Protection");
|
||||
// c.get("EnchantList.1.MCName", "PROTECTION_FIRE");
|
||||
// c.get("EnchantList.1.Name", "Fire Protection");
|
||||
// c.get("EnchantList.2.MCName", "PROTECTION_FALL");
|
||||
// c.get("EnchantList.2.Name", "Feather Falling");
|
||||
// c.get("EnchantList.3.MCName", "PROTECTION_EXPLOSIONS");
|
||||
// c.get("EnchantList.3.Name", "Blast Protection");
|
||||
// c.get("EnchantList.4.MCName", "ROTECTION_PROJECTILE");
|
||||
// c.get("EnchantList.4.Name", "Projectile Protection");
|
||||
// c.get("EnchantList.5.MCName", "OXYGEN");
|
||||
// c.get("EnchantList.5.Name", "Respiration");
|
||||
// c.get("EnchantList.6.MCName", "DIG_SPEED");
|
||||
// c.get("EnchantList.6.Name", "Aqua Affinity");
|
||||
// c.get("EnchantList.7.MCName", "THORNS");
|
||||
// c.get("EnchantList.7.Name", "Thorns");
|
||||
// c.get("EnchantList.8.MCName", "DEPTH_STRIDER");
|
||||
// c.get("EnchantList.8.Name", "Depth Strider");
|
||||
// c.get("EnchantList.9.MCName", "FROST_WALKER");
|
||||
// c.get("EnchantList.9.Name", "Frost Walker");
|
||||
// c.get("EnchantList.10.MCName", "CURSE_OF_BINDING");
|
||||
// c.get("EnchantList.10.Name", "Curse of Binding");
|
||||
// c.get("EnchantList.16.MCName", "DAMAGE_ALL");
|
||||
// c.get("EnchantList.16.Name", "Sharpness");
|
||||
// c.get("EnchantList.17.MCName", "DAMAGE_UNDEAD");
|
||||
// c.get("EnchantList.17.Name", "Smite");
|
||||
// c.get("EnchantList.18.MCName", "DAMAGE_ARTHROPODS");
|
||||
// c.get("EnchantList.18.Name", "Bane of Arthropods");
|
||||
// c.get("EnchantList.19.MCName", "KNOCKBACK");
|
||||
// c.get("EnchantList.19.Name", "Knockback");
|
||||
// c.get("EnchantList.20.MCName", "FIRE_ASPECT");
|
||||
// c.get("EnchantList.20.Name", "Fire Aspect");
|
||||
// c.get("EnchantList.21.MCName", "LOOT_BONUS_MOBS");
|
||||
// c.get("EnchantList.21.Name", "Looting");
|
||||
// c.get("EnchantList.22.MCName", "SWEEPING_EDGE");
|
||||
// c.get("EnchantList.22.Name", "Sweeping Edge");
|
||||
// c.get("EnchantList.32.MCName", "DIG_SPEED");
|
||||
// c.get("EnchantList.32.Name", "Efficiency");
|
||||
// c.get("EnchantList.33.MCName", "SILK_TOUCH");
|
||||
// c.get("EnchantList.33.Name", "Silk Touch");
|
||||
// c.get("EnchantList.34.MCName", "DURABILITY");
|
||||
// c.get("EnchantList.34.Name", "Unbreaking");
|
||||
// c.get("EnchantList.35.MCName", "LOOT_BONUS_BLOCKS");
|
||||
// c.get("EnchantList.35.Name", "Fortune");
|
||||
// c.get("EnchantList.48.MCName", "ARROW_DAMAGE");
|
||||
// c.get("EnchantList.48.Name", "Power");
|
||||
// c.get("EnchantList.49.MCName", "ARROW_KNOCKBACK");
|
||||
// c.get("EnchantList.49.Name", "Punch");
|
||||
// c.get("EnchantList.50.MCName", "ARROW_FIRE");
|
||||
// c.get("EnchantList.50.Name", "Flame");
|
||||
// c.get("EnchantList.51.MCName", "ARROW_INFINITE");
|
||||
// c.get("EnchantList.51.Name", "Infinity");
|
||||
// c.get("EnchantList.61.MCName", "LUCK");
|
||||
// c.get("EnchantList.61.Name", "Luck of the Sea");
|
||||
// c.get("EnchantList.62.MCName", "LURE");
|
||||
// c.get("EnchantList.62.Name", "Lure");
|
||||
// c.get("EnchantList.65.MCName", "LOYALTY");
|
||||
// c.get("EnchantList.65.Name", "Loyalty");
|
||||
// c.get("EnchantList.66.MCName", "IMPALING");
|
||||
// c.get("EnchantList.66.Name", "Impaling");
|
||||
// c.get("EnchantList.67.MCName", "RIPTIDE");
|
||||
// c.get("EnchantList.67.Name", "Riptide");
|
||||
// c.get("EnchantList.68.MCName", "CHANNELING");
|
||||
// c.get("EnchantList.68.Name", "Channeling");
|
||||
// c.get("EnchantList.70.MCName", "MENDING");
|
||||
// c.get("EnchantList.70.Name", "Mending");
|
||||
// c.get("EnchantList.71.MCName", "CURSE_OF_VANISHING");
|
||||
// c.get("EnchantList.71.Name", "Curse Of Vanishing");
|
||||
// c.get("EnchantList.72.MCName", "MULTISHOT");
|
||||
// c.get("EnchantList.72.Name", "Multishot");
|
||||
// c.get("EnchantList.73.MCName", "PIERCING");
|
||||
// c.get("EnchantList.73.Name", "Piercing");
|
||||
// c.get("EnchantList.74.MCName", "QUICK_CHARGE");
|
||||
// c.get("EnchantList.74.Name", "Quick Charge");
|
||||
|
||||
// Color list
|
||||
c.get("ColorList.0-white", "&fWhite");
|
||||
c.get("ColorList.1-orange", "&6Orange");
|
||||
|
@ -20,6 +20,7 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class JobInfo {
|
||||
private ActionType actionType;
|
||||
|
Loading…
Reference in New Issue
Block a user