Disabled Item Merging

This commit is contained in:
Eric 2015-09-03 12:12:33 +02:00
parent 24c32b5e64
commit 36bf9e8623
2 changed files with 13 additions and 10 deletions

View File

@ -2,10 +2,11 @@
name: ShopChest name: ShopChest
main: de.epiceric.shopchest.ShopChest main: de.epiceric.shopchest.ShopChest
version: 1.4.6 version: 1.4.7
author: EpicEric author: EpicEric
website: https://www.spigotmc.org/resources/shopchest.11431/ website: https://www.spigotmc.org/resources/shopchest.11431/
depends: [Vault] depend: [Vault]
softdepend: [ClearLag]
permissions: permissions:
shopchest.*: shopchest.*:

View File

@ -2,6 +2,7 @@ package de.epiceric.shopchest.shop;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import java.util.UUID;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -12,6 +13,7 @@ import org.bukkit.block.DoubleChest;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -48,19 +50,19 @@ public class Shop {
Item item; Item item;
Location itemLocation; Location itemLocation;
ItemStack itemStack; ItemStack itemStack;
ItemMeta itemMeta = product.getItemMeta().clone();
itemMeta.setDisplayName(UUID.randomUUID().toString());
ArrayList<String> lore = new ArrayList<>();
lore.add("Shop Item");
itemMeta.setLore(lore);
itemLocation = new Location(location.getWorld(), hologram.getLocation().getX(), location.getY() + 1, hologram.getLocation().getZ()); itemLocation = new Location(location.getWorld(), hologram.getLocation().getX(), location.getY() + 1, hologram.getLocation().getZ());
itemStack = new ItemStack(product.getType(), 1, product.getDurability()); itemStack = new ItemStack(product.getType(), 1, product.getDurability());
itemStack.setItemMeta(product.getItemMeta()); itemStack.setItemMeta(itemMeta);
ArrayList<String> lore = new ArrayList<String>();
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);
item = location.getWorld().dropItem(itemLocation, itemStack); item = location.getWorld().dropItem(itemLocation, itemStack);
item.getItemStack().getItemMeta().setDisplayName(UUID.randomUUID().toString());
item.setVelocity(new Vector(0, 0, 0)); item.setVelocity(new Vector(0, 0, 0));
item.setMetadata("shopItem", new FixedMetadataValue(plugin, true)); item.setMetadata("shopItem", new FixedMetadataValue(plugin, true));