Merge pull request #329 from slipcor/pets-2

Make pets (ocelots included) sit before teleporting players to the lobby. Fixes #247
This commit is contained in:
garbagemule 2016-12-17 01:41:55 +01:00 committed by GitHub
commit bc7c321d28
2 changed files with 11 additions and 7 deletions

View File

@ -586,11 +586,11 @@ public class ArenaImpl implements Arena
}
}
MAUtils.sitPets(p);
movePlayerToLobby(p);
takeFee(p);
storePlayerData(p, loc);
removePotionEffects(p);
MAUtils.sitPets(p);
setHealth(p, p.getMaxHealth());
p.setFoodLevel(20);
if (settings.getBoolean("display-timer-as-level", false)) {

View File

@ -21,6 +21,7 @@ import org.bukkit.Material;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.inventory.ItemStack;
@ -113,12 +114,15 @@ public class MAUtils
List<Entity> entities = p.getNearbyEntities(80, 40, 80);
for (Entity e : entities)
{
if (!(e instanceof Wolf))
continue;
if (e instanceof Wolf) {
Wolf w = (Wolf) e;
if (w.isTamed() && w.getOwner() != null && w.getOwner().equals(p))
w.setSitting(true);
} else if (e instanceof Ocelot) {
Ocelot o = (Ocelot) e;
if (o.isTamed() && o.getOwner() != null && o.getOwner().equals(p))
o.setSitting(true);
}
}
}