mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-06 16:27:59 +01:00
Added enchantments for GUI items
https://www.spigotmc.org/threads/jobs-reborn.50989/page-213#post-3151424
This commit is contained in:
parent
fa61d87c96
commit
d520554b6d
@ -38,6 +38,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.potion.PotionType;
|
import org.bukkit.potion.PotionType;
|
||||||
|
|
||||||
@ -563,6 +564,20 @@ public class ConfigManager {
|
|||||||
} else
|
} else
|
||||||
skullMeta.setOwner(skullOwner);
|
skullMeta.setOwner(skullOwner);
|
||||||
GUIitem.setItemMeta(skullMeta);
|
GUIitem.setItemMeta(skullMeta);
|
||||||
|
} else if (guiSection.contains("Enchantments") && Jobs.getGCManager().JobsGUIEnableEnchants) {
|
||||||
|
List<String> enchants = guiSection.getStringList("Enchantments");
|
||||||
|
if (enchants.size() > 0) {
|
||||||
|
for (String str4 : enchants) {
|
||||||
|
String[] id = str4.split(":");
|
||||||
|
if ((GUIitem.getItemMeta() instanceof EnchantmentStorageMeta)) {
|
||||||
|
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
||||||
|
enchantMeta.addStoredEnchant(Enchantment.getByName(id[0]), Integer.parseInt(id[1]), true);
|
||||||
|
GUIitem.setItemMeta(enchantMeta);
|
||||||
|
} else {
|
||||||
|
GUIitem.addUnsafeEnchantment(Enchantment.getByName(id[0]), Integer.parseInt(id[1]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid Gui property. Please fix this if you want to use it!");
|
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid Gui property. Please fix this if you want to use it!");
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public class GeneralConfigManager {
|
|||||||
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
|
||||||
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat,
|
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat,
|
||||||
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
||||||
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
|
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin, JobsGUIEnableEnchants;
|
||||||
|
|
||||||
private int JobsGUIRows, JobsGUIBackButton,
|
private int JobsGUIRows, JobsGUIBackButton,
|
||||||
JobsGUIStartPosition,
|
JobsGUIStartPosition,
|
||||||
@ -916,6 +916,8 @@ public class GeneralConfigManager {
|
|||||||
c.getW().addComment("JobsGUI.SwitcheButtons", "With true left mouse button will join job and right will show more info",
|
c.getW().addComment("JobsGUI.SwitcheButtons", "With true left mouse button will join job and right will show more info",
|
||||||
"With false left mouse button will show more info, rigth will join job", "Dont forget to adjust locale file");
|
"With false left mouse button will show more info, rigth will join job", "Dont forget to adjust locale file");
|
||||||
JobsGUISwitcheButtons = c.get("JobsGUI.SwitcheButtons", false);
|
JobsGUISwitcheButtons = c.get("JobsGUI.SwitcheButtons", false);
|
||||||
|
c.getW().addComment("JobsGUI.EnableEnchants", "Enables the enchantment for items");
|
||||||
|
JobsGUIEnableEnchants = c.get("JobsGUI.EnableEnchants", true);
|
||||||
c.getW().addComment("JobsGUI.Rows", "Defines size in rows of GUI");
|
c.getW().addComment("JobsGUI.Rows", "Defines size in rows of GUI");
|
||||||
JobsGUIRows = c.get("JobsGUI.Rows", 5);
|
JobsGUIRows = c.get("JobsGUI.Rows", 5);
|
||||||
c.getW().addComment("JobsGUI.BackButtonSlot", "Defines back button slot in GUI");
|
c.getW().addComment("JobsGUI.BackButtonSlot", "Defines back button slot in GUI");
|
||||||
|
@ -85,6 +85,9 @@ Jobs:
|
|||||||
Id: 17
|
Id: 17
|
||||||
# data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3
|
# data of block, usualy its 0, but in example Diorite will have id of 1 and data of 3
|
||||||
Data: 2
|
Data: 2
|
||||||
|
# enchants in the item
|
||||||
|
Enchantments:
|
||||||
|
- 'DURABILITY:1'
|
||||||
# Defines maximum amount of daily quests player can have from THIS job
|
# Defines maximum amount of daily quests player can have from THIS job
|
||||||
# This will not have effect on overall quest amount player will have
|
# This will not have effect on overall quest amount player will have
|
||||||
maxDailyQuests: 3
|
maxDailyQuests: 3
|
||||||
|
Loading…
Reference in New Issue
Block a user