mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Compare commits
	
		
			16 Commits
		
	
	
		
			refactor/v
			...
			docs/plot-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					1646f2f426 | ||
| 
						 | 
					3a8fae47a0 | ||
| 
						 | 
					70cb1cd100 | ||
| 
						 | 
					2067cc1670 | ||
| 
						 | 
					e6338976dd | ||
| 
						 | 
					90ebd5d5ed | ||
| 
						 | 
					c973ee8649 | ||
| 
						 | 
					c1543f034c | ||
| 
						 | 
					6baf339ecb | ||
| 
						 | 
					11906ef1c9 | ||
| 
						 | 
					ee8902154a | ||
| 
						 | 
					b5bc1988e5 | ||
| 
						 | 
					2147012beb | ||
| 
						 | 
					52bb561689 | ||
| 
						 | 
					25ce7a83f1 | ||
| 
						 | 
					55c8a590e7 | 
@@ -56,6 +56,7 @@ import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
 | 
			
		||||
import com.plotsquared.core.plot.flag.types.BooleanFlag;
 | 
			
		||||
import com.plotsquared.core.plot.world.PlotAreaManager;
 | 
			
		||||
import com.plotsquared.core.util.Permissions;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import com.plotsquared.core.util.task.TaskManager;
 | 
			
		||||
import com.plotsquared.core.util.task.TaskTime;
 | 
			
		||||
import com.sk89q.worldedit.WorldEdit;
 | 
			
		||||
@@ -166,7 +167,7 @@ public class BlockEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (area.isRoadFlags() && !area.getRoadFlag(RedstoneFlag.class)) {
 | 
			
		||||
            if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, RedstoneFlag.class, false)) {
 | 
			
		||||
                event.setNewCurrent(0);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
@@ -1084,7 +1085,10 @@ public class BlockEventListener implements Listener {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_ROAD)) {
 | 
			
		||||
                if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, BlockIgnitionFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                        pp,
 | 
			
		||||
                        Permission.PERMISSION_ADMIN_BUILD_ROAD
 | 
			
		||||
                )) {
 | 
			
		||||
                    pp.sendMessage(
 | 
			
		||||
                            TranslatableCaption.of("permission.no_permission_event"),
 | 
			
		||||
                            Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_ROAD))
 | 
			
		||||
@@ -1092,7 +1096,10 @@ public class BlockEventListener implements Listener {
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                }
 | 
			
		||||
            } else if (!plot.hasOwner()) {
 | 
			
		||||
                if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_UNOWNED)) {
 | 
			
		||||
                if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, BlockIgnitionFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                        pp,
 | 
			
		||||
                        Permission.PERMISSION_ADMIN_BUILD_UNOWNED
 | 
			
		||||
                )) {
 | 
			
		||||
                    pp.sendMessage(
 | 
			
		||||
                            TranslatableCaption.of("permission.no_permission_event"),
 | 
			
		||||
                            Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_BUILD_UNOWNED))
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ import com.plotsquared.core.plot.Plot;
 | 
			
		||||
import com.plotsquared.core.plot.PlotArea;
 | 
			
		||||
