Commit d6b843a1 authored by kellerkindt's avatar kellerkindt
Browse files

Merge branch 'AddstarMC-upstream'

parents e85720e0 da3f5159
Pipeline #68 passed with stage
in 6 seconds
......@@ -753,57 +753,57 @@ public class SimpleShopHandler implements ShopHandler, Listener {
itemStack.setAmount(1);
}
}
Item item = shop.getWorld().dropItem(spawnLocation, itemStack);
ItemMeta meta = item.getItemStack().getItemMeta();
// prevent item from being merged (at least in some cases)
if (meta != null) {
meta.setDisplayName(shop.getId().toString());
}
// TODO experimental
if (scs.getConfiguration().isHoverTextEnabled()) {
if (scs.getConfiguration().isHoverTextPlayerCustomNameEnabled() && shop.getCustomHoverText() != null) {
String hoverText = shop.getCustomHoverText();
if (hoverText.length() > scs.getConfiguration().getHoverTextPlayerCustomNameMaxLength()) {
hoverText = hoverText.substring(0, scs.getConfiguration().getHoverTextPlayerCustomNameMaxLength());
}
// mark player text differently so one can distinguish between original SCS price and fake price
item.setCustomName(ChatColor.GOLD+"["+hoverText+"]");
item.setCustomNameVisible(true);
} else {
if (shop.getHoverText() != null && shop.getHoverText().length() > 0) {
item.setCustomName(shop.getHoverText());
if(itemStack.getType() != Material.AIR) {
Item item = Bukkit.getWorld(shop.getWorldId()).dropItem(spawnLocation, itemStack);
ItemMeta meta = item.getItemStack().getItemMeta();
// prevent item from being merged (at least in some cases)
if (meta != null) {
meta.setDisplayName(shop.getId().toString());
}
// TODO experimental
if (scs.getConfiguration().isHoverTextEnabled()) {
if (scs.getConfiguration().isHoverTextPlayerCustomNameEnabled() && shop.getCustomHoverText() != null) {
String hoverText = shop.getCustomHoverText();
if (hoverText.length() > scs.getConfiguration().getHoverTextPlayerCustomNameMaxLength()) {
hoverText = hoverText.substring(0, scs.getConfiguration().getHoverTextPlayerCustomNameMaxLength());
}
// mark player text differently so one can distinguish between original SCS price and fake price
item.setCustomName(ChatColor.GOLD + "[" + hoverText + "]");
item.setCustomNameVisible(true);
} else {
if (shop.getHoverText() != null && shop.getHoverText().length() > 0) {
item.setCustomName(shop.getHoverText());
item.setCustomNameVisible(true);
}
}
}
}
// System.out.println("droppedItem, Item-id: "+item.getEntityId()+", loc="+shop.getLocation()+", world="+shop.getWorld().getName());
if (item.getItemStack().getType() == Material.STONE && shop.getItemStack().getType() != Material.STONE) {
scs.getLogger().severe("Failed to drop Item (Item cannot be dropped), shop="+shop.getId()+", loc="+shop.getLocation());
item.remove();
return;
// System.out.println("failure, original: "+shop.getItemStack()+", material="+shop.getItemStack().getType()+", meta="+shop.getItemStack().getItemMeta()+", loc="+shop.getLocation()+", world="+shop.getWorld().getName());
}
// System.out.println("droppedItem, Item-id: "+item.getEntityId()+", loc="+shop.getLocation()+", world="+shop.getWorld().getName());
if (item.getItemStack().getType() == Material.STONE && shop.getItemStack().getType() != Material.STONE) {
scs.getLogger().severe("Failed to drop Item (Item cannot be dropped), shop=" + shop.getId() + ", loc=" + shop.getLocation());
item.remove();
return;
// System.out.println("failure, original: "+shop.getItemStack()+", material="+shop.getItemStack().getType()+", meta="+shop.getItemStack().getItemMeta()+", loc="+shop.getLocation()+", world="+shop.getWorld().getName());
}
/*
* barrier 2, astronomy high pickup delay which can't
* be reached in a normal Item life
* Does not work on mobs (mc1.7.9)
*/
item.setPickupDelay(Properties.DEFAULT_PICKUP_DELAY);
item.setVelocity(new Vector(0, 0.01, 0));
// add to lists
shopItems.put(shop, item);
itemShops.put(item, shop);
item.setPickupDelay(Properties.DEFAULT_PICKUP_DELAY);
item.setVelocity(new Vector(0, 0.01, 0));
// add to lists
shopItems.put(shop, item);
itemShops.put(item, shop);
}
// set visible
shop.setVisible(true);
visibleShops.add(shop);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment