1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 22:13:25 +01:00

Lets allow custom names for MythicMobs

This commit is contained in:
Zrips 2020-01-03 17:12:29 +02:00
parent ca8ea40f7f
commit 8c4ae9dcf5
2 changed files with 28 additions and 4 deletions

View File

@ -25,6 +25,7 @@ public class NameTranslatorManager {
public HashMap<CMIMaterial, NameList> ListOfNames = new HashMap<>();
public ArrayList<NameList> ListOfEntities = new ArrayList<>();
public HashMap<String, NameList> ListOfEnchants = new HashMap<>();
public HashMap<String, NameList> ListOfMMEntities = new HashMap<>();
public ArrayList<NameList> ListOfColors = new ArrayList<>();
public String Translate(String materialName, JobInfo info) {
@ -95,8 +96,11 @@ public class NameTranslatorManager {
}
break;
case MMKILL:
NameList got = ListOfMMEntities.get(materialName.toLowerCase());
if (got != null && got.getName() != null)
return got.getName();
if (Jobs.getMythicManager() == null)
return materialName;
return materialName;
return Jobs.getMythicManager().getDisplayName(materialName);
default:
break;
@ -145,6 +149,19 @@ public class NameTranslatorManager {
} else
Jobs.consoleMsg("&c[Jobs] The EntityList section not found in " + ItemFile.fileName + " file.");
if (ItemFile.getConfig().isConfigurationSection("MythicEntityList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("MythicEntityList");
Set<String> keys = section.getKeys(false);
ListOfMMEntities.clear();
for (String one : keys) {
String Name = ItemFile.getConfig().getString("MythicEntityList." + one);
ListOfMMEntities.put(one.toLowerCase(), new NameList(null, null, Name, Name));
}
if (ListOfMMEntities.size() > 0)
Jobs.consoleMsg("&e[Jobs] Loaded " + ListOfMMEntities.size() + " custom MythicMobs names!");
} else
Jobs.consoleMsg("&c[Jobs] The MythicEntityList section not found in " + ItemFile.fileName + " file.");
if (ItemFile.getConfig().isConfigurationSection("EnchantList")) {
ConfigurationSection section = ItemFile.getConfig().getConfigurationSection("EnchantList");
Set<String> keys = section.getKeys(false);
@ -384,6 +401,13 @@ public class NameTranslatorManager {
c.get("ColorList." + cn.getId() + "-" + cn.toString(), name);
}*/
if (!c.getC().isConfigurationSection("MythicEntityList")) {
c.get("MythicEntityList.AngrySludge", "Angry Sludge");
c.get("MythicEntityList.SkeletalKnight", "Skeletal Knight");
} else {
c.set("MythicEntityList", c.getC().get("MythicEntityList"));
}
c.save();
}
readFile();

View File

@ -76,7 +76,7 @@ public class ExploreChunk {
public String serializeNames() {
String s = "";
if (playerIds == null)
return "";
return null;
for (Integer one : this.playerIds) {
if (!s.isEmpty())
s += ";";
@ -86,12 +86,12 @@ public class ExploreChunk {
}
public void deserializeNames(String names) {
if (names.isEmpty()) {
if (names == null || names.isEmpty()) {
this.full = true;
playerIds = null;
return;
}
List<String> split = Arrays.asList(names.split(";"));
for (String one : split) {
try {