mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-18 22:21:26 +01:00
Hiding more information when requirements are not met for shop items
This commit is contained in:
parent
789e8ff7a6
commit
aba467be70
@ -65,6 +65,7 @@ import com.gamingmesh.jobs.stuff.Util;
|
|||||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||||
import net.Zrips.CMILib.NBT.CMINBT;
|
import net.Zrips.CMILib.NBT.CMINBT;
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
@ -487,6 +488,9 @@ public class PlayerManager {
|
|||||||
|
|
||||||
job.updateTotalPlayers();
|
job.updateTotalPlayers();
|
||||||
jPlayer.maxJobsEquation = getMaxJobs(jPlayer);
|
jPlayer.maxJobsEquation = getMaxJobs(jPlayer);
|
||||||
|
|
||||||
|
// Removing from cached item boost for recalculation
|
||||||
|
cache.remove(jPlayer.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void performCommandsOnLeave(JobsPlayer jPlayer, Job job) {
|
private static void performCommandsOnLeave(JobsPlayer jPlayer, Job job) {
|
||||||
@ -528,6 +532,10 @@ public class PlayerManager {
|
|||||||
|
|
||||||
Jobs.getSignUtil().updateAllSign(job);
|
Jobs.getSignUtil().updateAllSign(job);
|
||||||
job.updateTotalPlayers();
|
job.updateTotalPlayers();
|
||||||
|
|
||||||
|
// Removing from cached item boost for recalculation
|
||||||
|
cache.remove(jPlayer.getUniqueId());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1055,6 +1063,8 @@ public class PlayerManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CMIDebug.d("get bonus item");
|
||||||
jitems.add(getJobsItemByNbt(item));
|
jitems.add(getJobsItemByNbt(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,11 +113,14 @@ public class ShopManager {
|
|||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
CMIMaterial mat = CMIMaterial.get(item.getIconMaterial());
|
CMIMaterial mat = CMIMaterial.get(item.getIconMaterial());
|
||||||
|
|
||||||
|
boolean hiddenLore = false;
|
||||||
|
|
||||||
if (item.isHideWithoutPerm()) {
|
if (item.isHideWithoutPerm()) {
|
||||||
for (String onePerm : item.getRequiredPerm()) {
|
for (String onePerm : item.getRequiredPerm()) {
|
||||||
if (!player.hasPermission(onePerm)) {
|
if (!player.hasPermission(onePerm)) {
|
||||||
mat = CMIMaterial.STONE_BUTTON;
|
mat = CMIMaterial.STONE_BUTTON;
|
||||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy"));
|
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPermToBuy"));
|
||||||
|
hiddenLore = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,6 +130,7 @@ public class ShopManager {
|
|||||||
jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) {
|
jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) {
|
||||||
mat = CMIMaterial.STONE_BUTTON;
|
mat = CMIMaterial.STONE_BUTTON;
|
||||||
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
||||||
|
hiddenLore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mat == CMIMaterial.NONE)
|
if (mat == CMIMaterial.NONE)
|
||||||
@ -142,6 +146,7 @@ public class ShopManager {
|
|||||||
if (item.getIconName() != null)
|
if (item.getIconName() != null)
|
||||||
meta.setDisplayName(item.getIconName());
|
meta.setDisplayName(item.getIconName());
|
||||||
|
|
||||||
|
if (!hiddenLore) {
|
||||||
lore.addAll(item.getIconLore());
|
lore.addAll(item.getIconLore());
|
||||||
|
|
||||||
if (item.getPointPrice() > 0) {
|
if (item.getPointPrice() > 0) {
|
||||||
@ -185,6 +190,7 @@ public class ShopManager {
|
|||||||
"%totalLevel%", (jPlayer.getTotalLevels() < item.getRequiredTotalLevels()
|
"%totalLevel%", (jPlayer.getTotalLevels() < item.getRequiredTotalLevels()
|
||||||
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
|
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
|
|
||||||
|
@ -225,8 +225,15 @@ public class Job {
|
|||||||
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
||||||
eq.setVariable("jobstotalplayers", getTotalPlayers());
|
eq.setVariable("jobstotalplayers", getTotalPlayers());
|
||||||
|
|
||||||
double now = eq.getValue();
|
double now = 0D;
|
||||||
CMIDebug.d("Now",now);
|
try {
|
||||||
|
now = eq.getValue();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMIDebug.d("Now", now, this.getName(), getTotalPlayers(), now == Double.POSITIVE_INFINITY);
|
||||||
|
|
||||||
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
|
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
|
||||||
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user