From 36bf9e8623bfd84c5581526ca7b5b3bac43849a8 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 3 Sep 2015 12:12:33 +0200 Subject: [PATCH] Disabled Item Merging --- plugin.yml | 5 +++-- src/de/epiceric/shopchest/shop/Shop.java | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/plugin.yml b/plugin.yml index 81d3531..048c620 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,10 +2,11 @@ name: ShopChest main: de.epiceric.shopchest.ShopChest -version: 1.4.6 +version: 1.4.7 author: EpicEric website: https://www.spigotmc.org/resources/shopchest.11431/ -depends: [Vault] +depend: [Vault] +softdepend: [ClearLag] permissions: shopchest.*: diff --git a/src/de/epiceric/shopchest/shop/Shop.java b/src/de/epiceric/shopchest/shop/Shop.java index 582cbbd..633b150 100644 --- a/src/de/epiceric/shopchest/shop/Shop.java +++ b/src/de/epiceric/shopchest/shop/Shop.java @@ -2,6 +2,7 @@ package de.epiceric.shopchest.shop; import java.util.ArrayList; import java.util.Random; +import java.util.UUID; import org.bukkit.Location; import org.bukkit.Material; @@ -12,6 +13,7 @@ import org.bukkit.block.DoubleChest; import org.bukkit.entity.Item; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.util.Vector; @@ -48,19 +50,19 @@ public class Shop { Item item; Location itemLocation; ItemStack itemStack; + ItemMeta itemMeta = product.getItemMeta().clone(); + itemMeta.setDisplayName(UUID.randomUUID().toString()); + + ArrayList lore = new ArrayList<>(); + lore.add("Shop Item"); + itemMeta.setLore(lore); itemLocation = new Location(location.getWorld(), hologram.getLocation().getX(), location.getY() + 1, hologram.getLocation().getZ()); itemStack = new ItemStack(product.getType(), 1, product.getDurability()); - itemStack.setItemMeta(product.getItemMeta()); - - ArrayList lore = new ArrayList(); - lore.add("This is an Item of ShopChest"); - lore.add("This text is just to prevent merging."); - lore.add("ID: " + String.valueOf(new Random().nextInt())); - - itemStack.getItemMeta().setLore(lore); + itemStack.setItemMeta(itemMeta); item = location.getWorld().dropItem(itemLocation, itemStack); + item.getItemStack().getItemMeta().setDisplayName(UUID.randomUUID().toString()); item.setVelocity(new Vector(0, 0, 0)); item.setMetadata("shopItem", new FixedMetadataValue(plugin, true));