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

Fixing name translation and material recognition in some particular

situations
This commit is contained in:
Zrips 2020-02-15 18:33:18 +02:00
parent c38fe742b4
commit d9791c51fa
4 changed files with 11 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.Skull;
import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.SlabType;
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
import com.gamingmesh.jobs.stuff.Debug;
@ -1059,7 +1060,7 @@ public enum CMIMaterial {
LEGACY_DIODE_BLOCK_OFF(93, 0, null, "Diode Block Off"),
LEGACY_DIODE_BLOCK_ON(94, 0, null, "Diode Block On"),
LEGACY_BREWING_STAND(117, null, null, "LEGACY_BREWING_STAND"),
// LEGACY_CAULDRON(118, 0, null, "LEGACY_CAULDRON", ""),
// LEGACY_REDSTONE_LAMP_ON(124, null, null, "LEGACY_REDSTONE_LAMP_ON", ""),
// LEGACY_WOOD_DOUBLE_STEP(125, null, null, "LEGACY_WOOD_DOUBLE_STEP", ""),
@ -1288,6 +1289,8 @@ public enum CMIMaterial {
try {
ids = Integer.parseInt(id.split(":")[0]);
data = Integer.parseInt(id.split(":")[1]);
if (ids <= 0)
return CMIMaterial.NONE;
return get(ids, data);
} catch (Exception ex) {
}
@ -1300,7 +1303,7 @@ public enum CMIMaterial {
return mat;
}
CMIMaterial mat1 = ItemManager.byName.get(id);
if (mat1 != null) {
if (mat1 != null && mat1.getLegacyId() > 0) {
mat = get(mat1.getLegacyId(), data);
if (mat != null) {
return mat;

View File

@ -24,6 +24,7 @@ import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.container.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Title;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.PageInfo;
import com.gamingmesh.jobs.stuff.Sorting;
import com.gamingmesh.jobs.stuff.Util;

View File

@ -1161,6 +1161,7 @@ public class ConfigManager {
}
}
}
break;
default:
break;

View File

@ -51,12 +51,13 @@ public class NameTranslatorManager {
case BREW:
case FISH:
case STRIPLOGS:
materialName = materialName.replace(" ", "");
CMIMaterial mat = CMIMaterial.get(materialName);
CMIMaterial mat = CMIMaterial.get(materialName.replace(" ", ""));
NameList nameLs = ListOfNames.get(mat);
if (nameLs == null) {
return mat.getName();
}
}
if (meta != null && !meta.isEmpty()) {
mat = CMIMaterial.get(materialName + ":" + meta);
@ -66,7 +67,7 @@ public class NameTranslatorManager {
}
}
if (id != null && meta != null && !meta.isEmpty()) {
if (id != null && id > 0 && meta != null && !meta.isEmpty()) {
mat = CMIMaterial.get(id + ":" + meta);
nameLs = ListOfNames.get(mat);
if (nameLs == null) {