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); movePlayerToLobby(p);
takeFee(p); takeFee(p);
storePlayerData(p, loc); storePlayerData(p, loc);
removePotionEffects(p); removePotionEffects(p);
MAUtils.sitPets(p);
setHealth(p, p.getMaxHealth()); setHealth(p, p.getMaxHealth());
p.setFoodLevel(20); p.setFoodLevel(20);
if (settings.getBoolean("display-timer-as-level", false)) { 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.Location;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf; import org.bukkit.entity.Wolf;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -113,12 +114,15 @@ public class MAUtils
List<Entity> entities = p.getNearbyEntities(80, 40, 80); List<Entity> entities = p.getNearbyEntities(80, 40, 80);
for (Entity e : entities) for (Entity e : entities)
{ {
if (!(e instanceof Wolf)) if (e instanceof Wolf) {
continue; Wolf w = (Wolf) e;
if (w.isTamed() && w.getOwner() != null && w.getOwner().equals(p))
Wolf w = (Wolf) e; w.setSitting(true);
if (w.isTamed() && w.getOwner() != null && w.getOwner().equals(p)) } else if (e instanceof Ocelot) {
w.setSitting(true); Ocelot o = (Ocelot) e;
if (o.isTamed() && o.getOwner() != null && o.getOwner().equals(p))
o.setSitting(true);
}
} }
} }