Compare commits

..

1 Commits

Author SHA1 Message Date
8607b9c49c fix: plot music volume to span full plot 2024-04-07 23:55:33 +02:00
25 changed files with 261 additions and 381 deletions

View File

@ -24,14 +24,13 @@ body:
- type: dropdown - type: dropdown
attributes: attributes:
label: Server Version label: Server Version
description: Which server version are you using? If your server version is not listed, it is not supported. Update to a supported version first. description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
multiple: false multiple: false
options: options:
- '1.21.1'
- '1.20.6'
- '1.20.4' - '1.20.4'
- '1.20' - '1.20'
- '1.19.4' - '1.19.4'
- '1.18.2'
validations: validations:
required: true required: true

View File

@ -11,7 +11,7 @@ jobs:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Validate Gradle Wrapper - name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4 uses: gradle/wrapper-validation-action@v2
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:

View File

@ -11,7 +11,7 @@ jobs:
- name: Checkout Repository - name: Checkout Repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Validate Gradle Wrapper - name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4 uses: gradle/wrapper-validation-action@v2
- name: Setup Java - name: Setup Java
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:

View File

@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Label conflicting PRs - name: Label conflicting PRs
uses: eps1lon/actions-label-merge-conflict@v3.0.2 uses: eps1lon/actions-label-merge-conflict@v3.0.0
with: with:
dirtyLabel: "unresolved-merge-conflict" dirtyLabel: "unresolved-merge-conflict"
repoToken: "${{ secrets.GITHUB_TOKEN }}" repoToken: "${{ secrets.GITHUB_TOKEN }}"

View File

@ -113,6 +113,5 @@ tasks {
opt.encoding("UTF-8") opt.encoding("UTF-8")
opt.keyWords() opt.keyWords()
opt.addStringOption("-since", isRelease) opt.addStringOption("-since", isRelease)
opt.noTimestamp()
} }
} }

View File

@ -24,6 +24,7 @@ import com.google.inject.Injector;
import com.google.inject.Key; import com.google.inject.Key;
import com.google.inject.Singleton; import com.google.inject.Singleton;
import com.google.inject.Stage; import com.google.inject.Stage;
import com.google.inject.TypeLiteral;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.inject.BackupModule; import com.plotsquared.bukkit.inject.BackupModule;
import com.plotsquared.bukkit.inject.BukkitModule; import com.plotsquared.bukkit.inject.BukkitModule;
@ -34,7 +35,6 @@ import com.plotsquared.bukkit.listener.BlockEventListener117;
import com.plotsquared.bukkit.listener.ChunkListener; import com.plotsquared.bukkit.listener.ChunkListener;
import com.plotsquared.bukkit.listener.EntityEventListener; import com.plotsquared.bukkit.listener.EntityEventListener;
import com.plotsquared.bukkit.listener.EntitySpawnListener; import com.plotsquared.bukkit.listener.EntitySpawnListener;
import com.plotsquared.bukkit.listener.HighFreqBlockEventListener;
import com.plotsquared.bukkit.listener.PaperListener; import com.plotsquared.bukkit.listener.PaperListener;
import com.plotsquared.bukkit.listener.PlayerEventListener; import com.plotsquared.bukkit.listener.PlayerEventListener;
import com.plotsquared.bukkit.listener.PlayerEventListener1201; import com.plotsquared.bukkit.listener.PlayerEventListener1201;
@ -45,6 +45,7 @@ import com.plotsquared.bukkit.listener.SpigotListener;
import com.plotsquared.bukkit.listener.WorldEvents; import com.plotsquared.bukkit.listener.WorldEvents;
import com.plotsquared.bukkit.placeholder.PAPIPlaceholders; import com.plotsquared.bukkit.placeholder.PAPIPlaceholders;
import com.plotsquared.bukkit.placeholder.PlaceholderFormatter; import com.plotsquared.bukkit.placeholder.PlaceholderFormatter;
import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.bukkit.player.BukkitPlayerManager; import com.plotsquared.bukkit.player.BukkitPlayerManager;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.BukkitWorld; import com.plotsquared.bukkit.util.BukkitWorld;
@ -363,9 +364,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener1201.class), this); getServer().getPluginManager().registerEvents(injector().getInstance(PlayerEventListener1201.class), this);
} }
getServer().getPluginManager().registerEvents(injector().getInstance(BlockEventListener.class), this); getServer().getPluginManager().registerEvents(injector().getInstance(BlockEventListener.class), this);
if (Settings.HIGH_FREQUENCY_LISTENER) {
getServer().getPluginManager().registerEvents(injector().getInstance(HighFreqBlockEventListener.class), this);
}
if (serverVersion()[1] >= 17) { if (serverVersion()[1] >= 17) {
getServer().getPluginManager().registerEvents(injector().getInstance(BlockEventListener117.class), this); getServer().getPluginManager().registerEvents(injector().getInstance(BlockEventListener117.class), this);
} }
@ -1273,13 +1271,15 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
@Override @Override
public @NonNull PlatformWorldManager<?> worldManager() { public @NonNull PlatformWorldManager<?> worldManager() {
return this.worldManager; return injector().getInstance(Key.get(new TypeLiteral<PlatformWorldManager<World>>() {
}));
} }
@Override @Override
@NonNull @NonNull
@SuppressWarnings("unchecked")
public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() { public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() {
return this.playerManager; return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class);
} }
@Override @Override

View File