import com.plotsquared.core.plot.flag.implementations.CopperOxideFlag;
 | 
			
		||||
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
import org.bukkit.block.Block;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
@@ -91,7 +92,8 @@ public class BlockEventListener117 implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null || !plot.getFlag(MiscInteractFlag.class)) {
 | 
			
		||||
        if (plot == null && !PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, MiscInteractFlag.class, true) || plot != null && !plot.getFlag(
 | 
			
		||||
                MiscInteractFlag.class)) {
 | 
			
		||||
            if (plotPlayer != null) {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    if (!plot.isAdded(plotPlayer.getUUID())) {
 | 
			
		||||
@@ -104,6 +106,12 @@ public class BlockEventListener117 implements Listener {
 | 
			
		||||
            if (entity instanceof Item item) {
 | 
			
		||||
                UUID itemThrower = item.getThrower();
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    if (itemThrower == null && (itemThrower = item.getOwner()) == null) {
 | 
			
		||||
                        plot.debug(
 | 
			
		||||
                                "A thrown item couldn't trigger sculk sensors because misc-interact = false and the item's owner could not be resolved.");
 | 
			
		||||
                        event.setCancelled(true);
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!plot.isAdded(itemThrower)) {
 | 
			
		||||
                        if (!plot.isAdded(itemThrower)) {
 | 
			
		||||
                            plot.debug("A thrown item couldn't trigger sculk sensors because misc-interact = false");
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@ import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
 | 
			
		||||
import com.plotsquared.core.plot.world.PlotAreaManager;
 | 
			
		||||
import com.plotsquared.core.util.EventDispatcher;
 | 
			
		||||
import com.plotsquared.core.util.Permissions;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
 | 
			
		||||
import com.sk89q.worldedit.world.block.BlockType;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
@@ -261,7 +262,7 @@ public class EntityEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (area.isRoadFlags() && area.getRoadFlag(InvincibleFlag.class)) {
 | 
			
		||||
            if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, InvincibleFlag.class, true)) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,7 @@ import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
 | 
			
		||||
import com.plotsquared.core.plot.flag.types.BooleanFlag;
 | 
			
		||||
import com.plotsquared.core.plot.world.PlotAreaManager;
 | 
			
		||||
import com.plotsquared.core.util.Permissions;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import net.kyori.adventure.text.minimessage.Template;
 | 
			
		||||
import org.bukkit.Chunk;
 | 
			
		||||
import org.bukkit.block.Block;
 | 
			
		||||
@@ -326,14 +327,18 @@ public class PaperListener implements Listener {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        Location location = BukkitUtil.adapt(entity.getLocation());
 | 
			
		||||
        if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
 | 
			
		||||
        PlotArea area = location.getPlotArea();
 | 
			
		||||
        if (area == null) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
 | 
			
		||||
            if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                    pp,
 | 
			
		||||
                    Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
 | 
			
		||||
            )) {
 | 
			
		||||
                pp.sendMessage(
 | 
			
		||||
                        TranslatableCaption.of("permission.no_permission_event"),
 | 
			
		||||
                        Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,10 @@ import org.bukkit.event.EventHandler;
 | 
			
		||||
import org.bukkit.event.block.BlockPlaceEvent;
 | 
			
		||||
import org.checkerframework.checker.nullness.qual.NonNull;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @deprecated P2 effectively no longer supports 1.13
 | 
			
		||||
 */
 | 
			
		||||
@Deprecated(forRemoval = true, since = "6.10.4")
 | 
			
		||||
public class PaperListener113 extends PaperListener {
 | 
			
		||||
 | 
			
		||||
    @Inject
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,7 @@ import com.plotsquared.core.plot.world.PlotAreaManager;
 | 
			
		||||
import com.plotsquared.core.util.EventDispatcher;
 | 
			
		||||
import com.plotsquared.core.util.MathMan;
 | 
			
		||||
import com.plotsquared.core.util.Permissions;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import com.plotsquared.core.util.PremiumVerification;
 | 
			
		||||
import com.plotsquared.core.util.entity.EntityCategories;
 | 
			
		||||
import com.plotsquared.core.util.task.TaskManager;
 | 
			
		||||
@@ -889,8 +890,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                PlotArea area = pp.getPlotAreaAbs();
 | 
			
		||||
                if (area != null && area.isRoadFlags() && area
 | 
			
		||||
                        .getRoadFlag(PreventCreativeCopyFlag.class)) {
 | 
			
		||||
                if (area != null && PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, PreventCreativeCopyFlag.class, true)) {
 | 
			
		||||
                    final ItemStack newStack =
 | 
			
		||||
                            new ItemStack(newItem.getType(), newItem.getAmount());
 | 
			
		||||
                    event.setCursor(newStack);
 | 
			
		||||
@@ -998,8 +998,10 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        Plot plot = location.getPlotAbs();
 | 
			
		||||
        BukkitPlayer pp = BukkitUtil.adapt(e.getPlayer());
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (!area.isRoadFlags() && !area.getRoadFlag(MiscInteractFlag.class) && !Permissions
 | 
			
		||||
                    .hasPermission(pp, Permission.PERMISSION_ADMIN_INTERACT_ROAD)) {
 | 
			
		||||
            if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, MiscInteractFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                    pp,
 | 
			
		||||
                    Permission.PERMISSION_ADMIN_INTERACT_ROAD
 | 
			
		||||
            )) {
 | 
			
		||||
                pp.sendMessage(
 | 
			
		||||
                        TranslatableCaption.of("permission.no_permission_event"),
 | 
			
		||||
                        Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_INTERACT_ROAD))
 | 
			
		||||
@@ -1009,9 +1011,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        } else {
 | 
			
		||||
            if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
 | 
			
		||||
                if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_BUILD_OTHER)) {
 | 
			
		||||
                    pp.sendMessage(
 | 
			
		||||
                            TranslatableCaption.of("done.building_restricted")
 | 
			
		||||
                    );
 | 
			
		||||
                    pp.sendMessage(TranslatableCaption.of("done.building_restricted"));
 | 
			
		||||
                    e.setCancelled(true);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
@@ -1594,7 +1594,10 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
            BukkitPlayer pp = BukkitUtil.adapt(p);
 | 
			
		||||
            Plot plot = area.getPlot(location);
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD)) {
 | 
			
		||||
                if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, VehicleBreakFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                        pp,
 | 
			
		||||
                        Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD
 | 
			
		||||
                )) {
 | 
			
		||||
                    pp.sendMessage(
 | 
			
		||||
                            TranslatableCaption.of("permission.no_permission_event"),
 | 
			
		||||
                            Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_DESTROY_VEHICLE_ROAD))
 | 
			
		||||
@@ -1642,7 +1645,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (area.isRoadFlags() && !area.getRoadFlag(ItemDropFlag.class)) {
 | 
			
		||||
            if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ItemDropFlag.class, false)) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
@@ -1668,7 +1671,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
            }
 | 
			
		||||
            Plot plot = location.getOwnedPlot();
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                if (area.isRoadFlags() && area.getRoadFlag(DropProtectionFlag.class)) {
 | 
			
		||||
                if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, DropProtectionFlag.class, true)) {
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                }
 | 
			
		||||
                return;
 | 
			
		||||
@@ -1690,19 +1693,17 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (area.isRoadFlags() && area.getRoadFlag(KeepInventoryFlag.class)) {
 | 
			
		||||
            if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, KeepInventoryFlag.class, true)) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (plot.getFlag(KeepInventoryFlag.class)) {
 | 
			
		||||
        if (plot.getFlag(KeepInventoryFlag.class)) {
 | 
			
		||||
            plot.debug(event.getEntity().getName() + " kept their inventory because of keep-inventory = true");
 | 
			
		||||
            event.getDrops().clear();
 | 
			
		||||
            event.setKeepInventory(true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility
 | 
			
		||||
    @EventHandler
 | 
			
		||||
@@ -1725,18 +1726,16 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (area.isRoadFlags() && area.getRoadFlag(DenyPortalTravelFlag.class)) {
 | 
			
		||||
            if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, DenyPortalTravelFlag.class, true)) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (plot.getFlag(DenyPortalTravelFlag.class)) {
 | 
			
		||||
        if (plot.getFlag(DenyPortalTravelFlag.class)) {
 | 
			
		||||
            plot.debug(event.getPlayer().getName() + " did not travel thru a portal because of deny-portal-travel = true");
 | 
			
		||||
            event.setCancelled(true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @EventHandler
 | 
			
		||||
    public void onPortalCreation(PortalCreateEvent event) {
 | 
			
		||||
@@ -1772,7 +1771,7 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
            }
 | 
			
		||||
            Plot plot = location.getOwnedPlot();
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                if (area.isRoadFlags() && area.getRoadFlag(DenyPortalsFlag.class)) {
 | 
			
		||||
                if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, DenyPortalsFlag.class, true)) {
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
@@ -1801,17 +1800,15 @@ public class PlayerEventListener implements Listener {
 | 
			
		||||
        }
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (area.isRoadFlags() && area.getRoadFlag(LecternReadBookFlag.class)) {
 | 
			
		||||
            if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, LecternReadBookFlag.class, true)) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
            }
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (plot.getFlag(LecternReadBookFlag.class)) {
 | 
			
		||||
        if (plot.getFlag(LecternReadBookFlag.class)) {
 | 
			
		||||
            plot.debug(event.getPlayer().getName() + " could not take the book because of lectern-read-book = true");
 | 
			
		||||
            event.setCancelled(true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ import com.plotsquared.core.plot.PlotHandler;
 | 
			
		||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
 | 
			
		||||
import com.plotsquared.core.plot.world.PlotAreaManager;
 | 
			
		||||
import com.plotsquared.core.util.Permissions;
 | 
			
		||||
import com.plotsquared.core.util.PlotFlagUtil;
 | 
			
		||||
import net.kyori.adventure.text.minimessage.Template;
 | 
			
		||||
import org.bukkit.entity.Entity;
 | 
			
		||||
import org.bukkit.entity.LivingEntity;
 | 
			
		||||
@@ -97,14 +98,18 @@ public class ProjectileEventListener implements Listener {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        Location location = BukkitUtil.adapt(entity.getLocation());
 | 
			
		||||
        if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
 | 
			
		||||
        PlotArea area = location.getPlotArea();
 | 
			
		||||
        if (area == null) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
 | 
			
		||||
        Plot plot = location.getOwnedPlot();
 | 
			
		||||
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
            if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_ROAD)) {
 | 
			
		||||
            if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                    pp,
 | 
			
		||||
                    Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
 | 
			
		||||
            )) {
 | 
			
		||||
                pp.sendMessage(
 | 
			
		||||
                        TranslatableCaption.of("permission.no_permission_event"),
 | 
			
		||||
                        Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
 | 
			
		||||
@@ -154,6 +159,8 @@ public class ProjectileEventListener implements Listener {
 | 
			
		||||
                    if (plot.isAdded(((Player) shooter).getUniqueId()) || plot.getFlag(ProjectilesFlag.class)) {
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                } else if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true)) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                entity.remove();
 | 
			
		||||
@@ -163,7 +170,10 @@ public class ProjectileEventListener implements Listener {
 | 
			
		||||
 | 
			
		||||
            PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
 | 
			
		||||
            if (plot == null) {
 | 
			
		||||
                if (!Permissions.hasPermission(pp, Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
 | 
			
		||||
                if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !Permissions.hasPermission(
 | 
			
		||||
                        pp,
 | 
			
		||||
                        Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED
 | 
			
		||||
                )) {
 | 
			
		||||
                    entity.remove();
 | 
			
		||||
                    event.setCancelled(true);
 | 
			
		||||
                }
 | 
			
		||||
@@ -194,7 +204,6 @@ public class ProjectileEventListener implements Listener {
 | 
			
		||||
            if (sPlot == null || !PlotHandler.sameOwners(plot, sPlot)) {
 | 
			
		||||
                entity.remove();
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,7 @@ public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator {
 | 
			
		||||
    private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + LimitedRegionWrapperQueue.class.getSimpleName());
 | 
			
		||||
 | 
			
		||||
    private final LimitedRegion limitedRegion;
 | 
			
		||||
    private boolean useOtherRestoreTagMethod = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @since 6.9.0
 | 
			
		||||
@@ -65,10 +66,18 @@ public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator {
 | 
			
		||||
            CompoundTag tag = id.getNbtData();
 | 
			
		||||
            StateWrapper sw = new StateWrapper(tag);
 | 
			
		||||
            try {
 | 
			
		||||
                if (useOtherRestoreTagMethod && getWorld() != null) {
 | 
			
		||||
                    sw.restoreTag(getWorld().getName(), x, y, z);
 | 
			
		||||
                } else {
 | 
			
		||||
                    sw.restoreTag(limitedRegion.getBlockState(x, y, z).getBlock());
 | 
			
		||||
                }
 | 
			
		||||
            } catch (IllegalArgumentException e) {
 | 
			
		||||
                LOGGER.error("Error attempting to populate tile entity into the world at location {},{},{}", x, y, z, e);
 | 
			
		||||
                return false;
 | 
			
		||||
            } catch (IllegalStateException e) {
 | 
			
		||||
                useOtherRestoreTagMethod = true;
 | 
			
		||||
                LOGGER.warn("IllegalStateException attempting to populate tile entity into the world at location {},{},{}. " +
 | 
			
		||||
                        "Possibly on <=1.17.1, switching to secondary method.", x, y, z, e);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
 
 | 
			
		||||
@@ -282,7 +282,28 @@ public class Merge extends SubCommand {
 | 
			
		||||
                run.run();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!force && !isOnline) {
 | 
			
		||||
        if (force || !isOnline) {
 | 
			
		||||
            if (force || Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_MERGE_OTHER_OFFLINE)) {
 | 
			
		||||
                if (plot.getPlotModificationManager().autoMerge(direction, maxSize - size, uuids.iterator().next(), player, terrain)) {
 | 
			
		||||
                    if (this.econHandler.isEnabled(plotArea) && price > 0d) {
 | 
			
		||||
                        if (!force && this.econHandler.getMoney(player) < price) {
 | 
			
		||||
                            player.sendMessage(
 | 
			
		||||
                                    TranslatableCaption.of("economy.cannot_afford_merge"),
 | 
			
		||||
                                    Template.of("money", this.econHandler.format(price))
 | 
			
		||||
                            );
 | 
			
		||||
                            return false;
 | 
			
		||||
                        }
 | 
			
		||||
                        this.econHandler.withdrawMoney(player, price);
 | 
			
		||||
                        player.sendMessage(
 | 
			
		||||
                                TranslatableCaption.of("economy.removed_balance"),
 | 
			
		||||
                                Template.of("money", this.econHandler.format(price))
 | 
			
		||||
                        );
 | 
			
		||||
                    }
 | 
			
		||||
                    player.sendMessage(TranslatableCaption.of("merge.success_merge"));
 | 
			
		||||
                    eventDispatcher.callPostMerge(player, plot);
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            player.sendMessage(TranslatableCaption.of("merge.no_available_automerge"));
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -234,8 +234,19 @@ public class HybridUtils {
 | 
			
		||||
                        Set<BlockType> types = new HashSet<>();
 | 
			
		||||
                        for (int yIndex = 0; yIndex < height; yIndex++) {
 | 
			
		||||
                            BlockState old = oldBlocks[yIndex][x][z]; // Nullable
 | 
			
		||||
                            try {
 | 
			
		||||
                            BlockState now = newBlocks[yIndex][x][z]; // Not null
 | 
			
		||||
                            if (now == null) {
 | 
			
		||||
                                throw new NullPointerException(String.format(
 | 
			
		||||
                                        "\"now\" block null attempting to perform plot analysis. Indexes: x=%d of %d, yIndex=%d" +
 | 
			
		||||
                                                " of %d, z=%d of %d",
 | 
			
		||||
                                        x,
 | 
			
		||||
                                        width,
 | 
			
		||||
                                        yIndex,
 | 
			
		||||
                                        height,
 | 
			
		||||
                                        z,
 | 
			
		||||
                                        length
 | 
			
		||||
                                ));
 | 
			
		||||
                            }
 | 
			
		||||
                            if (!now.equals(old) && !(old == null && now.getBlockType().equals(BlockTypes.AIR))) {
 | 
			
		||||
                                changes[i]++;
 | 
			
		||||
                            }
 | 
			
		||||
@@ -270,9 +281,6 @@ public class HybridUtils {
 | 
			
		||||
                                }
 | 
			
		||||
                                types.add(now.getBlockType());
 | 
			
		||||
                            }
 | 
			
		||||
                            } catch (NullPointerException e) {
 | 
			
		||||
                                e.printStackTrace();
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        variety[i] = types.size();
 | 
			
		||||
                        i++;
 | 
			
		||||
 
 | 
			
		||||
@@ -162,6 +162,7 @@ public enum Permission {
 | 
			
		||||
    PERMISSION_LIST_AREA("plots.list.area"),
 | 
			
		||||
    PERMISSION_ADMIN_COMMAND_LOAD("plots.admin.command.load"),
 | 
			
		||||
    PERMISSION_ADMIN_COMMAND_MERGE("plots.admin.command.merge"),
 | 
			
		||||
    PERMISSION_ADMIN_COMMAND_MERGE_OTHER_OFFLINE("plots.admin.command.merge.other.offline"),
 | 
			
		||||
    PERMISSION_ADMIN_COMMAND_SET_OWNER("plots.admin.command.setowner"),
 | 
			
		||||
    PERMISSION_COMMENT("plots.comment"),
 | 
			
		||||
    PERMISSION_INBOX("plots.inbox"),
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,9 @@ import java.util.UUID;
 | 
			
		||||
 * Generic settings class.
 | 
			
		||||
 * - Does not keep a reference to a parent class
 | 
			
		||||
 * - Direct changes here will not occur in the db (Use the parent plot object for that)
 | 
			
		||||
 * This class is not part of the API and may change at any time. It is recommended to use equivalent methods in the Plot class.
 | 
			
		||||
 */
 | 
			
		||||
@Deprecated
 | 
			
		||||
public class PlotSettings {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,53 @@
 | 
			
		||||
/*
 | 
			
		||||
 * PlotSquared, a land and world management plugin for Minecraft.
 | 
			
		||||
 * Copyright (C) IntellectualSites <https://intellectualsites.com>
 | 
			
		||||
 * Copyright (C) IntellectualSites team and contributors
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
 * the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
 * (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 * This program is distributed in the hope that it will be useful,
 | 
			
		||||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 * GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 * You should have received a copy of the GNU General Public License
 | 
			
		||||
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
package com.plotsquared.core.util;
 | 
			
		||||
 | 
			
		||||
import com.plotsquared.core.plot.PlotArea;
 | 
			
		||||
import com.plotsquared.core.plot.flag.PlotFlag;
 | 
			
		||||
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Util class for generic methods relating to plot flags.
 | 
			
		||||
 *
 | 
			
		||||
 * @since 6.10.4
 | 
			
		||||
 */
 | 
			
		||||
public final class PlotFlagUtil {
 | 
			
		||||
 | 
			
		||||
    private PlotFlagUtil() {
 | 
			
		||||
        //No-op
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check if the value of a {@link PlotFlag} matches the given value. If
 | 
			
		||||
     * road flags are disabled for the given plot area, returns false.
 | 
			
		||||
     *
 | 
			
		||||
     * @param flagClass boolean flag to get value of
 | 
			
		||||
     * @param value     boolean value to check flag value against
 | 
			
		||||
     * @param <T>       The flag value type
 | 
			
		||||
     * @return true if road flag value matches with road flags enabled
 | 
			
		||||
     * @since 6.10.4
 | 
			
		||||
     */
 | 
			
		||||
    public static <T> boolean isAreaRoadFlagsAndFlagEquals(
 | 
			
		||||
            PlotArea area, final Class<? extends PlotFlag<T, ?>> flagClass, T value
 | 
			
		||||
    ) {
 | 
			
		||||
        return area.isRoadFlags() && Objects.equals(area.getRoadFlag(flagClass), value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -19,7 +19,7 @@ plugins {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
group = "com.plotsquared"
 | 
			
		||||
version = "6.10.4-SNAPSHOT"
 | 
			
		||||
version = "6.10.6-SNAPSHOT"
 | 
			
		||||
 | 
			
		||||
subprojects {
 | 
			
		||||
    group = rootProject.group
 | 
			
		||||
@@ -65,7 +65,7 @@ subprojects {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dependencies {
 | 
			
		||||
        implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.18"))
 | 
			
		||||
        implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.20"))
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dependencies {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										3
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,6 @@
 | 
			
		||||
distributionBase=GRADLE_USER_HOME
 | 
			
		||||
distributionPath=wrapper/dists
 | 
			
		||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
 | 
			
		||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
 | 
			
		||||
networkTimeout=10000
 | 
			
		||||
zipStoreBase=GRADLE_USER_HOME
 | 
			
		||||
zipStorePath=wrapper/dists
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								gradlew
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								gradlew
									
									
									
									
										vendored
									
									
								
							@@ -55,7 +55,7 @@
 | 
			
		||||
#       Darwin, MinGW, and NonStop.
 | 
			
		||||
#
 | 
			
		||||
#   (3) This script is generated from the Groovy template
 | 
			
		||||
#       https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
 | 
			
		||||
#       https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
 | 
			
		||||
#       within the Gradle project.
 | 
			
		||||
#
 | 
			
		||||
#       You can find Gradle at https://github.com/gradle/gradle/.
 | 
			
		||||
@@ -80,10 +80,10 @@ do
 | 
			
		||||
    esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
 | 
			
		||||
 | 
			
		||||
APP_NAME="Gradle"
 | 
			
		||||
# This is normally unused
 | 
			
		||||
# shellcheck disable=SC2034
 | 
			
		||||
APP_BASE_NAME=${0##*/}
 | 
			
		||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
 | 
			
		||||
 | 
			
		||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 | 
			
		||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
 | 
			
		||||
@@ -143,12 +143,16 @@ fi
 | 
			
		||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
 | 
			
		||||
    case $MAX_FD in #(
 | 
			
		||||
      max*)
 | 
			
		||||
        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
 | 
			
		||||
        # shellcheck disable=SC3045 
 | 
			
		||||
        MAX_FD=$( ulimit -H -n ) ||
 | 
			
		||||
            warn "Could not query maximum file descriptor limit"
 | 
			
		||||
    esac
 | 
			
		||||
    case $MAX_FD in  #(
 | 
			
		||||
      '' | soft) :;; #(
 | 
			
		||||
      *)
 | 
			
		||||
        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
 | 
			
		||||
        # shellcheck disable=SC3045 
 | 
			
		||||
        ulimit -n "$MAX_FD" ||
 | 
			
		||||
            warn "Could not set maximum file descriptor limit to $MAX_FD"
 | 
			
		||||
    esac
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								gradlew.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								gradlew.bat
									
									
									
									
										vendored
									
									
								
							@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
 | 
			
		||||
 | 
			
		||||
set DIRNAME=%~dp0
 | 
			
		||||
if "%DIRNAME%"=="" set DIRNAME=.
 | 
			
		||||
@rem This is normally unused
 | 
			
		||||
set APP_BASE_NAME=%~n0
 | 
			
		||||
set APP_HOME=%DIRNAME%
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user