Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 301a358a60 | |||
| f5c33a9476 | |||
| 9403e87a32 | |||
| 98a7774230 | |||
| 7452dca5e3 | |||
| 48b44c7173 | |||
| ae307863b4 |
@@ -6,14 +6,14 @@
|
||||
|
||||
<groupId>me.youhavetrouble</groupId>
|
||||
<artifactId>Entiddy</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>EnTiddy</name>
|
||||
<name>Entiddy</name>
|
||||
|
||||
<description>A very serious library concerning entities</description>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
Guys, I swear this is a serious library.
|
||||
|
||||
## Dependency
|
||||
|
||||
Current version: [](https://jitpack.io/#YouHaveTrouble/Entiddy)
|
||||
|
||||
### Maven
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.github.YouHaveTrouble</groupId>
|
||||
<artifactId>Entiddy</artifactId>
|
||||
<version>VERSION</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle
|
||||
|
||||
```
|
||||
allprojects {
|
||||
repositories {
|
||||
...
|
||||
maven { url 'https://jitpack.io' }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
dependencies {
|
||||
implementation 'com.github.YouHaveTrouble:Entiddy:VERSION'
|
||||
}
|
||||
```
|
||||
@@ -4,6 +4,7 @@ package me.youhavetrouble.entiddy;
|
||||
import me.youhavetrouble.entiddy.SpecialEntities.JebSheep;
|
||||
import me.youhavetrouble.entiddy.SpecialEntities.Johnny;
|
||||
import me.youhavetrouble.entiddy.SpecialEntities.KillerBunny;
|
||||
import me.youhavetrouble.entiddy.SpecialEntities.Toast;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -13,7 +14,8 @@ public enum Entiddy {
|
||||
|
||||
KILLER_BUNNY(EntityType.RABBIT, new KillerBunny()),
|
||||
JEB_SHEEP(EntityType.SHEEP, new JebSheep()),
|
||||
JOHNNY(EntityType.VINDICATOR, new Johnny());
|
||||
JOHNNY(EntityType.VINDICATOR, new Johnny()),
|
||||
TOAST(EntityType.RABBIT, new Toast());
|
||||
|
||||
private final EntityType entityType;
|
||||
private final EntiddyInterface entiddy;
|
||||
@@ -40,6 +42,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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user