@ -24,6 +24,7 @@ import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.permissions.Permission;
import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.player.PlotPlayer;
@ -47,6 +48,7 @@ import com.plotsquared.core.plot.flag.implementations.LeafDecayFlag;
import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag; import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag;
import com.plotsquared.core.plot.flag.implementations.MycelGrowFlag; import com.plotsquared.core.plot.flag.implementations.MycelGrowFlag;
import com.plotsquared.core.plot.flag.implementations.PlaceFlag; import com.plotsquared.core.plot.flag.implementations.PlaceFlag;
import com.plotsquared.core.plot.flag.implementations.RedstoneFlag;
import com.plotsquared.core.plot.flag.implementations.SnowFormFlag; import com.plotsquared.core.plot.flag.implementations.SnowFormFlag;
import com.plotsquared.core.plot.flag.implementations.SnowMeltFlag; import com.plotsquared.core.plot.flag.implementations.SnowMeltFlag;
import com.plotsquared.core.plot.flag.implementations.SoilDryFlag; import com.plotsquared.core.plot.flag.implementations.SoilDryFlag;
@ -60,6 +62,7 @@ import com.plotsquared.core.util.task.TaskTime;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockType;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.tag.Tag; import net.kyori.adventure.text.minimessage.tag.Tag;
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -89,9 +92,11 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockMultiPlaceEvent; import org.bukkit.event.block.BlockMultiPlaceEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.BlockSpreadEvent; import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.CauldronLevelChangeEvent; import org.bukkit.event.block.CauldronLevelChangeEvent;
import org.bukkit.event.block.EntityBlockFormEvent; import org.bukkit.event.block.EntityBlockFormEvent;
@ -107,6 +112,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -117,6 +123,14 @@ import static org.bukkit.Tag.WALL_CORALS;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class BlockEventListener implements Listener { public class BlockEventListener implements Listener {
private static final Set<Material> PISTONS = Set.of(
Material.PISTON,
Material.STICKY_PISTON
);
private static final Set<Material> PHYSICS_BLOCKS = Set.of(
Material.TURTLE_EGG,
Material.TURTLE_SPAWN_EGG
);
private static final Set<Material> SNOW = Stream.of(Material.values()) // needed as Tag.SNOW isn't present in 1.16.5 private static final Set<Material> SNOW = Stream.of(Material.values()) // needed as Tag.SNOW isn't present in 1.16.5
.filter(material -> material.name().contains("SNOW")) .filter(material -> material.name().contains("SNOW"))
.filter(Material::isBlock) .filter(Material::isBlock)
@ -150,6 +164,114 @@ public class BlockEventListener implements Listener {
}, TaskTime.ticks(3L)); }, TaskTime.ticks(3L));
} }
@EventHandler
public void onRedstoneEvent(BlockRedstoneEvent event) {
Block block = event.getBlock();
Location location = BukkitUtil.adapt(block.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, RedstoneFlag.class, false)) {
event.setNewCurrent(0);
}
return;
}
if (!plot.getFlag(RedstoneFlag.class)) {
event.setNewCurrent(0);
plot.debug("Redstone event was cancelled because redstone = false");
return;
}
if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable = false;
if (!DBFunc.SERVER.equals(plot.getOwner())) {
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
if (PlotSquared.platform().playerManager().getPlayerIfExists(owner) != null) {
disable = false;
break;
}
}
} else {
disable = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs()) == null;
}
}
if (disable) {
for (UUID trusted : plot.getTrusted()) {
if (PlotSquared.platform().playerManager().getPlayerIfExists(trusted) != null) {
disable = false;
break;
}
}
if (disable) {
event.setNewCurrent(0);
plot.debug("Redstone event was cancelled because no trusted player was in the plot");
return;
}
}
}
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
for (final PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
if (plot.equals(player.getCurrentPlot())) {
return;
}
}
event.setNewCurrent(0);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPhysicsEvent(BlockPhysicsEvent event) {
Block block = event.getBlock();
Location location = BukkitUtil.adapt(block.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getOwnedPlotAbs(location);
if (plot == null) {
return;
}
if (event.getChangedType().hasGravity() && plot.getFlag(DisablePhysicsFlag.class)) {
event.setCancelled(true);
sendBlockChange(event.getBlock().getLocation(), event.getBlock().getBlockData());
plot.debug("Prevented block physics and resent block change because disable-physics = true");
return;
}
if (event.getChangedType() == Material.COMPARATOR) {
if (!plot.getFlag(RedstoneFlag.class)) {
event.setCancelled(true);
plot.debug("Prevented comparator update because redstone = false");
}
return;
}
if (PHYSICS_BLOCKS.contains(event.getChangedType())) {
if (plot.getFlag(DisablePhysicsFlag.class)) {
event.setCancelled(true);
plot.debug("Prevented block physics because disable-physics = true");
}
return;
}
if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) {
if (PISTONS.contains(block.getType())) {
org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData();
final BlockFace facing = piston.getFacing();
location = location.add(facing.getModX(), facing.getModY(), facing.getModZ());
Plot newPlot = area.getOwnedPlotAbs(location);
if (plot.equals(newPlot)) {
return;
}
if (!plot.isMerged() || !plot.getConnectedPlots().contains(newPlot)) {
event.setCancelled(true);
plot.debug("Prevented piston update because of invalid edge piston detection");
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void blockCreate(BlockPlaceEvent event) { public void blockCreate(BlockPlaceEvent event) {
Location location = BukkitUtil.adapt(event.getBlock().getLocation()); Location location = BukkitUtil.adapt(event.getBlock().getLocation());
@ -163,6 +285,13 @@ public class BlockEventListener implements Listener {
if (plot != null) { if (plot != null) {
if (area.notifyIfOutsideBuildArea(pp, location.getY())) { if (area.notifyIfOutsideBuildArea(pp, location.getY())) {
event.setCancelled(true); event.setCancelled(true);
pp.sendMessage(
TranslatableCaption.of("height.height_limit"),
TagResolver.builder()
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
.build()
);
return; return;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
@ -254,6 +383,13 @@ public class BlockEventListener implements Listener {
} }
} else if (area.notifyIfOutsideBuildArea(plotPlayer, location.getY())) { } else if (area.notifyIfOutsideBuildArea(plotPlayer, location.getY())) {
event.setCancelled(true); event.setCancelled(true);
plotPlayer.sendMessage(
TranslatableCaption.of("height.height_limit"),
TagResolver.builder()
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
.build()
);
return; return;
} }
if (!plot.hasOwner()) { if (!plot.hasOwner()) {
@ -1209,9 +1345,18 @@ public class BlockEventListener implements Listener {
if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) { if (pp.hasPermission(Permission.PERMISSION_ADMIN_BUILD_HEIGHT_LIMIT)) {
continue; continue;
} }
if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) { if (currentLocation.getY() >= area.getMaxBuildHeight() || currentLocation.getY() < area.getMinBuildHeight()) {
event.setCancelled(true); pp.sendMessage(
break; TranslatableCaption.of("height.height_limit"),
TagResolver.builder()
.tag("minheight", Tag.inserting(Component.text(area.getMinBuildHeight())))
.tag("maxheight", Tag.inserting(Component.text(area.getMaxBuildHeight())))
.build()
);
if (area.notifyIfOutsideBuildArea(pp, currentLocation.getY())) {
event.setCancelled(true);
break;
}
} }
} }

View File

@ -1,201 +0,0 @@
/*
* 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.bukkit.listener;
import com.google.inject.Inject;
import com.plotsquared.bukkit.player.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.Plot;
import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag;
import com.plotsquared.core.plot.flag.implementations.RedstoneFlag;
import com.plotsquared.core.plot.world.PlotAreaManager;
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;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
import java.util.UUID;
@SuppressWarnings("unused")
public class HighFreqBlockEventListener implements Listener {
private static final Set<Material> PISTONS = Set.of(
Material.PISTON,
Material.STICKY_PISTON
);
private static final Set<Material> PHYSICS_BLOCKS = Set.of(
Material.TURTLE_EGG,
Material.TURTLE_SPAWN_EGG
);
private final PlotAreaManager plotAreaManager;
private final WorldEdit worldEdit;
@Inject
public HighFreqBlockEventListener(final @NonNull PlotAreaManager plotAreaManager, final @NonNull WorldEdit worldEdit) {
this.plotAreaManager = plotAreaManager;
this.worldEdit = worldEdit;
}
public static void sendBlockChange(final org.bukkit.Location bloc, final BlockData data) {
TaskManager.runTaskLater(() -> {
String world = bloc.getWorld().getName();
int x = bloc.getBlockX();
int z = bloc.getBlockZ();
int distance = Bukkit.getViewDistance() * 16;
for (final PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
Location location = player.getLocation();
if (location.getWorldName().equals(world)) {
if (16 * Math.abs(location.getX() - x) / 16 > distance || 16 * Math.abs(location.getZ() - z) / 16 > distance) {
continue;
}
((BukkitPlayer) player).player.sendBlockChange(bloc, data);
}
}
}, TaskTime.ticks(3L));
}
@EventHandler
public void onRedstoneEvent(BlockRedstoneEvent event) {
Block block = event.getBlock();
Location location = BukkitUtil.adapt(block.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = location.getOwnedPlot();
if (plot == null) {
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, RedstoneFlag.class, false)) {
event.setNewCurrent(0);
}
return;
}
if (!plot.getFlag(RedstoneFlag.class)) {
event.setNewCurrent(0);
plot.debug("Redstone event was cancelled because redstone = false");
return;
}
if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable = false;
if (!DBFunc.SERVER.equals(plot.getOwner())) {
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
if (PlotSquared.platform().playerManager().getPlayerIfExists(owner) != null) {
disable = false;
break;
}
}
} else {
disable = PlotSquared.platform().playerManager().getPlayerIfExists(plot.getOwnerAbs()) == null;
}
}
if (disable) {
for (UUID trusted : plot.getTrusted()) {
if (PlotSquared.platform().playerManager().getPlayerIfExists(trusted) != null) {
disable = false;
break;
}
}
if (disable) {
event.setNewCurrent(0);
plot.debug("Redstone event was cancelled because no trusted player was in the plot");
return;
}
}
}
if (Settings.Redstone.DISABLE_UNOCCUPIED) {
for (final PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
if (plot.equals(player.getCurrentPlot())) {
return;
}
}
event.setNewCurrent(0);
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onPhysicsEvent(BlockPhysicsEvent event) {
Block block = event.getBlock();
Location location = BukkitUtil.adapt(block.getLocation());
PlotArea area = location.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getOwnedPlotAbs(location);
if (plot == null) {
return;
}
if (event.getChangedType().hasGravity() && plot.getFlag(DisablePhysicsFlag.class)) {
event.setCancelled(true);
sendBlockChange(event.getBlock().getLocation(), event.getBlock().getBlockData());
plot.debug("Prevented block physics and resent block change because disable-physics = true");
return;
}
if (event.getChangedType() == Material.COMPARATOR) {
if (!plot.getFlag(RedstoneFlag.class)) {
event.setCancelled(true);
plot.debug("Prevented comparator update because redstone = false");
}
return;
}
if (PHYSICS_BLOCKS.contains(event.getChangedType())) {
if (plot.getFlag(DisablePhysicsFlag.class)) {
event.setCancelled(true);
plot.debug("Prevented block physics because disable-physics = true");
}
return;
}
if (Settings.Redstone.DETECT_INVALID_EDGE_PISTONS) {
if (PISTONS.contains(block.getType())) {
org.bukkit.block.data.Directional piston = (org.bukkit.block.data.Directional) block.getBlockData();
final BlockFace facing = piston.getFacing();
location = location.add(facing.getModX(), facing.getModY(), facing.getModZ());
Plot newPlot = area.getOwnedPlotAbs(location);
if (plot.equals(newPlot)) {
return;
}
if (!plot.isMerged() || !plot.getConnectedPlots().contains(newPlot)) {
event.setCancelled(true);
plot.debug("Prevented piston update because of invalid edge piston detection");
}
}
}
}
}

View File

@ -201,76 +201,11 @@ public class PlayerEventListener implements Listener {
"GLOW_INK_SAC" "GLOW_INK_SAC"
)); ));
int[] version = PlotSquared.platform().serverVersion(); int[] version = PlotSquared.platform().serverVersion();
if (version[1] >= 20) { if (version[1] >= 20 && version[2] >= 1) {
mutableDyes.add("HONEYCOMB"); mutableDyes.add("HONEYCOMB");
} }
DYES = Set.copyOf(mutableDyes); DYES = Set.copyOf(mutableDyes);
} }
private static final Set<String> INTERACTABLE_MATERIALS;
static {
// @formatter:off
// "temporary" fix for https://hub.spigotmc.org/jira/browse/SPIGOT-7813
// can (and should) be removed when 1.21 support is dropped
// List of all interactable 1.21 materials
INTERACTABLE_MATERIALS = Material.CHEST.isInteractable() ? null : Set.of(
"REDSTONE_ORE", "DEEPSLATE_REDSTONE_ORE", "CHISELED_BOOKSHELF", "DECORATED_POT", "CHEST", "CRAFTING_TABLE",
"FURNACE", "JUKEBOX", "OAK_FENCE", "SPRUCE_FENCE", "BIRCH_FENCE", "JUNGLE_FENCE", "ACACIA_FENCE", "CHERRY_FENCE",
"DARK_OAK_FENCE", "MANGROVE_FENCE", "BAMBOO_FENCE", "CRIMSON_FENCE", "WARPED_FENCE", "PUMPKIN",
"NETHER_BRICK_FENCE", "ENCHANTING_TABLE", "DRAGON_EGG", "ENDER_CHEST", "COMMAND_BLOCK", "BEACON", "ANVIL",
"CHIPPED_ANVIL", "DAMAGED_ANVIL", "LIGHT", "REPEATING_COMMAND_BLOCK", "CHAIN_COMMAND_BLOCK", "SHULKER_BOX",
"WHITE_SHULKER_BOX", "ORANGE_SHULKER_BOX", "MAGENTA_SHULKER_BOX", "LIGHT_BLUE_SHULKER_BOX", "YELLOW_SHULKER_BOX",
"LIME_SHULKER_BOX", "PINK_SHULKER_BOX", "GRAY_SHULKER_BOX", "LIGHT_GRAY_SHULKER_BOX", "CYAN_SHULKER_BOX",
"PURPLE_SHULKER_BOX", "BLUE_SHULKER_BOX", "BROWN_SHULKER_BOX", "GREEN_SHULKER_BOX", "RED_SHULKER_BOX",
"BLACK_SHULKER_BOX", "REPEATER", "COMPARATOR", "HOPPER", "DISPENSER", "DROPPER", "LECTERN", "LEVER",
"DAYLIGHT_DETECTOR", "TRAPPED_CHEST", "TNT", "NOTE_BLOCK", "STONE_BUTTON", "POLISHED_BLACKSTONE_BUTTON",
"OAK_BUTTON", "SPRUCE_BUTTON", "BIRCH_BUTTON", "JUNGLE_BUTTON", "ACACIA_BUTTON", "CHERRY_BUTTON",
"DARK_OAK_BUTTON", "MANGROVE_BUTTON", "BAMBOO_BUTTON", "CRIMSON_BUTTON", "WARPED_BUTTON", "IRON_DOOR", "OAK_DOOR",
"SPRUCE_DOOR", "BIRCH_DOOR", "JUNGLE_DOOR", "ACACIA_DOOR", "CHERRY_DOOR", "DARK_OAK_DOOR", "MANGROVE_DOOR",
"BAMBOO_DOOR", "CRIMSON_DOOR", "WARPED_DOOR", "COPPER_DOOR", "EXPOSED_COPPER_DOOR", "WEATHERED_COPPER_DOOR",
"OXIDIZED_COPPER_DOOR", "WAXED_COPPER_DOOR", "WAXED_EXPOSED_COPPER_DOOR", "WAXED_WEATHERED_COPPER_DOOR",
"WAXED_OXIDIZED_COPPER_DOOR", "IRON_TRAPDOOR", "OAK_TRAPDOOR", "SPRUCE_TRAPDOOR", "BIRCH_TRAPDOOR",
"JUNGLE_TRAPDOOR", "ACACIA_TRAPDOOR", "CHERRY_TRAPDOOR", "DARK_OAK_TRAPDOOR", "MANGROVE_TRAPDOOR",
"BAMBOO_TRAPDOOR", "CRIMSON_TRAPDOOR", "WARPED_TRAPDOOR", "COPPER_TRAPDOOR", "EXPOSED_COPPER_TRAPDOOR",
"WEATHERED_COPPER_TRAPDOOR", "OXIDIZED_COPPER_TRAPDOOR", "WAXED_COPPER_TRAPDOOR", "WAXED_EXPOSED_COPPER_TRAPDOOR",
"WAXED_WEATHERED_COPPER_TRAPDOOR", "WAXED_OXIDIZED_COPPER_TRAPDOOR", "OAK_FENCE_GATE", "SPRUCE_FENCE_GATE",
"BIRCH_FENCE_GATE", "JUNGLE_FENCE_GATE", "ACACIA_FENCE_GATE", "CHERRY_FENCE_GATE", "DARK_OAK_FENCE_GATE",
"MANGROVE_FENCE_GATE", "BAMBOO_FENCE_GATE", "CRIMSON_FENCE_GATE", "WARPED_FENCE_GATE", "STRUCTURE_BLOCK",
"JIGSAW", "OAK_SIGN", "SPRUCE_SIGN", "BIRCH_SIGN", "JUNGLE_SIGN", "ACACIA_SIGN", "CHERRY_SIGN", "DARK_OAK_SIGN",
"MANGROVE_SIGN", "BAMBOO_SIGN", "CRIMSON_SIGN", "WARPED_SIGN", "OAK_HANGING_SIGN", "SPRUCE_HANGING_SIGN",
"BIRCH_HANGING_SIGN", "JUNGLE_HANGING_SIGN", "ACACIA_HANGING_SIGN", "CHERRY_HANGING_SIGN",
"DARK_OAK_HANGING_SIGN", "MANGROVE_HANGING_SIGN", "BAMBOO_HANGING_SIGN", "CRIMSON_HANGING_SIGN",
"WARPED_HANGING_SIGN", "CAKE", "WHITE_BED", "ORANGE_BED", "MAGENTA_BED", "LIGHT_BLUE_BED", "YELLOW_BED",
"LIME_BED", "PINK_BED", "GRAY_BED", "LIGHT_GRAY_BED", "CYAN_BED", "PURPLE_BED", "BLUE_BED", "BROWN_BED",
"GREEN_BED", "RED_BED", "BLACK_BED", "CRAFTER", "BREWING_STAND", "CAULDRON", "FLOWER_POT", "LOOM", "COMPOSTER",
"BARREL", "SMOKER", "BLAST_FURNACE", "CARTOGRAPHY_TABLE", "FLETCHING_TABLE", "GRINDSTONE", "SMITHING_TABLE",
"STONECUTTER", "BELL", "CAMPFIRE", "SOUL_CAMPFIRE", "BEE_NEST", "BEEHIVE", "RESPAWN_ANCHOR", "CANDLE",
"WHITE_CANDLE", "ORANGE_CANDLE", "MAGENTA_CANDLE", "LIGHT_BLUE_CANDLE", "YELLOW_CANDLE", "LIME_CANDLE",
"PINK_CANDLE", "GRAY_CANDLE", "LIGHT_GRAY_CANDLE", "CYAN_CANDLE", "PURPLE_CANDLE", "BLUE_CANDLE", "BROWN_CANDLE",
"GREEN_CANDLE", "RED_CANDLE", "BLACK_CANDLE", "VAULT", "MOVING_PISTON", "REDSTONE_WIRE", "OAK_WALL_SIGN",
"SPRUCE_WALL_SIGN", "BIRCH_WALL_SIGN", "ACACIA_WALL_SIGN", "CHERRY_WALL_SIGN", "JUNGLE_WALL_SIGN",
"DARK_OAK_WALL_SIGN", "MANGROVE_WALL_SIGN", "BAMBOO_WALL_SIGN", "OAK_WALL_HANGING_SIGN",
"SPRUCE_WALL_HANGING_SIGN", "BIRCH_WALL_HANGING_SIGN", "ACACIA_WALL_HANGING_SIGN",
"CHERRY_WALL_HANGING_SIGN", "JUNGLE_WALL_HANGING_SIGN", "DARK_OAK_WALL_HANGING_SIGN",
"MANGROVE_WALL_HANGING_SIGN", "CRIMSON_WALL_HANGING_SIGN", "WARPED_WALL_HANGING_SIGN", "BAMBOO_WALL_HANGING_SIGN",
"WATER_CAULDRON", "LAVA_CAULDRON", "POWDER_SNOW_CAULDRON", "POTTED_TORCHFLOWER", "POTTED_OAK_SAPLING",
"POTTED_SPRUCE_SAPLING", "POTTED_BIRCH_SAPLING", "POTTED_JUNGLE_SAPLING", "POTTED_ACACIA_SAPLING",
"POTTED_CHERRY_SAPLING", "POTTED_DARK_OAK_SAPLING", "POTTED_MANGROVE_PROPAGULE", "POTTED_FERN",
"POTTED_DANDELION", "POTTED_POPPY", "POTTED_BLUE_ORCHID", "POTTED_ALLIUM", "POTTED_AZURE_BLUET",
"POTTED_RED_TULIP", "POTTED_ORANGE_TULIP", "POTTED_WHITE_TULIP", "POTTED_PINK_TULIP", "POTTED_OXEYE_DAISY",
"POTTED_CORNFLOWER", "POTTED_LILY_OF_THE_VALLEY", "POTTED_WITHER_ROSE", "POTTED_RED_MUSHROOM",
"POTTED_BROWN_MUSHROOM", "POTTED_DEAD_BUSH", "POTTED_CACTUS", "POTTED_BAMBOO", "SWEET_BERRY_BUSH",
"CRIMSON_WALL_SIGN", "WARPED_WALL_SIGN", "POTTED_CRIMSON_FUNGUS", "POTTED_WARPED_FUNGUS", "POTTED_CRIMSON_ROOTS",
"POTTED_WARPED_ROOTS", "CANDLE_CAKE", "WHITE_CANDLE_CAKE", "ORANGE_CANDLE_CAKE", "MAGENTA_CANDLE_CAKE",
"LIGHT_BLUE_CANDLE_CAKE", "YELLOW_CANDLE_CAKE", "LIME_CANDLE_CAKE", "PINK_CANDLE_CAKE", "GRAY_CANDLE_CAKE",
"LIGHT_GRAY_CANDLE_CAKE", "CYAN_CANDLE_CAKE", "PURPLE_CANDLE_CAKE", "BLUE_CANDLE_CAKE", "BROWN_CANDLE_CAKE",
"GREEN_CANDLE_CAKE", "RED_CANDLE_CAKE", "BLACK_CANDLE_CAKE", "CAVE_VINES", "CAVE_VINES_PLANT",
"POTTED_AZALEA_BUSH", "POTTED_FLOWERING_AZALEA_BUSH"
);
// @formatter:on
}
private final EventDispatcher eventDispatcher; private final EventDispatcher eventDispatcher;
private final WorldEdit worldEdit; private final WorldEdit worldEdit;
private final PlotAreaManager plotAreaManager; private final PlotAreaManager plotAreaManager;
@ -598,9 +533,9 @@ public class PlayerEventListener implements Listener {
// to is identical to the plot's home location, and untrusted-visit is true // to is identical to the plot's home location, and untrusted-visit is true
// i.e. untrusted-visit can override deny-teleport // i.e. untrusted-visit can override deny-teleport
// this is acceptable, because otherwise it wouldn't make sense to have both flags set // this is acceptable, because otherwise it wouldn't make sense to have both flags set
if (result || (plot.getFlag(UntrustedVisitFlag.class) && plot.getHomeSynchronous().equals(BukkitUtil.adaptComplete(to)))) { if (!result && !(plot.getFlag(UntrustedVisitFlag.class) && plot
plotListener.plotEntry(pp, plot); .getHomeSynchronous()
} else { .equals(BukkitUtil.adaptComplete(to)))) {
pp.sendMessage( pp.sendMessage(
TranslatableCaption.of("deny.no_enter"), TranslatableCaption.of("deny.no_enter"),
TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString()))) TagResolver.resolver("plot", Tag.inserting(Component.text(plot.toString())))
@ -613,19 +548,6 @@ public class PlayerEventListener implements Listener {
playerMove(event); playerMove(event);
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldChanged(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
BukkitPlayer pp = BukkitUtil.adapt(player);
if (this.worldEdit != null) {
if (!pp.hasPermission(Permission.PERMISSION_WORLDEDIT_BYPASS)) {
if (pp.getAttribute("worldedit")) {
pp.removeAttribute("worldedit");
}
}
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void vehicleMove(VehicleMoveEvent event) public void vehicleMove(VehicleMoveEvent event)
throws IllegalAccessException { throws IllegalAccessException {
@ -965,6 +887,40 @@ public class PlayerEventListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldChanged(PlayerChangedWorldEvent event) {
Player player = event.getPlayer();
BukkitPlayer pp = BukkitUtil.adapt(player);
// Delete last location
Plot plot;
try (final MetaDataAccess<Plot> lastPlotAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
plot = lastPlotAccess.remove();
}
try (final MetaDataAccess<Location> lastLocationAccess =
pp.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LOCATION)) {
lastLocationAccess.remove();
}
if (plot != null) {
plotListener.plotExit(pp, plot);
}
if (this.worldEdit != null) {
if (!pp.hasPermission(Permission.PERMISSION_WORLDEDIT_BYPASS)) {
if (pp.getAttribute("worldedit")) {
pp.removeAttribute("worldedit");
}
}
}
Location location = pp.getLocation();
PlotArea area = location.getPlotArea();
if (location.isPlotArea()) {
plot = location.getPlot();
if (plot != null) {
plotListener.plotEntry(pp, plot);
}
}
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent event) { public void onInventoryClick(InventoryClickEvent event) {
@ -1252,7 +1208,7 @@ public class PlayerEventListener implements Listener {
eventType = PlayerBlockEventType.INTERACT_BLOCK; eventType = PlayerBlockEventType.INTERACT_BLOCK;
blocktype1 = BukkitAdapter.asBlockType(block.getType()); blocktype1 = BukkitAdapter.asBlockType(block.getType());
if (INTERACTABLE_MATERIALS != null ? INTERACTABLE_MATERIALS.contains(blockType.name()) : blockType.isInteractable()) { if (blockType.isInteractable()) {
if (!player.isSneaking()) { if (!player.isSneaking()) {
break; break;
} }

View File

@ -95,8 +95,7 @@ public class SingleWorldListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onChunkLoad(ChunkLoadEvent event) { public void onChunkLoad(ChunkLoadEvent event) {
// disable this for now, should address https://github.com/IntellectualSites/PlotSquared/issues/4413 handle(event);
// handle(event);
} }
} }

View File

@ -23,15 +23,11 @@ import com.plotsquared.core.location.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.util.Map; import java.util.Map;
public class BukkitWorld implements World<org.bukkit.World> { public class BukkitWorld implements World<org.bukkit.World> {
// Upon world unload we should probably have the P2 BukkitWorld be GCed relatively eagerly, thus freeing the bukkit world. private static final Map<String, BukkitWorld> worldMap = Maps.newHashMap();
// We also want to avoid circumstances where a bukkit world has been GCed, but a P2 BukkitWorld has not
private static final Map<String, WeakReference<BukkitWorld>> worldMap = Maps.newHashMap();
private static final boolean HAS_MIN_Y; private static final boolean HAS_MIN_Y;
static { static {
@ -45,11 +41,10 @@ public class BukkitWorld implements World<org.bukkit.World> {
HAS_MIN_Y = temp; HAS_MIN_Y = temp;
} }
// We want to allow GC to remove bukkit worlds, but not too eagerly private final org.bukkit.World world;
private final SoftReference<org.bukkit.World> world;
private BukkitWorld(final org.bukkit.World world) { private BukkitWorld(final org.bukkit.World world) {
this.world = new SoftReference<>(world); this.world = world;
} }
/** /**
@ -73,13 +68,12 @@ public class BukkitWorld implements World<org.bukkit.World> {
* @return World instance * @return World instance
*/ */
public static @NonNull BukkitWorld of(final org.bukkit.World world) { public static @NonNull BukkitWorld of(final org.bukkit.World world) {
WeakReference<BukkitWorld> bukkitWorldRef = worldMap.get(world.getName()); BukkitWorld bukkitWorld = worldMap.get(world.getName());
BukkitWorld bukkitWorld; if (bukkitWorld != null && bukkitWorld.getPlatformWorld().equals(world)) {
if (bukkitWorldRef != null && (bukkitWorld = bukkitWorldRef.get()) != null && world.equals(bukkitWorld.world.get())) {
return bukkitWorld; return bukkitWorld;
} }
bukkitWorld = new BukkitWorld(world); bukkitWorld = new BukkitWorld(world);
worldMap.put(world.getName(), new WeakReference<>(bukkitWorld)); worldMap.put(world.getName(), bukkitWorld);
return bukkitWorld; return bukkitWorld;
} }
@ -103,26 +97,22 @@ public class BukkitWorld implements World<org.bukkit.World> {
@Override @Override
public org.bukkit.World getPlatformWorld() { public org.bukkit.World getPlatformWorld() {
org.bukkit.World world = this.world.get(); return this.world;
if (world == null) {
throw new IllegalStateException("Bukkit platform world was unloaded from memory");
}
return world;
} }
@Override @Override
public @NonNull String getName() { public @NonNull String getName() {
return this.getPlatformWorld().getName(); return this.world.getName();
} }
@Override @Override
public int getMinHeight() { public int getMinHeight() {
return getMinWorldHeight(getPlatformWorld()); return getMinWorldHeight(world);
} }
@Override @Override
public int getMaxHeight() { public int getMaxHeight() {
return getMaxWorldHeight(getPlatformWorld()) - 1; return getMaxWorldHeight(world) - 1;
} }
@Override @Override

View File

@ -78,6 +78,5 @@ tasks {
opt.encoding("UTF-8") opt.encoding("UTF-8")
opt.keyWords() opt.keyWords()
opt.addStringOption("-since", isRelease) opt.addStringOption("-since", isRelease)
opt.noTimestamp()
} }
} }

View File

@ -43,11 +43,6 @@ public class Settings extends Config {
"Leave it off if you don't need it, it can spam your console."}) "Leave it off if you don't need it, it can spam your console."})
public static boolean DEBUG = true; public static boolean DEBUG = true;
@Comment({"The activity of high-frequency event listener can be deactivated here to improve the server performance. ",
"Affected settings: 'redstone' settings here below. Affected flags: 'disable-physics', 'redstone'. ",
"Only deactivate this setting if you do not need any of the mentioned settings or flags."})
public static boolean HIGH_FREQUENCY_LISTENER = true;
@Create // This value will be generated automatically @Create // This value will be generated automatically
public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null; public static ConfigBlock<Auto_Clear> AUTO_CLEAR = null;
// A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks // A ConfigBlock is a section that can have multiple instances e.g. multiple expiry tasks

View File

@ -24,7 +24,7 @@ import com.plotsquared.core.plot.Plot;
public class PlayerEnterPlotEvent extends PlotPlayerEvent { public class PlayerEnterPlotEvent extends PlotPlayerEvent {
/** /**
* PlayerEnterPlotEvent: Called when a player enters a plot * Called when a player leaves a plot.
* *
* @param player Player that entered the plot * @param player Player that entered the plot
* @param plot Plot that was entered * @param plot Plot that was entered

View File

@ -106,10 +106,6 @@ public class PlotListener {
iterator.remove(); iterator.remove();
continue; continue;
} }
// Don't attempt to heal dead players - they will get stuck in the abyss (#4406)
if (PlotSquared.platform().worldUtil().getHealth(player) <= 0) {
continue;
}
double level = PlotSquared.platform().worldUtil().getHealth(player); double level = PlotSquared.platform().worldUtil().getHealth(player);
if (level != value.max) { if (level != value.max) {
PlotSquared.platform().worldUtil().setHealth(player, Math.min(level + value.amount, value.max)); PlotSquared.platform().worldUtil().setHealth(player, Math.min(level + value.amount, value.max));

View File

@ -643,22 +643,35 @@ public class Plot {
} }
/** /**
* Gets an immutable set of owner UUIDs for a plot (supports multi-owner mega-plots). * Gets a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots).
* <p> * <p>
* This method cannot be used to add or remove owners from a plot. * This method cannot be used to add or remove owners from a plot.
* </p> * </p>
* *
* @return Immutable set of plot owners * @return Immutable view of plot owners
*/ */
public @NonNull Set<UUID> getOwners() { public @NonNull Set<UUID> getOwners() {
ImmutableSet.Builder<UUID> owners = ImmutableSet.builder(); if (this.getOwner() == null) {
for (Plot plot : getConnectedPlots()) { return ImmutableSet.of();
UUID owner = plot.getOwner();
if (owner != null) {
owners.add(owner);
}
} }
return owners.build(); if (isMerged()) {
Set<Plot> plots = getConnectedPlots();
Plot[] array = plots.toArray(new Plot[0]);
ImmutableSet.Builder<UUID> owners = ImmutableSet.builder();
UUID last = this.getOwner();
owners.add(this.getOwner());
for (final Plot current : array) {
if (current.getOwner() == null) {
continue;
}
if (last == null || current.getOwner().getMostSignificantBits() != last.getMostSignificantBits()) {
owners.add(current.getOwner());
last = current.getOwner();
}
}
return owners.build();
}
return ImmutableSet.of(this.getOwner());
} }
/** /**
@ -2561,7 +2574,7 @@ public class Plot {
*/ */
public void teleportPlayer(final PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer) { public void teleportPlayer(final PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer) {
Plot plot = this.getBasePlot(false); Plot plot = this.getBasePlot(false);
if ((getArea() == null || !(getArea() instanceof SinglePlotArea)) && !WorldUtil.isValidLocation(plot.getBottomAbs())) { if (!WorldUtil.isValidLocation(plot.getBottomAbs())) {
// prevent from teleporting into unsafe regions // prevent from teleporting into unsafe regions
player.sendMessage(TranslatableCaption.of("border.denied")); player.sendMessage(TranslatableCaption.of("border.denied"));
resultConsumer.accept(false); resultConsumer.accept(false);

View File

@ -679,8 +679,10 @@ public abstract class PlotArea implements ComponentLike {
TranslatableCaption.of("height.height_limit"), TranslatableCaption.of("height.height_limit"),
TagResolver.builder() TagResolver.builder()
.tag("minheight", Tag.inserting(Component.text(minBuildHeight))) .tag("minheight", Tag.inserting(Component.text(minBuildHeight)))
.tag("maxheight", Tag.inserting(Component.text(maxBuildHeight))) .tag(
.build() "maxheight",
Tag.inserting(Component.text(maxBuildHeight))
).build()
); );
// Return true if "failed" as the method will always be inverted otherwise // Return true if "failed" as the method will always be inverted otherwise
return true; return true;

View File

@ -37,7 +37,7 @@ import java.util.List;
public class SinglePlotManager extends PlotManager { public class SinglePlotManager extends PlotManager {
private static final int MAX_COORDINATE = 20000000; private static final int MAX_COORDINATE = 30000000;
public SinglePlotManager(final @NonNull PlotArea plotArea) { public SinglePlotManager(final @NonNull PlotArea plotArea) {
super(plotArea); super(plotArea);

View File

@ -31,8 +31,6 @@ import com.sk89q.worldedit.world.registry.LegacyMapper;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
/** /**
* {@link BlockState} related utility methods * {@link BlockState} related utility methods
*/ */
@ -45,8 +43,7 @@ public final class BlockUtil {
PARSER_CONTEXT.setRestricted(false); PARSER_CONTEXT.setRestricted(false);
PARSER_CONTEXT.setPreferringWildcard(false); PARSER_CONTEXT.setPreferringWildcard(false);
PARSER_CONTEXT.setTryLegacy(true); PARSER_CONTEXT.setTryLegacy(true);
List<InputParser<BaseBlock>> parsers = WorldEdit.getInstance().getBlockFactory().getParsers(); PARSER = WorldEdit.getInstance().getBlockFactory().getParsers().get(0);
PARSER = parsers.get(parsers.size() - 1); // Default parser is always at the end
} }
private BlockUtil() { private BlockUtil() {

View File

@ -22,7 +22,7 @@ plugins {
} }
group = "com.intellectualsites.plotsquared" group = "com.intellectualsites.plotsquared"
version = "7.3.10-SNAPSHOT" version = "7.3.8-SNAPSHOT"
if (!File("$rootDir/.git").exists()) { if (!File("$rootDir/.git").exists()) {
logger.lifecycle(""" logger.lifecycle("""
@ -79,8 +79,8 @@ subprojects {
dependencies { dependencies {
// Tests // Tests
testImplementation("org.junit.jupiter:junit-jupiter:5.10.3") testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.3") testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.2")
} }
plugins.withId("java") { plugins.withId("java") {
@ -94,7 +94,7 @@ subprojects {
} }
configurations.all { configurations.all {
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21) attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
} }
spotless { spotless {
@ -118,7 +118,7 @@ subprojects {
} }
signing { signing {
if (!project.hasProperty("skip.signing") && !version.toString().endsWith("-SNAPSHOT")) { if (!version.toString().endsWith("-SNAPSHOT")) {
val signingKey: String? by project val signingKey: String? by project
val signingPassword: String? by project val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword) useInMemoryPgpKeys(signingKey, signingPassword)
@ -209,11 +209,6 @@ subprojects {
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
} }
} }
@ -230,7 +225,7 @@ tasks.getByName<Jar>("jar") {
enabled = false enabled = false
} }
val supportedVersions = listOf("1.18.2", "1.19.4", "1.20.6", "1.21.1") val supportedVersions = listOf("1.18.2", "1.19.4", "1.20.1", "1.20.4")
tasks { tasks {
register("cacheLatestFaweArtifact") { register("cacheLatestFaweArtifact") {
val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL() val lastSuccessfulBuildUrl = uri("https://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/api/json").toURL()

View File

@ -1,20 +1,20 @@
[versions] [versions]
# Platform expectations # Platform expectations
paper = "1.20.4-R0.1-SNAPSHOT" paper = "1.20.2-R0.1-SNAPSHOT"
guice = "7.0.0" guice = "7.0.0"
spotbugs = "4.8.6" spotbugs = "4.8.4"
checkerqual = "3.46.0" checkerqual = "3.42.0"
gson = "2.10" gson = "2.10"
guava = "31.1-jre" guava = "31.1-jre"
snakeyaml = "2.0" snakeyaml = "2.0"
adventure = "4.17.0" adventure = "4.16.0"
adventure-bukkit = "4.3.4" adventure-bukkit = "4.3.2"
log4j = "2.19.0" log4j = "2.19.0"
# Plugins # Plugins
worldedit = "7.2.20" worldedit = "7.2.20"
fawe = "2.11.0" fawe = "2.9.2"
placeholderapi = "2.11.6" placeholderapi = "2.11.5"
luckperms = "5.4" luckperms = "5.4"
essentialsx = "2.20.1" essentialsx = "2.20.1"
mvdwapi = "3.1.1" mvdwapi = "3.1.1"
@ -23,21 +23,21 @@ mvdwapi = "3.1.1"
prtree = "2.0.1" prtree = "2.0.1"
aopalliance = "1.0" aopalliance = "1.0"
cloud-services = "1.8.4" cloud-services = "1.8.4"
arkitektonika = "2.1.3" arkitektonika = "2.1.2"
squirrelid = "0.3.2" squirrelid = "0.3.2"
paster = "1.1.6" paster = "1.1.5"
bstats = "3.0.2" bstats = "3.0.2"
paperlib = "1.0.8" paperlib = "1.0.8"
informative-annotations = "1.5" informative-annotations = "1.4"
vault = "1.7.1" vault = "1.7.1"
serverlib = "2.3.6" serverlib = "2.3.4"
# Gradle plugins # Gradle plugins
shadow = "8.1.1" shadow = "8.1.1"
grgit = "4.1.1" grgit = "4.1.1"
spotless = "6.25.0" spotless = "6.25.0"
nexus = "2.0.0" nexus = "2.0.0"
runPaper = "2.3.0" runPaper = "2.2.3"
[libraries] [libraries]
# Platform expectations # Platform expectations
@ -71,6 +71,7 @@ mvdwapi = { group = "com.intellectualsites.mvdwplaceholderapi", name = "MVdWPlac
squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" } squirrelid = { group = "org.enginehub", name = "squirrelid", version.ref = "squirrelid" }
arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" } arkitektonika = { group = "com.intellectualsites.arkitektonika", name = "Arkitektonika-Client", version.ref = "arkitektonika" }
paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" } paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" }
bstatsBase = { group = "org.bstats", name = "bstats-base", version.ref = "bstats" }
bstatsBukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" } bstatsBukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" }
informativeAnnotations = { group = "com.intellectualsites.informative-annotations", name = "informative-annotations", version.ref = "informative-annotations" } informativeAnnotations = { group = "com.intellectualsites.informative-annotations", name = "informative-annotations", version.ref = "informative-annotations" }
paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" } paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" }

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

7
gradlew vendored
View File

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -86,8 +84,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

2
gradlew.bat vendored
View File

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################