Add settings to allow players to also build in unclaimed land

This commit is contained in:
2022-10-30 21:44:30 +01:00
parent 7c2ed6af7d
commit f998e7ed28
3 changed files with 19 additions and 9 deletions

View File

@@ -37,9 +37,11 @@ public final class QuickShopListener implements Listener {
* @param event QuickShop ShopPreCreateEvent
*/
@EventHandler(priority = EventPriority.HIGH)
public final void onPreShopEvent(@NonNull ShopPreCreateEvent event) {
public final void onPreShopEvent(@NonNull ShopPreCreateEvent event)
{
if (event.isCancelled()) {
if (event.isCancelled())
{
return;
}
@@ -47,16 +49,21 @@ public final class QuickShopListener implements Listener {
final Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, false, null);
final Player player = event.getPlayer();
if(plugin.getConfig().getBoolean("op-bypass-claim-checks", true) && player.isOp()){
if(plugin.getConfig().getBoolean("op-bypass-claim-checks", true) && player.isOp())
{
return;
}
if(claim == null){
if(!plugin.getConfig().getBoolean("allow-unclaimed-land-shops", true) && claim == null)
{
event.setCancelled(true);
return;
}
if(plugin.getConfig().getBoolean("only-claim-owner-can-create-shops", true) && !claim.ownerID.toString().equals(player.getUniqueId().toString())){
if(claim != null &&
plugin.getConfig().getBoolean("only-claim-owner-can-create-shops", true) &&
!claim.ownerID.toString().equals(player.getUniqueId().toString()))
{
event.setCancelled(true);
return;
}