mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-07 00:38:42 +01:00
Another fix for max jobs
This commit is contained in:
parent
6f69806bd1
commit
54fde9353f
@ -147,8 +147,10 @@ public class PermissionManager {
|
|||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uno.contains("max") && amount < t) {
|
if (uno.startsWith("jobs.max")) {
|
||||||
amount = t;
|
if (amount == 0D || t > amount) {
|
||||||
|
amount = t;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
amount += t;
|
amount += t;
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,8 @@ public class join implements Cmd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int confMaxJobs = Jobs.getGCManager().getMaxJobs();
|
|
||||||
short PlayerMaxJobs = (short) jPlayer.getJobProgression().size();
|
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"));
|
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.isHideIfNoEnoughPoints() && item.getRequiredTotalLevels() != -1 &&
|
if (item.isHideIfNoEnoughPoints() && item.getRequiredTotalLevels() != -1 &&
|
||||||
Jobs.getPlayerManager().getJobsPlayer(player).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"));
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ public class ShopManager {
|
|||||||
String jobColor = "";
|
String jobColor = "";
|
||||||
String levelColor = "";
|
String levelColor = "";
|
||||||
|
|
||||||
JobProgression prog = Jobs.getPlayerManager().getJobsPlayer(player).getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
if (prog == null) {
|
if (prog == null) {
|
||||||
jobColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsColor");
|
jobColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsColor");
|
||||||
levelColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsLevelColor");
|
levelColor = Jobs.getLanguage().getMessage("command.shop.info.reqJobsLevelColor");
|
||||||
@ -180,7 +180,7 @@ public class ShopManager {
|
|||||||
|
|
||||||
if (item.getRequiredTotalLevels() != -1) {
|
if (item.getRequiredTotalLevels() != -1) {
|
||||||
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevel",
|
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()));
|
? Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevelColor") : "") + item.getRequiredTotalLevels()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ public class ShopManager {
|
|||||||
skullMeta.setLore(Lore);
|
skullMeta.setLore(Lore);
|
||||||
|
|
||||||
if (item.isHeadOwner()) {
|
if (item.isHeadOwner()) {
|
||||||
Jobs.getNms().setSkullOwner(skullMeta, Jobs.getPlayerManager().getJobsPlayer(player).getPlayer());
|
Jobs.getNms().setSkullOwner(skullMeta, jPlayer.getPlayer());
|
||||||
} else {
|
} else {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead());
|
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()) {
|
for (Entry<String, Integer> oneJob : item.getRequiredJobs().entrySet()) {
|
||||||
Job tempJob = Jobs.getJob(oneJob.getKey());
|
Job tempJob = Jobs.getJob(oneJob.getKey());
|
||||||
if (tempJob == null)
|
if (tempJob == null)
|
||||||
@ -254,8 +250,7 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (JobItems one : item.getitems()) {
|
for (JobItems one : item.getitems()) {
|
||||||
ItemStack itemStack = one.getItemStack(player);
|
GiveItem.GiveItemForPlayer(player, one.getItemStack(player));
|
||||||
GiveItem.GiveItemForPlayer(player, itemStack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pointsInfo.takePoints(item.getPrice());
|
pointsInfo.takePoints(item.getPrice());
|
||||||
|
Loading…
Reference in New Issue
Block a user