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:
ryanhamshire 2015-12-15 14:26:30 -08:00
parent 5478adae71
commit bd75c53cda

View File

@ -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;
}