Features/v5/move swap fixes + some other important commits (comments, etc) (#2699)

* Use generics instead of the raw class

* Add Gradle wrapper verification

* Fix biome setting in versions prior to 1.15

* Fixes #2654

* Document area getters in PlotAreaManager, and replace y-value with z in the area contains check.

* Remove update notifications

* Remove unused dependencies

* Do not kick plot owners on "/p deny *"

* Do not kick any added players on /p deny *

* Allow redstone to be used in server plot with `redstone.disable-offline` enabled.

Potentially fixes #2613

* Disallow swapping ,erged plots

* Fix legacy converter.

* Fix blockbucket pattern generation

* Prevent pasting schematics onto merged plots.

* Cancel claim event correctly

* Revert "Cancel claim event correctly"

This reverts commit 0f786155
Further investigation required

* Fix plot swapping messing up owners. Fixes #2282

* Fix plot move

* Prevent plot swapping form changing the database unless the swap was successful.

* Update signs after swap.

* Only send move success message if the move was successful.

Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>
Co-authored-by: NotMyFault <mc.cache@web.de>
Co-authored-by: Daniel <admin@hywse.eu>
Co-authored-by: Hannes Greule <SirYwell@users.noreply.github.com>
This commit is contained in:
Alexander Söderberg
2020-02-28 22:15:04 +01:00
committed by GitHub
parent 30b83faab6
commit 05626c2c8f
23 changed files with 325 additions and 199 deletions

View File

@ -7,6 +7,7 @@ import com.github.intellectualsites.plotsquared.bukkit.util.UpdateUtility;
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
import com.github.intellectualsites.plotsquared.plot.config.Captions;
import com.github.intellectualsites.plotsquared.plot.config.Settings;
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.AnimalAttackFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.AnimalCapFlag;
import com.github.intellectualsites.plotsquared.plot.flags.implementations.AnimalInteractFlag;
@ -485,17 +486,19 @@ import java.util.regex.Pattern;
return;
}
if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable;
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
if (UUIDHandler.getPlayer(owner) != null) {
disable = false;
break;
boolean disable = false;
if (!plot.getOwner().equals(DBFunc.SERVER)) {
if (plot.isMerged()) {
disable = true;
for (UUID owner : plot.getOwners()) {
if (UUIDHandler.getPlayer(owner) != null) {
disable = false;
break;
}
}
} else {
disable = UUIDHandler.getPlayer(plot.guessOwner()) == null;
}
} else {
disable = UUIDHandler.getPlayer(plot.guessOwner()) == null;
}
if (disable) {
for (UUID trusted : plot.getTrusted()) {

View File

@ -39,6 +39,7 @@ import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -46,6 +47,14 @@ import java.util.Set;
@SuppressWarnings({"unused", "WeakerAccess"}) public class BukkitUtil extends WorldUtil {
private static Method biomeSetter;
static {
try {
biomeSetter = World.class.getMethod("setBiome", Integer.class, Integer.class, Biome.class);
} catch (final Exception ignored) {
}
}
private static String lastString = null;
private static World lastWorld = null;
@ -425,7 +434,16 @@ import java.util.Set;
for (int x = region.getMinimumPoint().getX(); x <= region.getMaximumPoint().getX(); x++) {
for (int z = region.getMinimumPoint().getZ(); z <= region.getMaximumPoint().getZ(); z++) {
for (int y = 0; y < world.getMaxHeight(); y++) {
world.setBiome(x, y, z, biome);
try {
if (biomeSetter != null) {
biomeSetter.invoke(world, x, z, biome);
} else {
world.setBiome(x, y, z, biome);
}
} catch (final Exception e) {
PlotSquared.log("An error occurred setting the biome:");
e.printStackTrace();
}
}
}
}

View File

@ -7,6 +7,7 @@ import com.github.intellectualsites.plotsquared.plot.object.Location;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.util.block.ScopedLocalBlockQueue;
import com.github.intellectualsites.plotsquared.plot.util.world.PatternUtil;
import com.google.common.base.Preconditions;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.biome.BiomeType;
@ -20,9 +21,9 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import org.jetbrains.annotations.NotNull;
public class GenChunk extends ScopedLocalBlockQueue {
@ -109,7 +110,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
}
@Override public boolean setBlock(int x, int y, int z, @NotNull Pattern pattern) {
return setBlock(x, y, z, PatternUtil.apply(pattern, x, y, z));
return setBlock(x, y, z, PatternUtil.apply(Preconditions.checkNotNull(pattern, "Pattern may not be null"), x, y, z));
}
@Override public boolean setBlock(int x, int y, int z, BlockState id) {