mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Fixes #2827
If existing blocks are an instance of container, clear the inventory.
This commit is contained in:
parent
dd852801cc
commit
8fb9f29ab7
2 changed files with 6 additions and 2 deletions
|
@ -48,7 +48,9 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.Container;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.inventory.BlockInventoryHolder;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -146,6 +148,10 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (existing.getState() instanceof Container) {
|
||||||
|
((Container) existing.getState()).getInventory().clear();
|
||||||
|
}
|
||||||
|
|
||||||
existing.setType(BukkitAdapter.adapt(block.getBlockType()), false);
|
existing.setType(BukkitAdapter.adapt(block.getBlockType()), false);
|
||||||
existing.setBlockData(blockData, false);
|
existing.setBlockData(blockData, false);
|
||||||
if (block.hasNbtData()) {
|
if (block.hasNbtData()) {
|
||||||
|
|
|
@ -214,10 +214,8 @@ public class StateWrapper {
|
||||||
if (mat != null) {
|
if (mat != null) {
|
||||||
ItemStack item = new ItemStack(mat, (int) amounts[i]);
|
ItemStack item = new ItemStack(mat, (int) amounts[i]);
|
||||||
inv.setItem(slots[i], item);
|
inv.setItem(slots[i], item);
|
||||||
PlotSquared.log(mat.name() + " " + slots[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotSquared.log(inv.getStorageContents());
|
|
||||||
container.update(true, true);
|
container.update(true, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue