mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 23:13:48 +01:00
Add optional requirement for jobs shop items by RequiredTotalLevels
This commit is contained in:
parent
75a5ff8c53
commit
6e9da41829
@ -827,8 +827,10 @@ public class GeneralConfigManager {
|
|||||||
c.getW().addComment("JobsBrowse.ShowPenaltyBonus", "Do you want to show GUI when performing /jobs join command");
|
c.getW().addComment("JobsBrowse.ShowPenaltyBonus", "Do you want to show GUI when performing /jobs join command");
|
||||||
JobsGUIOpenOnJoin = c.get("JobsGUI.OpenOnJoin", true);
|
JobsGUIOpenOnJoin = c.get("JobsGUI.OpenOnJoin", true);
|
||||||
|
|
||||||
guiBackButton = new ItemStack(Material.getMaterial(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN")), 1, (byte) c.get("JobsGUI.BackButton.Data", 0));
|
Material tmat = Material.getMaterial(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
|
||||||
guiFiller = new ItemStack(Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE")), 1, (byte) c.get("JobsGUI.Filler.Data", 15));
|
guiBackButton = new ItemStack(tmat == null ? Material.JACK_O_LANTERN : tmat, 1, (byte) c.get("JobsGUI.BackButton.Data", 0));
|
||||||
|
tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));
|
||||||
|
guiFiller = new ItemStack(tmat == null ? Material.STAINED_GLASS_PANE : tmat, 1, (byte) c.get("JobsGUI.Filler.Data", 15));
|
||||||
|
|
||||||
c.getW().addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost");
|
c.getW().addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost");
|
||||||
useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false);
|
useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false);
|
||||||
|
@ -190,12 +190,14 @@ public class LanguageManager {
|
|||||||
c.get("command.shop.info.price", "&ePrice: &6%price%");
|
c.get("command.shop.info.price", "&ePrice: &6%price%");
|
||||||
c.get("command.shop.info.reqJobs", "&eRequired jobs:");
|
c.get("command.shop.info.reqJobs", "&eRequired jobs:");
|
||||||
c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
|
c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
|
||||||
|
c.get("command.shop.info.reqTotalLevel", "&6Required total level: &e%totalLevel%");
|
||||||
c.get("command.shop.info.cantOpen", "&cCan't open this page");
|
c.get("command.shop.info.cantOpen", "&cCan't open this page");
|
||||||
|
|
||||||
c.get("command.shop.info.NoPermForItem", "&cYou don't have required permissions for this item!");
|
c.get("command.shop.info.NoPermForItem", "&cYou don't have required permissions for this item!");
|
||||||
c.get("command.shop.info.NoPermToBuy", "&cNo permissions to buy this item");
|
c.get("command.shop.info.NoPermToBuy", "&cNo permissions to buy this item");
|
||||||
c.get("command.shop.info.NoJobReqForitem", "&cYou don't have required job (&6%jobname%&e) with required (&6%joblevel%&e) level");
|
c.get("command.shop.info.NoJobReqForitem", "&cYou don't have required job (&6%jobname%&e) with required (&6%joblevel%&e) level");
|
||||||
c.get("command.shop.info.NoPoints", "&cYou don't have enough points");
|
c.get("command.shop.info.NoPoints", "&cYou don't have enough points");
|
||||||
|
c.get("command.shop.info.NoTotalLevel", "&cTotal jobs level is too low (%totalLevel%)");
|
||||||
c.get("command.shop.info.Paid", "&eYou have paid &6%amount% &efor this item");
|
c.get("command.shop.info.Paid", "&eYou have paid &6%amount% &efor this item");
|
||||||
c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
|
c.get("command.shop.info.reqJobsList", " &6%jobsname%&e: &e%level% lvl");
|
||||||
|
|
||||||
|
@ -106,6 +106,12 @@ public class ShopManager {
|
|||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoPoints"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getRequiredTotalLevels() != -1 && Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels() < item.getRequiredTotalLevels()) {
|
||||||
|
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.NoTotalLevel", "%totalLevel%", Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String one : item.getCommands()) {
|
for (String one : item.getCommands()) {
|
||||||
@ -282,6 +288,11 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getRequiredTotalLevels() != -1) {
|
||||||
|
Lore.add(Jobs.getLanguage().getMessage("command.shop.info.reqTotalLevel",
|
||||||
|
"%totalLevel%", (Jobs.getPlayerManager().getJobsPlayer(player).getTotalLevels() < item.getRequiredTotalLevels() ? ChatColor.DARK_RED + "" : "") + item.getRequiredTotalLevels()));
|
||||||
|
}
|
||||||
|
|
||||||
meta.setLore(Lore);
|
meta.setLore(Lore);
|
||||||
GUIitem.setItemMeta(meta);
|
GUIitem.setItemMeta(meta);
|
||||||
GuiInv.setItem(i, GUIitem);
|
GuiInv.setItem(i, GUIitem);
|
||||||
@ -364,6 +375,9 @@ public class ShopManager {
|
|||||||
if (NameSection.isList("RequiredPermission"))
|
if (NameSection.isList("RequiredPermission"))
|
||||||
Sitem.setRequiredPerm(NameSection.getStringList("RequiredPermission"));
|
Sitem.setRequiredPerm(NameSection.getStringList("RequiredPermission"));
|
||||||
|
|
||||||
|
if (NameSection.isInt("RequiredTotalLevels"))
|
||||||
|
Sitem.setRequiredTotalLevels(NameSection.getInt("RequiredTotalLevels"));
|
||||||
|
|
||||||
if (NameSection.isList("RequiredJobLevels")) {
|
if (NameSection.isList("RequiredJobLevels")) {
|
||||||
HashMap<String, Integer> RequiredJobs = new HashMap<String, Integer>();
|
HashMap<String, Integer> RequiredJobs = new HashMap<String, Integer>();
|
||||||
for (String one : NameSection.getStringList("RequiredJobLevels")) {
|
for (String one : NameSection.getStringList("RequiredJobLevels")) {
|
||||||
|
@ -79,6 +79,14 @@ public class JobsPlayer {
|
|||||||
this.player = Bukkit.getPlayer(userName);
|
this.player = Bukkit.getPlayer(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTotalLevels() {
|
||||||
|
int i = 0;
|
||||||
|
for (JobProgression job : progression) {
|
||||||
|
i += job.getLevel();
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
public PaymentData getPaymentLimit() {
|
public PaymentData getPaymentLimit() {
|
||||||
if (paymentLimits == null) {
|
if (paymentLimits == null) {
|
||||||
paymentLimits = Jobs.getJobsDAO().getPlayersLimits(this);
|
paymentLimits = Jobs.getJobsDAO().getPlayersLimits(this);
|
||||||
|
@ -20,6 +20,7 @@ public class ShopItem {
|
|||||||
private List<String> IconLore = new ArrayList<String>();
|
private List<String> IconLore = new ArrayList<String>();
|
||||||
|
|
||||||
private boolean HideWithoutPerm = false;
|
private boolean HideWithoutPerm = false;
|
||||||
|
private int RequiredTotalLevels = -1;
|
||||||
|
|
||||||
private List<String> RequiredPerm = new ArrayList<String>();
|
private List<String> RequiredPerm = new ArrayList<String>();
|
||||||
private HashMap<String, Integer> RequiredJobs = new HashMap<String, Integer>();
|
private HashMap<String, Integer> RequiredJobs = new HashMap<String, Integer>();
|
||||||
@ -133,4 +134,12 @@ public class ShopItem {
|
|||||||
public String getIconName() {
|
public String getIconName() {
|
||||||
return this.IconName;
|
return this.IconName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getRequiredTotalLevels() {
|
||||||
|
return RequiredTotalLevels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequiredTotalLevels(int requiredTotalLevels) {
|
||||||
|
RequiredTotalLevels = requiredTotalLevels;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,6 @@ import com.gamingmesh.jobs.container.FastPayment;
|
|||||||
import com.gamingmesh.jobs.container.JobProgression;
|
import com.gamingmesh.jobs.container.JobProgression;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
import com.gamingmesh.jobs.stuff.Debug;
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
public class JobsPaymentListener implements Listener {
|
public class JobsPaymentListener implements Listener {
|
||||||
|
Loading…
Reference in New Issue
Block a user