Merge branch 'v6' into build/v6/annotations

This commit is contained in:
Alexander Brandes
2022-05-15 15:39:02 +02:00
committed by GitHub
17 changed files with 344 additions and 102 deletions

View File

@ -513,8 +513,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
this.backgroundPipeline.registerService(essentialsUUIDService);
}
final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT);
this.impromptuPipeline.registerService(impromptuMojangService);
if (Settings.UUID.IMPROMPTU_SERVICE_MOJANG_API) {
final SquirrelIdUUIDService impromptuMojangService = new SquirrelIdUUIDService(Settings.UUID.IMPROMPTU_LIMIT);
this.impromptuPipeline.registerService(impromptuMojangService);
}
final SquirrelIdUUIDService backgroundMojangService = new SquirrelIdUUIDService(Settings.UUID.BACKGROUND_LIMIT);
this.backgroundPipeline.registerService(backgroundMojangService);
} else {

View File

@ -80,7 +80,8 @@ final class DelegatePlotGenerator extends IndependentPlotGenerator {
result.setBiome(x, z, BukkitAdapter.adapt(biome));
}
//do not annotate with Override until we discontinue support for 1.4.4
//do not annotate with Override until we discontinue support for 1.4.4 (we no longer support 1.4.4)
@Override
public void setBiome(int x, int y, int z, @NonNull Biome biome) {
result.setBiome(x, z, BukkitAdapter.adapt(biome));

View File

@ -51,6 +51,7 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.block.Block;
import org.bukkit.block.Container;
import org.bukkit.block.data.BlockData;
@ -266,7 +267,13 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
} catch (WorldEditException ignored) {
// Fallback to not so nice method
BlockData blockData = BukkitAdapter.adapt(block);
Block existing = getBukkitWorld().getBlockAt(x, y, z);
Block existing;
// Assume a chunk object has been given only when it should have been.
if (getChunkObject() instanceof Chunk chunkObject) {
existing = chunkObject.getBlock(x & 15, y, z & 15);
} else {
existing = getBukkitWorld().getBlockAt(x, y, z);
}
final BlockState existingBaseBlock = BukkitAdapter.adapt(existing.getBlockData());
if (BukkitBlockUtil.get(existing).equals(existingBaseBlock) && existing.getBlockData().matches(blockData)) {
return;
@ -282,7 +289,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
CompoundTag tag = block.getNbtData();
StateWrapper sw = new StateWrapper(tag);
sw.restoreTag(getWorld().getName(), existing.getX(), existing.getY(), existing.getZ());
sw.restoreTag(existing);
}
}
}

View File

@ -44,6 +44,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList;
import java.util.HashMap;
@ -166,14 +167,32 @@ public class StateWrapper {
return str;
}
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
/**
* Restore the TileEntity data to the given world at the given coordinates.
*
* @param worldName World name
* @param x x position
* @param y y position
* @param z z position
* @return true if successful
*/
public boolean restoreTag(String worldName, int x, int y, int z) {
if (this.tag == null) {
World world = BukkitUtil.getWorld(worldName);
if (world == null) {
return false;
}
World world = BukkitUtil.getWorld(worldName);
Block block = world.getBlockAt(x, y, z);
if (block == null) {
return restoreTag(world.getBlockAt(x, y, z));
}
/**
* Restore the TileEntity data to the given block
*
* @param block Block to restore to
* @return true if successful
*/
@SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility
public boolean restoreTag(@NonNull Block block) {
if (this.tag == null) {
return false;
}
org.bukkit.block.BlockState state = block.getState();

View File

@ -278,7 +278,7 @@ public class BukkitRegionManager extends RegionManager {
int minY = value.getMin().getY();
for (int yIndex = 0; yIndex < ids.length; yIndex++) {
int y = yIndex + minY;
BaseBlock id = ids[y];
BaseBlock id = ids[yIndex];
if (id != null) {
value.setBlock(x1, y, z1, id);
} else {