mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Action name/material translation fix
This commit is contained in:
parent
c18916bd56
commit
ef3eac05bc
@ -340,6 +340,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
|
||||
String materialName = info.getRealisticName();
|
||||
|
||||
|
||||
double income = info.getIncome(level, numjobs, player.maxJobsEquation);
|
||||
|
||||
income = boost.getFinalAmount(CurrencyType.MONEY, income);
|
||||
|
@ -62,7 +62,7 @@ public class NameTranslatorManager {
|
||||
|
||||
NameList nameLs = listOfNames.get(mat);
|
||||
|
||||
if (nameLs != null) {
|
||||
if (nameLs != null && !mat.isNone()) {
|
||||
if (meta != null && !meta.isEmpty() && mat.isCanHavePotionType() && Util.getPotionByName(meta) != null) {
|
||||
return nameLs.getName() + ":" + meta;
|
||||
}
|
||||
@ -105,6 +105,10 @@ public class NameTranslatorManager {
|
||||
}
|
||||
}
|
||||
|
||||
if (mat.isNone()) {
|
||||
return matName;
|
||||
}
|
||||
|
||||
return mat.getName();
|
||||
case BREED:
|
||||
case KILL:
|
||||
@ -218,7 +222,7 @@ public class NameTranslatorManager {
|
||||
listOfEntities.add(new NameList(id, meta, section.getString(one), mcName));
|
||||
}
|
||||
|
||||
if (listOfEntities.size() > 0)
|
||||
if (!listOfEntities.isEmpty())
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfEntities.size() + " &ecustom entity names");
|
||||
} else
|
||||
Jobs.consoleMsg("&cThe EntityList section not found in &6" + itemFile.fileName + " &cfile.");
|
||||
@ -258,7 +262,7 @@ public class NameTranslatorManager {
|
||||
listOfColors.add(new NameList(id, "", section.getString(one), mcName));
|
||||
}
|
||||
|
||||
if (listOfColors.size() > 0)
|
||||
if (!listOfColors.isEmpty())
|
||||
Jobs.consoleMsg("&eLoaded &6" + listOfColors.size() + " &ecustom color names");
|
||||
} else
|
||||
Jobs.consoleMsg("&cThe ColorList section not found in &6" + itemFile.fileName + " &cfile.");
|
||||
|
@ -22,6 +22,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
|
||||
import net.Zrips.CMILib.Colors.CMIChatColor;
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
|
||||
public class JobInfo {
|
||||
private ActionType actionType;
|
||||
|
@ -382,6 +382,36 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean usingLimitedItem(ItemStack iih, JobsPlayer jPlayer) {
|
||||
CMINBT nbt = new CMINBT(iih);
|
||||
Integer i = nbt.getInt("JobsLimited");
|
||||
|
||||
if (i == null)
|
||||
return false;
|
||||
|
||||
Job job = Jobs.getJob(i);
|
||||
if (job == null)
|
||||
return false;
|
||||
|
||||
JobProgression prog = jPlayer.getJobProgression(job);
|
||||
if (prog == null)
|
||||
return false;
|
||||
|
||||
String node = nbt.getString("JobsLimitedNode");
|
||||
if (node == null)
|
||||
return false;
|
||||
|
||||
for (JobLimitedItems oneItem : job.getLimitedItems().values()) {
|
||||
if (prog.getLevel() >= oneItem.getLevel() || !oneItem.getNode().equalsIgnoreCase(node))
|
||||
continue;
|
||||
|
||||
CMIActionBar.send(jPlayer.getPlayer(), Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", job.getDisplayName()));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onLimitedItemInteract(PlayerInteractEvent event) {
|
||||
|
||||
@ -416,30 +446,13 @@ public class JobsListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (usingLimitedItem(iih, jPlayer)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
String name = null;
|
||||
List<String> lore = new ArrayList<>();
|
||||
|
||||
CMINBT nbt = new CMINBT(iih);
|
||||
Integer i = nbt.getInt("JobsLimited");
|
||||
if (i != null) {
|
||||
Job job = Jobs.getJob(i);
|
||||
if (job != null) {
|
||||
JobProgression prog = jPlayer.getJobProgression(job);
|
||||
if (prog != null) {
|
||||
String node = nbt.getString("JobsLimitedNode");
|
||||
if (node != null) {
|
||||
for (JobLimitedItems oneItem : job.getLimitedItems().values()) {
|
||||
if (prog.getLevel() >= oneItem.getLevel() || !oneItem.getNode().equalsIgnoreCase(node))
|
||||
continue;
|
||||
event.setCancelled(true);
|
||||
CMIActionBar.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", job.getDisplayName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iih.hasItemMeta()) {
|
||||
ItemMeta meta = iih.getItemMeta();
|
||||
if (meta.hasDisplayName())
|
||||
@ -468,7 +481,7 @@ public class JobsListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
CMIActionBar.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", meinOk));
|
||||
|
||||
nbt = new CMINBT(iih);
|
||||
CMINBT nbt = new CMINBT(iih);
|
||||
nbt.setInt("JobsLimited", jobId);
|
||||
iih = (ItemStack) nbt.setString("JobsLimitedNode", itemNode);
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user