1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 12:35:28 +01:00

Correcting income when we have same materials but different data values

This commit is contained in:
Zrips 2020-02-15 17:48:22 +02:00
parent a707bf8155
commit c38fe742b4
4 changed files with 14 additions and 5 deletions

View File

@ -22,6 +22,7 @@ import org.bukkit.Material;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.BaseActionInfo; import com.gamingmesh.jobs.container.BaseActionInfo;
import com.gamingmesh.jobs.stuff.Debug;
public abstract class MaterialActionInfo extends BaseActionInfo { public abstract class MaterialActionInfo extends BaseActionInfo {
private Material material; private Material material;

View File

@ -1171,14 +1171,13 @@ public class ConfigManager {
continue; continue;
if (material != null && material.getMaterial() != null && material.getMaterial() == Material.AIR) { if (material != null && material.getMaterial() != null && material.getMaterial() == Material.AIR) {
log.warning("Job " + jobKey + " " + actionType.getName() + " cant recognize material! (" + key+")"); log.warning("Job " + jobKey + " " + actionType.getName() + " cant recognize material! (" + key + ")");
continue; continue;
} }
if (material != null && Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty()) if (material != null && Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty())
meta = String.valueOf(material.getData()); meta = String.valueOf(material.getData());
c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) { c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) {
// Need to include those ones and count as regular blocks // Need to include those ones and count as regular blocks

View File

@ -21,6 +21,8 @@ package com.gamingmesh.jobs.container;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -208,7 +210,14 @@ public class Job {
public JobInfo getJobInfo(ActionInfo action, int level) { public JobInfo getJobInfo(ActionInfo action, int level) {
for (JobInfo info : getJobInfo(action.getType())) { for (JobInfo info : getJobInfo(action.getType())) {
if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())) { if (info.getName().equalsIgnoreCase(action.getNameWithSub()) || (info.getName() + ":" + info.getMeta()).equalsIgnoreCase(action.getNameWithSub())) {
if (!info.isInLevelRange(level))
break;
return info;
}
}
for (JobInfo info : getJobInfo(action.getType())) {
if (info.getName().equalsIgnoreCase(action.getName())) {
if (!info.isInLevelRange(level)) if (!info.isInLevelRange(level))
break; break;
return info; return info;