Add settings to allow players to also build in unclaimed land

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

View File

@ -6,7 +6,7 @@
<groupId>com.github.judgetread</groupId>
<artifactId>GriefPreventionQuickShopBridge</artifactId>
<version>1.2.0</version>
<version>1.3.0</version>
<licenses>
<license>

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

View File

@ -1,12 +1,15 @@
# Only allow shops to be created in claims that player is owner of.
# --> If false anyone can create a shop in the any claim.
# --> If false anyone can create a shop in any claim.
only-claim-owner-can-create-shops: true
# Ignore claim checks if player is op, allows op to create shop anywhere.
op-bypass-claim-checks: true
# Delete shops inside a claim if that claim is deleted/removed
delete-shops-when-claims-deleted: true
delete-shops-when-claims-deleted: false
# Delete shops inside a claim if that claim expires
delete-shops-when-claims-expires: true
delete-shops-when-claims-expires: false
# Allows players to make shops anywhere EXCEPT other player's claims, so even in unclaimed land
allow-unclaimed-land-shops: true