1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +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 { public enum CMIEntityType {
PLAYER(-1, "Player"),
DROPPED_ITEM(1, "Item"), DROPPED_ITEM(1, "Item"),
EXPERIENCE_ORB(2, "Experience Orb"), EXPERIENCE_ORB(2, "Experience Orb"),
AREA_EFFECT_CLOUD(3, "Area Effect Cloud"), AREA_EFFECT_CLOUD(3, "Area Effect Cloud"),
@ -460,7 +461,6 @@ public class ItemManager {
FISHING_HOOK(911, "Fishing Hook"), FISHING_HOOK(911, "Fishing Hook"),
LIGHTNING(912, "Lightning Bolt"), LIGHTNING(912, "Lightning Bolt"),
WEATHER(913, "Weather"), WEATHER(913, "Weather"),
PLAYER(914, "Player"),
COMPLEX_PART(915, "Complex Part"), COMPLEX_PART(915, "Complex Part"),
TIPPED_ARROW(916, "Tipped Arrow"), TIPPED_ARROW(916, "Tipped Arrow"),
UNKNOWN(999, "Unknown"); UNKNOWN(999, "Unknown");

View File

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

View File

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

View File

@ -10,6 +10,7 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIEntityType;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial; import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.container.LocaleReader; 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")) { if (!one.getMeta().equalsIgnoreCase("") && ids.equalsIgnoreCase(info.getId() + ":" + info.getMeta()) && !one.getId().equalsIgnoreCase("0")) {
return one.getName(); return one.getName();
} }
} ids = one.getId();
for (NameList one : ListOfEntities) {
String ids = one.getId();
if (ids.equalsIgnoreCase(String.valueOf(info.getId())) && !one.getId().equalsIgnoreCase("0")) { if (ids.equalsIgnoreCase(String.valueOf(info.getId())) && !one.getId().equalsIgnoreCase("0")) {
return one.getName(); return one.getName();
} }
ids = one.getMinecraftName();
if (ids.equalsIgnoreCase(info.getName())) {
return one.getName();
}
} }
break; break;
case ENCHANT: case ENCHANT:
@ -137,10 +140,13 @@ public class NameTranslatorManager {
Set<String> keys = section.getKeys(false); Set<String> keys = section.getKeys(false);
ListOfNames.clear(); ListOfNames.clear();
for (String one : keys) { for (String one : keys) {
String id = one.contains(":") ? one.split(":")[0] : one;
String meta = one.contains(":") ? one.split(":")[1] : ""; String id = one.split("-")[0];
String MCName = section.getString(one + ".MCName"); id = id.contains(":") ? id.split(":")[0] : id;
String Name = section.getString(one + ".Name"); 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)); ListOfNames.add(new NameList(id, meta, Name, MCName));
} }
if (ListOfNames.size() != 0) if (ListOfNames.size() != 0)
@ -153,10 +159,11 @@ public class NameTranslatorManager {
Set<String> keys = section.getKeys(false); Set<String> keys = section.getKeys(false);
ListOfEntities.clear(); ListOfEntities.clear();
for (String one : keys) { 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 meta = one.contains(":") ? one.split(":")[1] : "";
String MCName = section.getString(one + ".MCName"); String MCName = one.split("-")[1];
String Name = section.getString(one + ".Name"); String Name = ItemFile.getConfig().getString("EntityList." + one);
ListOfEntities.add(new NameList(id, meta, Name, MCName)); ListOfEntities.add(new NameList(id, meta, Name, MCName));
} }
if (ListOfEntities.size() != 0) 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) { if (name == null) {
name = one.getName(); name = one.getName();
} }
c.get("ItemList." + one.getId() + ".MCName", one.getBukkitName()); c.get("ItemList." + (one.getId() == -1 ? one.getLegacyId() : one.getId()) + "-" + one.getBukkitName(), name);
c.get("ItemList." + one.getId() + ".Name", name);
} }
// Entity list for (CMIEntityType one : CMIEntityType.values()) {
c.get("EntityList.-1.MCName", "Player"); if (!one.isAlive())
c.get("EntityList.-1.Name", "Player"); continue;
c.get("EntityList.50.MCName", "Creeper");
c.get("EntityList.50.Name", "Creeper"); String n = String.valueOf(one.getId());
c.get("EntityList.51.MCName", "Skeleton");
c.get("EntityList.51.Name", "Skeleton"); String name = null;
c.get("EntityList.51:1.MCName", "Skeleton");
c.get("EntityList.51:1.Name", "WitherSkeleton"); if (c.getC().isConfigurationSection("EntityList." + n)) {
c.get("EntityList.51:2.MCName", "Skeleton"); name = c.getC().getString("EntityList." + n + ".Name");
c.get("EntityList.51:2.Name", "Skeleton Stray"); }
c.get("EntityList.52.MCName", "Spider");
c.get("EntityList.52.Name", "Spider"); if (name == null) {
c.get("EntityList.53.MCName", "Giant"); n = n + "-" + one.toString();
c.get("EntityList.53.Name", "Giant"); if (c.getC().isConfigurationSection("EntityList." + n)) {
c.get("EntityList.54.MCName", "Zombie"); name = c.getC().getString("EntityList." + n);
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"); if (name == null) {
c.get("EntityList.54:2.Name", "Zombie Husk"); name = one.getName();
c.get("EntityList.55.MCName", "Slime"); }
c.get("EntityList.55.Name", "Slime");
c.get("EntityList.56.MCName", "Ghast"); c.get("EntityList." + one.getId() + "-" + one.toString(), name);
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");
// Enchant list // Enchant list
c.get("EnchantList.0.MCName", "PROTECTION_ENVIRONMENTAL"); c.get("EnchantList.0.MCName", "PROTECTION_ENVIRONMENTAL");