Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
   }
 }
Exemplo n.º 5
0
 @Nullable
 protected Adjective getAgeAdjective() {
   return baby.isTrue() ? m_baby : baby.isFalse() ? m_adult : null;
 }