mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-09 20:21:07 +00:00
ItemMeta of shop item should be applied + Remove Items with "shopItem" metadata on disable
This commit is contained in:
parent
3b734ac429
commit
f52be003ab
@ -23,7 +23,9 @@ import de.epiceric.shopchest.utils.Utils;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -340,6 +342,14 @@ public class ShopChest extends JavaPlugin {
|
||||
for (Shop shop : ShopUtils.getShops()) {
|
||||
ShopUtils.removeShop(shop, false);
|
||||
}
|
||||
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (Item item : world.getEntitiesByClass(Item.class)) {
|
||||
if (item.hasMetadata("shopItem")) {
|
||||
item.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeShops() {
|
||||
|
@ -84,16 +84,13 @@ public class Shop {
|
||||
Item item;
|
||||
Location itemLocation;
|
||||
ItemStack itemStack;
|
||||
ItemMeta itemMeta = product.getItemMeta().clone();
|
||||
ItemMeta itemMeta = product.getItemMeta();
|
||||
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());
|
||||
itemStack = new ItemStack(product);
|
||||
itemStack.setAmount(1);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
|
||||
item = location.getWorld().dropItem(itemLocation, itemStack);
|
||||
item.setVelocity(new Vector(0, 0, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user