Add names to class pets.
This commit adds custom names to class pets in the form `<player name>'s pet`. This should help players more easily distinguish between pets and hostile mobs.
This commit is contained in:
@@ -57,6 +57,8 @@ public class SpawnsPets {
|
||||
int amount = inv.getItem(index).getAmount();
|
||||
for (int i = 0; i < amount; i++) {
|
||||
Entity pet = arena.getWorld().spawn(player.getLocation(), entity.getEntityClass());
|
||||
pet.setCustomName(player.getDisplayName() + "'s pet");
|
||||
pet.setCustomNameVisible(true);
|
||||
if (pet instanceof Tameable) {
|
||||
Tameable tameable = (Tameable) pet;
|
||||
tameable.setTamed(true);
|
||||
|
||||
Reference in New Issue
Block a user