Add Simulator to improvements

This commit is contained in:
2025-04-21 00:02:13 +02:00
parent a4eea298d2
commit 79edc1c591
17 changed files with 195 additions and 181 deletions
@@ -145,62 +145,76 @@ public class SWItem {
return item;
}
private void hideAttributes() {
if (itemMeta == null) return;
private SWItem hideAttributes() {
if (itemMeta == null) return this;
for (ItemFlag flag : EnumSet.allOf(ItemFlag.class)) {
itemMeta.addItemFlags(flag);
}
return this;
}
public ItemStack getItemStack() {
return itemStack;
}
public void setItemStack(ItemStack itemStack) {
public SWItem setItemStack(ItemStack itemStack) {
this.itemStack = itemStack;
itemMeta = itemStack.getItemMeta();
hideAttributes();
return this;
}
public ItemMeta getItemMeta() {
return itemMeta;
}
public void setItemMeta(ItemMeta itemMeta) {
public SWItem setItemMeta(ItemMeta itemMeta) {
this.itemMeta = itemMeta;
itemStack.setItemMeta(itemMeta);
hideAttributes();
return this;
}
public InvCallback getCallback() {
return callback;
}
public void setCallback(InvCallback callback) {
public SWItem setCallback(InvCallback callback) {
this.callback = callback;
return this;
}
public void setName(String name) {
public SWItem setName(String name) {
itemMeta.setDisplayName(name);
itemStack.setItemMeta(itemMeta);
return this;
}
public void setLore(List<String> lore) {
public SWItem setLore(List<String> lore) {
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
return this;
}
public void setLore(String... lore) {
public SWItem setLore(String... lore) {
itemMeta.setLore(Arrays.stream(lore).collect(Collectors.toList()));
itemStack.setItemMeta(itemMeta);
return this;
}
public void setEnchanted(boolean enchanted) {
public SWItem setEnchanted(boolean enchanted) {
if (enchanted){
itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true);
} else {
itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment());
}
itemStack.setItemMeta(itemMeta);
return this;
}
public SWItem setCustomModelData(int customModelData) {
itemMeta.setCustomModelData(customModelData);
itemStack.setItemMeta(itemMeta);
return this;
}
}