Beispiel #1
0
 @SuppressWarnings("unchecked")
 public final boolean isInstance(final @Nullable Entity e) {
   if (e == null) return false;
   if (!baby.isUnknown() && e instanceof Ageable && ((Ageable) e).isAdult() != baby.isFalse())
     return false;
   return getType().isInstance(e) && match((E) e);
 }
Beispiel #2
0
 @SuppressWarnings("null")
 public String toString(final int flags) {
   final Noun name = info.names[matchedPattern];
   return baby.isTrue()
       ? m_baby.toString(name, flags)
       : baby.isFalse() ? m_adult.toString(name, flags) : name.toString(flags);
 }
Beispiel #3
0
 @Override
 public final int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + baby.hashCode();
   result = prime * result + plural.hashCode();
   result = prime * result + matchedPattern;
   result = prime * result + info.hashCode();
   result = prime * result + hashCode_i();
   return result;
 }
Beispiel #4
0
 @Nullable
 public E spawn(final Location loc) {
   assert loc != null;
   try {
     final E e = loc.getWorld().spawn(loc, getType());
     if (e == null) throw new IllegalArgumentException();
     if (baby.isTrue() && e instanceof Ageable) ((Ageable) e).setBaby();
     set(e);
     return e;
   } catch (final IllegalArgumentException e) {
     if (Skript.testing()) Skript.error("Can't spawn " + getType().getName());
     return null;
   }
 }
Beispiel #5
0
 @Nullable
 protected Adjective getAgeAdjective() {
   return baby.isTrue() ? m_baby : baby.isFalse() ? m_adult : null;
 }