mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +01:00
Fixed issue when buying items from shop and not setting enchants to item
This commit is contained in:
parent
5aa4f0b763
commit
892c91cdf0
@ -90,9 +90,7 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean openShopGui(Player player, Integer page) {
|
public boolean openShopGui(Player player, Integer page) {
|
||||||
|
|
||||||
List<ShopItem> ls = getItemsByPage(page);
|
List<ShopItem> ls = getItemsByPage(page);
|
||||||
|
|
||||||
if (ls.isEmpty()) {
|
if (ls.isEmpty()) {
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.cantOpen"));
|
player.sendMessage(Jobs.getLanguage().getMessage("command.shop.info.cantOpen"));
|
||||||
return false;
|
return false;
|
||||||
@ -108,7 +106,6 @@ public class ShopManager {
|
|||||||
// if (title.length() > 32)
|
// if (title.length() > 32)
|
||||||
// title = title.substring(0, 30) + "..";
|
// title = title.substring(0, 30) + "..";
|
||||||
|
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||||
|
|
||||||
PlayerPoints pointsInfo = jPlayer.getPointsData();
|
PlayerPoints pointsInfo = jPlayer.getPointsData();
|
||||||
@ -401,13 +398,10 @@ public class ShopManager {
|
|||||||
if (NameSection.isConfigurationSection("GiveItems")) {
|
if (NameSection.isConfigurationSection("GiveItems")) {
|
||||||
ConfigurationSection itemsSection = NameSection.getConfigurationSection("GiveItems");
|
ConfigurationSection itemsSection = NameSection.getConfigurationSection("GiveItems");
|
||||||
Set<String> itemKeys = itemsSection.getKeys(false);
|
Set<String> itemKeys = itemsSection.getKeys(false);
|
||||||
|
|
||||||
List<JobItems> items = new ArrayList<>();
|
List<JobItems> items = new ArrayList<>();
|
||||||
|
|
||||||
for (String oneItemName : itemKeys) {
|
for (String oneItemName : itemKeys) {
|
||||||
|
|
||||||
ConfigurationSection itemSection = itemsSection.getConfigurationSection(oneItemName);
|
ConfigurationSection itemSection = itemsSection.getConfigurationSection(oneItemName);
|
||||||
|
|
||||||
String node = oneItemName.toLowerCase();
|
String node = oneItemName.toLowerCase();
|
||||||
|
|
||||||
String id = null;
|
String id = null;
|
||||||
@ -433,14 +427,13 @@ public class ShopManager {
|
|||||||
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
HashMap<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
if (itemSection.contains("Enchants"))
|
if (itemSection.contains("Enchants"))
|
||||||
for (String eachLine : itemSection.getStringList("Enchants")) {
|
for (String eachLine : itemSection.getStringList("Enchants")) {
|
||||||
|
|
||||||
if (!eachLine.contains("="))
|
if (!eachLine.contains("="))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String[] split = eachLine.split("=");
|
String[] split = eachLine.split("=");
|
||||||
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
|
Enchantment ench = CMIEnchantment.getEnchantment(split[0]);
|
||||||
Integer level = 1;
|
Integer level = 1;
|
||||||
if (split.length > 2) {
|
if (split.length > 1) {
|
||||||
try {
|
try {
|
||||||
level = Integer.parseInt(split[1]);
|
level = Integer.parseInt(split[1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user