notnull and javadocs

This commit is contained in:
2022-05-12 19:03:02 +02:00
parent 48b44c7173
commit 7452dca5e3
6 changed files with 11 additions and 5 deletions
@@ -40,6 +40,9 @@ public enum Entiddy {
entity.setCustomName("Grumm");
}
/**
* @return True if entity is one of special/easter egg entities
*/
public static boolean isSpecialEntity(@NotNull LivingEntity entity) {
if (entity instanceof Player) return false;
for (Entiddy enTiddy: Entiddy.values()) {
@@ -15,6 +15,9 @@ public interface EntiddyInterface {
*/
Entity spawn(@NotNull Location location, @NotNull CreatureSpawnEvent.SpawnReason spawnReason);
boolean isInstance(LivingEntity entity);
/**
* @return True if the entity is an instance of the specific special/easter egg type
*/
boolean isInstance(@NotNull LivingEntity entity);
}
@@ -20,7 +20,7 @@ public class JebSheep implements EntiddyInterface {
}
@Override
public boolean isInstance(LivingEntity entity) {
public boolean isInstance(@NotNull LivingEntity entity) {
if (!(entity instanceof Rabbit)) return false;
return entity.getCustomName() != null && entity.getCustomName().equals("jeb_");
}
@@ -22,7 +22,7 @@ public class Johnny implements EntiddyInterface {
}
@Override
public boolean isInstance(LivingEntity entity) {
public boolean isInstance(@NotNull LivingEntity entity) {
if (!(entity instanceof Vindicator)) return false;
return ((Vindicator) entity).isJohnny();
}
@@ -23,7 +23,7 @@ public class KillerBunny implements EntiddyInterface {
}
@Override
public boolean isInstance(LivingEntity entity) {
public boolean isInstance(@NotNull LivingEntity entity) {
if (!(entity instanceof Rabbit)) return false;
return ((Rabbit) entity).getRabbitType().equals(Rabbit.Type.THE_KILLER_BUNNY);
}
@@ -20,7 +20,7 @@ public class Toast implements EntiddyInterface {
}
@Override
public boolean isInstance(LivingEntity entity) {
public boolean isInstance(@NotNull LivingEntity entity) {
if (!(entity instanceof Rabbit)) return false;
return entity.getCustomName() != null && entity.getCustomName().equals("Toast");
}