mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Fixed issue when used the enchanted books, then can't enchanted properly
- Added argument for signUpdate command - Removed hack for removing items from inventory when in browse GUI - Version up for player gliding, because not exists in the API
This commit is contained in:
parent
b9069e0137
commit
d62349badc
@ -21,16 +21,27 @@ public class signupdate implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
Jobs.getJobs().forEach(Jobs.getSignUtil()::SignUpdate);
|
||||
return true;
|
||||
}
|
||||
|
||||
Job oldjob = Jobs.getJob(args[0]);
|
||||
|
||||
SignTopType type = SignTopType.getType(args[0]);
|
||||
|
||||
if (type == SignTopType.toplist && oldjob == null) {
|
||||
if (oldjob == null) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length == 2) {
|
||||
SignTopType type = SignTopType.getType(args[1]);
|
||||
if (type != null) {
|
||||
Jobs.getSignUtil().SignUpdate(oldjob, type);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Jobs.getSignUtil().SignUpdate(oldjob);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class JobItems {
|
||||
if (enchants != null) {
|
||||
if (mat == CMIMaterial.ENCHANTED_BOOK) {
|
||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
||||
for (Entry<Enchantment, Integer> oneEnch : bookMeta.getEnchants().entrySet()) {
|
||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||
}
|
||||
} else {
|
||||
@ -100,13 +100,20 @@ public class JobItems {
|
||||
meta.setLore(TranslatedLore);
|
||||
}
|
||||
if (enchants != null) {
|
||||
if (item.getType() == CMIMaterial.ENCHANTED_BOOK.getMaterial()) {
|
||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) meta;
|
||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), true);
|
||||
}
|
||||
} else {
|
||||
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
|
||||
meta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public class JobsListener implements Listener {
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
final ItemStack clicked = event.getCurrentItem();
|
||||
//final ItemStack clicked = event.getCurrentItem();
|
||||
|
||||
GuiInfoList joblist = Jobs.getGUIManager().GuiList.get(player.getUniqueId());
|
||||
|
||||
@ -272,14 +272,15 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
player.updateInventory();
|
||||
|
||||
if (event.getClick().isShiftClick() && clicked != null && !clicked.getType().equals(Material.AIR))
|
||||
// hack, we don't need to remove items
|
||||
/*if (event.getClick().isShiftClick() && clicked != null && !clicked.getType().equals(Material.AIR))
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.getInventory().remove(clicked);
|
||||
player.updateInventory();
|
||||
}
|
||||
}, 1L);
|
||||
}, 1L);*/
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
|
@ -479,6 +479,7 @@ public class JobsPaymentListener implements Listener {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.PLACE), block);
|
||||
}
|
||||
|
||||
@ -1009,7 +1010,7 @@ public class JobsPaymentListener implements Listener {
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(playerName);
|
||||
} catch (Throwable e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
if (uuid == null)
|
||||
return;
|
||||
@ -1702,7 +1703,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1)
|
||||
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R2)
|
||||
&& !Jobs.getGCManager().payExploringWhenGliding && player.isGliding())
|
||||
return;
|
||||
|
||||
|
@ -9,13 +9,14 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
||||
|
||||
public class GiveItem {
|
||||
public static void GiveItemForPlayer(Player player, int id, int meta, int qty, String name, List<String> lore,
|
||||
HashMap<Enchantment, Integer> hashMap) {
|
||||
HashMap<Enchantment, Integer> enchants) {
|
||||
ItemStack itemStack = CMIMaterial.get(id, meta).newItemStack();
|
||||
itemStack.setAmount(qty);
|
||||
ItemMeta ItemMeta = itemStack.getItemMeta();
|
||||
@ -29,9 +30,18 @@ public class GiveItem {
|
||||
ItemMeta.setLore(TranslatedLore);
|
||||
}
|
||||
|
||||
for (Entry<Enchantment, Integer> OneEnchant : hashMap.entrySet()) {
|
||||
if (enchants != null) {
|
||||
if (itemStack.getType() == CMIMaterial.ENCHANTED_BOOK.getMaterial()) {
|
||||
EnchantmentStorageMeta bookMeta = (EnchantmentStorageMeta) ItemMeta;
|
||||
for (Entry<Enchantment, Integer> oneEnch : enchants.entrySet()) {
|
||||
bookMeta.addStoredEnchant(oneEnch.getKey(), oneEnch.getValue(), false);
|
||||
}
|
||||
} else {
|
||||
for (Entry<Enchantment, Integer> OneEnchant : enchants.entrySet()) {
|
||||
ItemMeta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
ItemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
||||
|
Loading…
Reference in New Issue
Block a user