LinkedBeaconTeleporterItem generates own ItemStack

master
Ruakij 4 years ago
parent a296a190c6
commit 3d757a6ccf

@ -13,11 +13,11 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
// INFO: Safe to store as its always cloned by bukkit // INFO: Safe to store as its always cloned by bukkit
ItemStack item; ItemStack item;
public LinkedBeaconTeleporterItem(ItemStack item){ public LinkedBeaconTeleporterItem(){
// Create a new LinkedBeaconTeleporter // Create a new LinkedBeaconTeleporter
super(); super();
this.item = item; this.item = Main.lbtManager.getItemStackFromLbtItem(this);
} }
public LinkedBeaconTeleporterItem(String teleporterId, ItemStack item) { public LinkedBeaconTeleporterItem(String teleporterId, ItemStack item) {
super(teleporterId); super(teleporterId);
@ -25,9 +25,9 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
this.item = item; this.item = item;
} }
public LinkedBeaconTeleporterItem(String teleporterId){ public LinkedBeaconTeleporterItem(String teleporterId){
this(teleporterId, super(teleporterId);
new ItemStack(Material.BEACON)
); this.item = Main.lbtManager.getItemStackFromLbtItem(this);
} }
public ItemStack item(){ public ItemStack item(){
@ -36,9 +36,6 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
// Conversion methods // Conversion methods
public ItemStack toItemStack(){
return Main.lbtManager.getItemStackFromLbtItem(this);
}
public static LinkedBeaconTeleporterItem getFromItemStack(ItemStack itemStack){ public static LinkedBeaconTeleporterItem getFromItemStack(ItemStack itemStack){
return Main.lbtManager.getLbtItemFromItemStack(itemStack); return Main.lbtManager.getLbtItemFromItemStack(itemStack);
} }

@ -23,13 +23,10 @@ public class OnPrepareItemCraftEvent {
if(lbtItem == null){ if(lbtItem == null){
// If none is found, create new LinkedBeaconTeleporterItem and set as crafting-result // If none is found, create new LinkedBeaconTeleporterItem and set as crafting-result
ItemStack item = new ItemStack(Material.BEACON); lbtItem = new LinkedBeaconTeleporterItem();
lbtItem = new LinkedBeaconTeleporterItem(item);
} }
// Generate ItemStack ItemStack item = lbtItem.item();
ItemStack item = lbtItem.toItemStack();
// Exactly 2 // Exactly 2
item.setAmount(2); item.setAmount(2);

Loading…
Cancel
Save