1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-04 23:37:49 +01:00

Another fix for max jobs

This commit is contained in:
montlikadani 2020-09-05 16:40:41 +02:00
parent 6f69806bd1
commit 54fde9353f
3 changed files with 10 additions and 14 deletions

View File

@ -147,8 +147,10 @@ public class PermissionManager {
} catch (NumberFormatException e) {
}
if (uno.contains("max") && amount < t) {
amount = t;
if (uno.startsWith("jobs.max")) {
if (amount == 0D || t > amount) {
amount = t;
}
} else {
amount += t;
}

View File

@ -58,9 +58,8 @@ public class join implements Cmd {
return true;
}
int confMaxJobs = Jobs.getGCManager().getMaxJobs();
short PlayerMaxJobs = (short) jPlayer.getJobProgression().size();
if (confMaxJobs > 0 && PlayerMaxJobs >= confMaxJobs && !Jobs.getPlayerManager().getJobsLimit(jPlayer, PlayerMaxJobs)) {
if (!Jobs.getPlayerManager().getJobsLimit(jPlayer, PlayerMaxJobs)) {
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
return true;
}

View File

@ -132,7 +132,7 @@ public class ShopManager {
}
if (item.isHideIfNoEnoughPoints() && item.getRequiredTotalLevels() != -1 &&
Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels() < item.getRequiredTotalLevels()) {
jPlayer.getTotalLevels() < item.getRequiredTotalLevels()) {
mat = CMIMaterial.STONE_BUTTON;
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
}
@ -164,7 +164,7 @@ public class ShopManager {
String jobColor = "";
String levelColor = "";
JobProgression prog = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression(job);
JobProgression prog = jPlayer.getJobProgression(job);
if (prog == null) {
jobColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsColor");
levelColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsLevelColor");
@ -180,7 +180,7 @@ public class ShopManager {
if (item.getRequiredTotalLevels() != -1) {
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevel",
"%totalLevel%", (Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels() < item.getRequiredTotalLevels()
"%totalLevel%", (jPlayer.getTotalLevels() < item.getRequiredTotalLevels()
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
}
@ -195,7 +195,7 @@ public class ShopManager {
skullMeta.setLore(Lore);
if (item.isHeadOwner()) {
Jobs.getNms().setSkullOwner(skullMeta, Jobs.getPlayerManager().getJobsPlayer(player).getPlayer());
Jobs.getNms().setSkullOwner(skullMeta, jPlayer.getPlayer());
} else {
@SuppressWarnings("deprecation")
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead());
@ -214,10 +214,6 @@ public class ShopManager {
}
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
if (jPlayer == null)
return;
for (Entry<String, Integer> oneJob : item.getRequiredJobs().entrySet()) {
Job tempJob = Jobs.getJob(oneJob.getKey());
if (tempJob == null)
@ -254,8 +250,7 @@ public class ShopManager {
}
for (JobItems one : item.getitems()) {
ItemStack itemStack = one.getItemStack(player);
GiveItem.GiveItemForPlayer(player, itemStack);
GiveItem.GiveItemForPlayer(player, one.getItemStack(player));
}
pointsInfo.takePoints(item.getPrice());