Beim HangingPlaceEvent entsprechend reagieren und das ItemFrame via "isVisible(false)" unsichtbar machen
private void onHangingPlace(HangingPlaceEvent event)
{
if(!isFrameEntity(event.getEntity()) || event.getPlayer() == null)
{
return;
}
// Get the frame item that the player placed
ItemStack frame;
Player p = event.getPlayer();
if(p.getInventory().getItemInMainHand().getType() == Material.ITEM_FRAME ||
(glowFrame != null && p.getInventory().getItemInMainHand().getType() == glowFrame))
{
frame = p.getInventory().getItemInMainHand();
}
else if(p.getInventory().getItemInOffHand().getType() == Material.ITEM_FRAME ||
(glowFrame != null && p.getInventory().getItemInOffHand().getType() == glowFrame))
{
frame = p.getInventory().getItemInOffHand();
}
else
{
return;
}
// If the frame item has the invisible tag, make the placed item frame invisible
if(frame.getItemMeta().getPersistentDataContainer().has(invisibleKey, PersistentDataType.BYTE))
{
ItemFrame itemFrame = (ItemFrame) event.getEntity();
if(framesGlow)
{
itemFrame.setVisible(true);
itemFrame.setGlowing(true);
}
else
{
itemFrame.setVisible(false);
}
event.getEntity().getPersistentDataContainer().set(invisibleKey, PersistentDataType.BYTE, (byte) 1);
}
}