Ensure survival players can get their carts back.
Can only place if player has permission necessary to remove the cart. Also fixes "griefing" railways by adding too many carts and forcing the rail owner to come remove the extras.
This commit is contained in:
parent
5478adae71
commit
bd75c53cda
|
|
@ -1788,6 +1788,26 @@ class PlayerEventHandler implements Listener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//survival world minecart placement requires container trust, which is the permission required to remove the minecart later
|
||||||
|
else if(clickedBlock != null &&
|
||||||
|
(materialInHand == Material.MINECART || materialInHand == Material.POWERED_MINECART || materialInHand == Material.STORAGE_MINECART) &&
|
||||||
|
!GriefPrevention.instance.creativeRulesApply(clickedBlock.getLocation()))
|
||||||
|
{
|
||||||
|
if(playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
|
||||||
|
if(claim != null)
|
||||||
|
{
|
||||||
|
String reason = claim.allowContainers(player);
|
||||||
|
if(reason != null)
|
||||||
|
{
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Err, reason);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user