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

Lets make it short

This commit is contained in:
Zrips 2018-10-14 19:22:24 +03:00
parent a6a02b3ef4
commit 518794e71e
4 changed files with 86 additions and 117 deletions

View File

@ -364,6 +364,7 @@ public class ItemManager {
public enum CMIEntityType {
PLAYER(-1, "Player"),
DROPPED_ITEM(1, "Item"),
EXPERIENCE_ORB(2, "Experience Orb"),
AREA_EFFECT_CLOUD(3, "Area Effect Cloud"),
@ -460,7 +461,6 @@ public class ItemManager {
FISHING_HOOK(911, "Fishing Hook"),
LIGHTNING(912, "Lightning Bolt"),
WEATHER(913, "Weather"),
PLAYER(914, "Player"),
COMPLEX_PART(915, "Complex Part"),
TIPPED_ARROW(916, "Tipped Arrow"),
UNKNOWN(999, "Unknown");

View File

@ -511,37 +511,37 @@ public class editjobs implements Cmd {
switch (key.toLowerCase()) {
case "skeletonwither":
type = CMIEntityType.WITHER_SKELETON.getOneWordName();
type = CMIEntityType.WITHER_SKELETON.name();
id = 51;
meta = "1";
break;
case "skeletonstray":
type = CMIEntityType.STRAY.getOneWordName();
type = CMIEntityType.STRAY.name();
id = 51;
meta = "2";
break;
case "zombievillager":
type = CMIEntityType.ZOMBIE_VILLAGER.getOneWordName();
type = CMIEntityType.ZOMBIE_VILLAGER.name();
id = 54;
meta = "1";
break;
case "zombiehusk":
type = CMIEntityType.HUSK.getOneWordName();
type = CMIEntityType.HUSK.name();
id = 54;
meta = "2";
break;
case "horseskeleton":
type = CMIEntityType.SKELETON_HORSE.getOneWordName();
type = CMIEntityType.SKELETON_HORSE.name();
id = 100;
meta = "1";
break;
case "horsezombie":
type = CMIEntityType.ZOMBIE_HORSE.getOneWordName();
type = CMIEntityType.ZOMBIE_HORSE.name();
id = 100;
meta = "2";
break;
case "guardianelder":
type = CMIEntityType.ELDER_GUARDIAN.getOneWordName();
type = CMIEntityType.ELDER_GUARDIAN.name();
id = 68;
meta = "1";
break;

View File

@ -307,37 +307,37 @@ public class ConfigManager {
if (entity == null) {
switch (myKey.toLowerCase()) {
case "skeletonwither":
type = CMIEntityType.WITHER_SKELETON.getOneWordName();
type = CMIEntityType.WITHER_SKELETON.name();
id = 51;
meta = "1";
break;
case "skeletonstray":
type = CMIEntityType.STRAY.getOneWordName();
type = CMIEntityType.STRAY.name();
id = 51;
meta = "2";
break;
case "zombievillager":
type = CMIEntityType.ZOMBIE_VILLAGER.getOneWordName();
type = CMIEntityType.ZOMBIE_VILLAGER.name();
id = 54;
meta = "1";
break;
case "zombiehusk":
type = CMIEntityType.HUSK.getOneWordName();
type = CMIEntityType.HUSK.name();
id = 54;
meta = "2";
break;
case "horseskeleton":
type = CMIEntityType.SKELETON_HORSE.getOneWordName();
type = CMIEntityType.SKELETON_HORSE.name();
id = 100;
meta = "1";
break;
case "horsezombie":
type = CMIEntityType.ZOMBIE_HORSE.getOneWordName();
type = CMIEntityType.ZOMBIE_HORSE.name();
id = 100;
meta = "2";
break;
case "guardianelder":
type = CMIEntityType.ELDER_GUARDIAN.getOneWordName();
type = CMIEntityType.ELDER_GUARDIAN.name();
id = 68;
meta = "1";
break;
@ -1061,37 +1061,37 @@ public class ConfigManager {
if (entity == null) {
switch (key.toLowerCase()) {
case "skeletonwither":
type = CMIEntityType.WITHER_SKELETON.getOneWordName();
type = CMIEntityType.WITHER_SKELETON.name();
id = 51;
meta = "1";
break;
case "skeletonstray":
type = CMIEntityType.STRAY.getOneWordName();
type = CMIEntityType.STRAY.name();
id = 51;
meta = "2";
break;
case "zombievillager":
type = CMIEntityType.ZOMBIE_VILLAGER.getOneWordName();
type = CMIEntityType.ZOMBIE_VILLAGER.name();
id = 54;
meta = "1";
break;
case "zombiehusk":
type = CMIEntityType.HUSK.getOneWordName();
type = CMIEntityType.HUSK.name();
id = 54;
meta = "2";
break;
case "horseskeleton":
type = CMIEntityType.SKELETON_HORSE.getOneWordName();
type = CMIEntityType.SKELETON_HORSE.name();
id = 100;
meta = "1";
break;
case "horsezombie":
type = CMIEntityType.ZOMBIE_HORSE.getOneWordName();
type = CMIEntityType.ZOMBIE_HORSE.name();
id = 100;
meta = "2";
break;
case "guardianelder":
type = CMIEntityType.ELDER_GUARDIAN.getOneWordName();
type = CMIEntityType.ELDER_GUARDIAN.name();
id = 68;
meta = "1";
break;

View File

@ -10,6 +10,7 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIEntityType;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.container.LocaleReader;
@ -72,12 +73,14 @@ public class NameTranslatorManager {
if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(info.getId() + ":" + info.getMeta()) && !one.getId().equalsIgnoreCase("0")) {
return one.getName();
}
}
for (NameList one : ListOfEntities) {
String ids = one.getId();
ids = one.getId();
if (ids.equalsIgnoreCase(String.valueOf(info.getId())) && !one.getId().equalsIgnoreCase("0")) {
return one.getName();
}
ids = one.getMinecraftName();
if (ids.equalsIgnoreCase(info.getName())) {
return one.getName();
}
}
break;
case ENCHANT:
@ -137,10 +140,13 @@ public class NameTranslatorManager {
Set<String> keys = section.getKeys(false);
ListOfNames.clear();
for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;
String meta = one.contains(":") ? one.split(":")[1] : "";
String MCName = section.getString(one + ".MCName");
String Name = section.getString(one + ".Name");
String id = one.split("-")[0];
id = id.contains(":") ? id.split(":")[0] : id;
String meta = id.contains(":") ? id.split(":")[1] : "";
String MCName = one.split("-")[1];
String Name = ItemFile.getConfig().getString("ItemList." + one);
ListOfNames.add(new NameList(id, meta, Name, MCName));
}
if (ListOfNames.size() != 0)
@ -153,10 +159,11 @@ public class NameTranslatorManager {
Set<String> keys = section.getKeys(false);
ListOfEntities.clear();
for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;
String id = one.split("-")[0];
id = one.contains(":") ? one.split(":")[0] : one;
String meta = one.contains(":") ? one.split(":")[1] : "";
String MCName = section.getString(one + ".MCName");
String Name = section.getString(one + ".Name");
String MCName = one.split("-")[1];
String Name = ItemFile.getConfig().getString("EntityList." + one);
ListOfEntities.add(new NameList(id, meta, Name, MCName));
}
if (ListOfEntities.size() != 0)
@ -290,97 +297,59 @@ public class NameTranslatorManager {
}
}
if (name == null) {
n = one.getLegacyId() + ":" + one.getLegacyData() + "-" + one.getBukkitName();
if (c.getC().isString("ItemList." + n)) {
name = c.getC().getString("ItemList." + n);
}
}
if (name == null) {
n = String.valueOf(one.getLegacyId()) + "-" + one.getBukkitName();
if (c.getC().isString("ItemList." + n)) {
name = c.getC().getString("ItemList." + n);
}
}
if (name == null) {
n = String.valueOf(one.getId()) + "-" + one.getBukkitName();
if (c.getC().isString("ItemList." + n)) {
name = c.getC().getString("ItemList." + n);
}
}
if (name == null) {
name = one.getName();
}
c.get("ItemList." + one.getId() + ".MCName", one.getBukkitName());
c.get("ItemList." + one.getId() + ".Name", name);
c.get("ItemList." + (one.getId() == -1 ? one.getLegacyId() : one.getId()) + "-" + one.getBukkitName(), name);
}
// Entity list
c.get("EntityList.-1.MCName", "Player");
c.get("EntityList.-1.Name", "Player");
c.get("EntityList.50.MCName", "Creeper");
c.get("EntityList.50.Name", "Creeper");
c.get("EntityList.51.MCName", "Skeleton");
c.get("EntityList.51.Name", "Skeleton");
c.get("EntityList.51:1.MCName", "Skeleton");
c.get("EntityList.51:1.Name", "WitherSkeleton");
c.get("EntityList.51:2.MCName", "Skeleton");
c.get("EntityList.51:2.Name", "Skeleton Stray");
c.get("EntityList.52.MCName", "Spider");
c.get("EntityList.52.Name", "Spider");
c.get("EntityList.53.MCName", "Giant");
c.get("EntityList.53.Name", "Giant");
c.get("EntityList.54.MCName", "Zombie");
c.get("EntityList.54.Name", "Zombie");
c.get("EntityList.54:1.MCName", "Zombie");
c.get("EntityList.54:1.Name", "Zombie Villager");
c.get("EntityList.54:2.MCName", "Zombie");
c.get("EntityList.54:2.Name", "Zombie Husk");
c.get("EntityList.55.MCName", "Slime");
c.get("EntityList.55.Name", "Slime");
c.get("EntityList.56.MCName", "Ghast");
c.get("EntityList.56.Name", "Ghast");
c.get("EntityList.57.MCName", "PigZombie");
c.get("EntityList.57.Name", "Zombie Pigman");
c.get("EntityList.58.MCName", "Enderman");
c.get("EntityList.58.Name", "Enderman");
c.get("EntityList.59.MCName", "CaveSpider");
c.get("EntityList.59.Name", "Cave Spider");
c.get("EntityList.60.MCName", "Silverfish");
c.get("EntityList.60.Name", "Silverfish");
c.get("EntityList.61.MCName", "Blaze");
c.get("EntityList.61.Name", "Blaze");
c.get("EntityList.62.MCName", "LavaSlime");
c.get("EntityList.62.Name", "LavaSlime");
c.get("EntityList.63.MCName", "EnderDragon");
c.get("EntityList.63.Name", "EnderDragon");
c.get("EntityList.64.MCName", "WitherBoss");
c.get("EntityList.64.Name", "Wither");
c.get("EntityList.65.MCName", "Bat");
c.get("EntityList.65.Name", "Bat");
c.get("EntityList.66.MCName", "Witch");
c.get("EntityList.66.Name", "Witch");
c.get("EntityList.67.MCName", "Endermite");
c.get("EntityList.67.Name", "Endermite");
c.get("EntityList.68.MCName", "Guardian");
c.get("EntityList.68.Name", "Guardian");
c.get("EntityList.68:1.MCName", "Guardian");
c.get("EntityList.68:1.Name", "Elder Guardian");
c.get("EntityList.69.MCName", "Shulker");
c.get("EntityList.69.Name", "Shulker");
c.get("EntityList.90.MCName", "Pig");
c.get("EntityList.90.Name", "Pig");
c.get("EntityList.91.MCName", "Sheep");
c.get("EntityList.91.Name", "Sheep");
c.get("EntityList.92.MCName", "Cow");
c.get("EntityList.92.Name", "Cow");
c.get("EntityList.93.MCName", "Chicken");
c.get("EntityList.93.Name", "Chicken");
c.get("EntityList.94.MCName", "Squid");
c.get("EntityList.94.Name", "Squid");
c.get("EntityList.95.MCName", "Wolf");
c.get("EntityList.95.Name", "Wolf");
c.get("EntityList.96.MCName", "MushroomCow");
c.get("EntityList.96.Name", "MushroomCow");
c.get("EntityList.97.MCName", "SnowMan");
c.get("EntityList.97.Name", "Snow Golem");
c.get("EntityList.98.MCName", "Ozelot");
c.get("EntityList.98.Name", "Ocelot");
c.get("EntityList.99.MCName", "VillagerGolem");
c.get("EntityList.99.Name", "Iron Golem");
c.get("EntityList.100.MCName", "EntityHorse");
c.get("EntityList.100.Name", "Horse");
c.get("EntityList.101.MCName", "Rabbit");
c.get("EntityList.101.Name", "Rabbit");
c.get("EntityList.102.MCName", "PolarBear");
c.get("EntityList.102.Name", "Polar Bear");
c.get("EntityList.120.MCName", "Villager");
c.get("EntityList.120.Name", "Villager");
c.get("EntityList.200.MCName", "EnderCrystal");
c.get("EntityList.200.Name", "Ender Crystal");
for (CMIEntityType one : CMIEntityType.values()) {
if (!one.isAlive())
continue;
String n = String.valueOf(one.getId());
String name = null;
if (c.getC().isConfigurationSection("EntityList." + n)) {
name = c.getC().getString("EntityList." + n + ".Name");
}
if (name == null) {
n = n + "-" + one.toString();
if (c.getC().isConfigurationSection("EntityList." + n)) {
name = c.getC().getString("EntityList." + n);
}
}
if (name == null) {
name = one.getName();
}
c.get("EntityList." + one.getId() + "-" + one.toString(), name);
}
// Enchant list
c.get("EnchantList.0.MCName", "PROTECTION_ENVIRONMENTAL");