Hiding item specials
Dieser Commit ist enthalten in:
Ursprung
fc108694c8
Commit
30ea4e5dcf
@ -2,6 +2,7 @@ package de.steamwar.inventory;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ public class SWItem {
|
|||||||
public SWItem(){
|
public SWItem(){
|
||||||
itemStack = new ItemStack(Material.AIR);
|
itemStack = new ItemStack(Material.AIR);
|
||||||
itemMeta = itemStack.getItemMeta();
|
itemMeta = itemStack.getItemMeta();
|
||||||
|
hideAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SWItem(Material material, String name){
|
public SWItem(Material material, String name){
|
||||||
@ -30,6 +32,7 @@ public class SWItem {
|
|||||||
public SWItem(Material material, byte meta, String name, List<String> lore, boolean enchanted, InvCallback c){
|
public SWItem(Material material, byte meta, String name, List<String> lore, boolean enchanted, InvCallback c){
|
||||||
itemStack = new ItemStack(material, 1, (short)0, meta);
|
itemStack = new ItemStack(material, 1, (short)0, meta);
|
||||||
itemMeta = itemStack.getItemMeta();
|
itemMeta = itemStack.getItemMeta();
|
||||||
|
hideAttributes();
|
||||||
itemMeta.setDisplayName(name);
|
itemMeta.setDisplayName(name);
|
||||||
if(lore != null && !lore.isEmpty())
|
if(lore != null && !lore.isEmpty())
|
||||||
itemMeta.setLore(lore);
|
itemMeta.setLore(lore);
|
||||||
@ -39,13 +42,23 @@ public class SWItem {
|
|||||||
callback = c;
|
callback = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void hideAttributes(){
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_DESTROYS);
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_PLACED_ON);
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemStack(ItemStack itemStack) {
|
public void setItemStack(ItemStack itemStack) {
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
this.itemMeta = itemStack.getItemMeta();
|
itemMeta = itemStack.getItemMeta();
|
||||||
|
hideAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemMeta getItemMeta() {
|
public ItemMeta getItemMeta() {
|
||||||
@ -54,7 +67,8 @@ public class SWItem {
|
|||||||
|
|
||||||
public void setItemMeta(ItemMeta itemMeta) {
|
public void setItemMeta(ItemMeta itemMeta) {
|
||||||
this.itemMeta = itemMeta;
|
this.itemMeta = itemMeta;
|
||||||
this.itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
hideAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InvCallback getCallback() {
|
public InvCallback getCallback() {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren