Skip to content

Commit

Permalink
Fix tamed mobs being despawned
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Sapalski <[email protected]>
  • Loading branch information
RiledUpCrow committed Oct 6, 2015
1 parent 4194a78 commit eaf88f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>pl.betoncraft.hordes</groupId>
<artifactId>Hordes</artifactId>
<version>1.0</version>
<version>1.0.2</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/pl/betoncraft/hordes/WorldSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;

/**
* Contains all settings for the world.
Expand Down Expand Up @@ -65,7 +66,8 @@ public WorldSettings(Hordes plugin, String world) throws LoadingException {

/**
* Checks if the entity is withing range of the player or if it has custom
* name. In other words, if it should be removed or left alone.
* name or if it is tamed. In other words, if it should be removed or left
* alone.
*
* @param entity
* entity to check
Expand All @@ -74,6 +76,10 @@ public WorldSettings(Hordes plugin, String world) throws LoadingException {
public boolean shouldExist(Entity entity) {
if (entity.getCustomName() != null) return true;
if (!entities.contains(entity.getType())) return true;
if (entity instanceof Tameable) {
Tameable t = (Tameable) entity;
if (t.isTamed()) return true;
}
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getGameMode() == GameMode.CREATIVE ||
player.getGameMode() == GameMode.SPECTATOR) continue;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Hordes
main: pl.betoncraft.hordes.Hordes
description: Increases amount of mobs near players while decreasing overall number of mobs.
authors: [Co0sh]
version: 1.0
version: 1.0.2
commands:
hordesreload:
description: Reloads the configuration
Expand Down

0 comments on commit eaf88f0

Please sign in to comment.