use of gg.projecteden.nexus.features.crates.models.events.CrateSpawnItemEvent in project Nexus by ProjectEdenGG.
the class Crate method spawnItem.
public Item spawnItem(Location location, ItemStack itemStack) {
try {
Item item = location.getWorld().dropItem(location, itemStack);
item.setVelocity(new Vector(0, 0, 0));
item.setCanPlayerPickup(false);
item.setCustomNameVisible(true);
item.setCustomName(StringUtils.colorize(loot.getTitle()));
spawnedItem = item;
new CrateSpawnItemEvent(player, loot, getCrateType()).callEvent();
return item;
} catch (Exception ex) {
player.getInventory().addItem(getCrateType().getKey());
throw new CrateOpeningException("There was an error while trying to play the crate animation");
}
}
use of gg.projecteden.nexus.features.crates.models.events.CrateSpawnItemEvent in project Nexus by ProjectEdenGG.
the class FebVoteRewardCrate method spawnItem.
@Override
public Item spawnItem(Location location, ItemStack itemStack) {
try {
Item item = location.getWorld().spawn(location, Item.class);
item.setVelocity(new Vector(0, 0, 0));
item.setItemStack(itemStack);
item.setCanPlayerPickup(false);
item.setCustomName(itemStack.getItemMeta().getDisplayName());
item.setCustomNameVisible(true);
spawnedItem = item;
new CrateSpawnItemEvent(player, loot, getCrateType()).callEvent();
return item;
} catch (Exception ex) {
player.getInventory().addItem(getCrateType().getKey());
throw new CrateOpeningException("There was an error while trying to play the crate animation");
}
}
Aggregations