mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-28 18:21:02 +01:00
Removes tamed animal ownership on new island
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1450
This commit is contained in:
parent
267387af7a
commit
aec2e115eb
@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import world.bentobox.bentobox.BStats;
|
||||
@ -246,6 +247,11 @@ public class NewIsland {
|
||||
* @param loc - the new island location
|
||||
*/
|
||||
private void cleanUpUser(Location loc) {
|
||||
// Remove any tamed animals
|
||||
world.getEntitiesByClass(Tameable.class).stream()
|
||||
.filter(Tameable::isTamed)
|
||||
.filter(t -> t.getOwner() != null && t.getOwner().equals(user.getPlayer()))
|
||||
.forEach(t -> t.setOwner(null));
|
||||
// Clear any old home locations (they should be clear, but just in case)
|
||||
plugin.getPlayers().clearHomeLocations(world, user.getUniqueId());
|
||||
// Set home location
|
||||
|
Loading…
Reference in New Issue
Block a user