1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 23:13:48 +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.block.Skull;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.SlabType; import com.gamingmesh.jobs.CMILib.ItemManager.SlabType;
import com.gamingmesh.jobs.CMILib.VersionChecker.Version; import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.Debug;
@ -1288,6 +1289,8 @@ public enum CMIMaterial {
try { try {
ids = Integer.parseInt(id.split(":")[0]); ids = Integer.parseInt(id.split(":")[0]);
data = Integer.parseInt(id.split(":")[1]); data = Integer.parseInt(id.split(":")[1]);
if (ids <= 0)
return CMIMaterial.NONE;
return get(ids, data); return get(ids, data);
} catch (Exception ex) { } catch (Exception ex) {
} }
@ -1300,7 +1303,7 @@ public enum CMIMaterial {
return mat; return mat;
} }
CMIMaterial mat1 = ItemManager.byName.get(id); CMIMaterial mat1 = ItemManager.byName.get(id);
if (mat1 != null) { if (mat1 != null && mat1.getLegacyId() > 0) {
mat = get(mat1.getLegacyId(), data); mat = get(mat1.getLegacyId(), data);
if (mat != null) { if (mat != null) {
return mat; 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.JobProgression;
import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.Title; import com.gamingmesh.jobs.container.Title;
import com.gamingmesh.jobs.stuff.Debug;
import com.gamingmesh.jobs.stuff.PageInfo; import com.gamingmesh.jobs.stuff.PageInfo;
import com.gamingmesh.jobs.stuff.Sorting; import com.gamingmesh.jobs.stuff.Sorting;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;

View File

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

View File

@ -51,8 +51,9 @@ public class NameTranslatorManager {
case BREW: case BREW:
case FISH: case FISH:
case STRIPLOGS: case STRIPLOGS:
materialName = materialName.replace(" ", "");
CMIMaterial mat = CMIMaterial.get(materialName); CMIMaterial mat = CMIMaterial.get(materialName.replace(" ", ""));
NameList nameLs = ListOfNames.get(mat); NameList nameLs = ListOfNames.get(mat);
if (nameLs == null) { if (nameLs == null) {
return mat.getName(); return mat.getName();
@ -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); mat = CMIMaterial.get(id + ":" + meta);
nameLs = ListOfNames.get(mat); nameLs = ListOfNames.get(mat);
if (nameLs == null) { if (nameLs == null) {