Prevent leashing claimed creatures.
Using a leash on a creature in a land claim now requires the claim owner's container trust.
This commit is contained in:
parent
0c8e44532b
commit
06eeab3b72
|
|
@ -35,6 +35,7 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Player;
|
||||
|
|
@ -794,6 +795,22 @@ class PlayerEventHandler implements Listener
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if preventing theft, prevent leashing claimed creatures
|
||||
if(GriefPrevention.instance.config_claims_preventTheft && entity instanceof Creature && player.getItemInHand().getType() == Material.LEASH)
|
||||
{
|
||||
Claim claim = this.dataStore.getClaimAt(entity.getLocation(), false, playerData.lastClaim);
|
||||
if(claim != null)
|
||||
{
|
||||
String failureReason = claim.allowContainers(player);
|
||||
if(failureReason != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, failureReason);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//when a player picks up an item...
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user