mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Fix display item bug AGGGGAIN! Now is really fixed
Former-commit-id: 621f86fb39a1e091caaadcdf86f877855e0450d9
This commit is contained in:
1 parent
39ad36a828
commit
ae57dabc82
3 files changed
+26
-8
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package org.maxgamer.quickshop.Listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.Event.Result;
|
||||
@@ -67,6 +69,19 @@ public class DisplayProtectionListener implements Listener {
|
||||
}
|
||||
|
||||
boolean itemStackCheck(ItemStack is) {
|
||||
return is!=null & is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().startsWith(ChatColor.RED + "QuickShop ");
|
||||
if(is==null) {
|
||||
return false;
|
||||
}
|
||||
if(is.getItemMeta().hasDisplayName()) {
|
||||
if( is.getItemMeta().getDisplayName().equals("QuickShop")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
java.util.List<String> lore = new ArrayList<String>();
|
||||
lore.add("QuickShop DisplayItem");
|
||||
if(is.getItemMeta().getLore().equals(lore)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
//import org.maxgamer.quickshop.Util.NMS;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
/**
|
||||
* @author Netherfoam A display item, that spawns a block above the chest and
|
||||
@@ -21,7 +19,6 @@ public class DisplayItem {
|
||||
private Shop shop;
|
||||
private ItemStack iStack;
|
||||
private Item item;
|
||||
private static int nextId = 0;
|
||||
|
||||
// private Location displayLoc;
|
||||
/**
|
||||
@@ -68,7 +65,13 @@ public class DisplayItem {
|
||||
}
|
||||
public void safeGuard(Item item) {
|
||||
item.setPickupDelay(Integer.MAX_VALUE);
|
||||
item.setCustomName(ChatColor.RED + "QuickShop "+UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
item.setCustomName("QuickShop");
|
||||
ItemMeta iMeta = item.getItemStack().getItemMeta();
|
||||
iMeta.setDisplayName("QuickShop");
|
||||
java.util.List<String> lore = new ArrayList<String>();
|
||||
lore.add("QuickShop DisplayItem");
|
||||
iMeta.setLore(lore);
|
||||
item.getItemStack().setItemMeta(iMeta);
|
||||
}
|
||||
/**
|
||||
* Removes all items floating ontop of the chest that aren't the display
|
||||
|
||||
Reference in new issue
Block a user