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:
Andreas Troelsen
2019-08-05 14:34:19 +02:00
parent c6a695e2c3
commit bbd70d0692
2 changed files with 3 additions and 0 deletions
@@ -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);