Fix major security bugs (3 brushes + superpickaxe)! (#1213)

* Fix major security bugs (3 brushes + superpickaxe)!
- Due to some recent changes, FAWE could edit everything in the world, no matter other plugin protections such as PS or WG.
- Fix superpickaxe allow to bypass protections => Fix SurvivalModeExtent not taking into account protections plugins due to breaking blocks naturally to get drops.

* Adress requests
- Revert some unsuitabe changes
- Add FAWE diff comments

* Clean imports

* Adress requests

Co-authored-by: NotMyFault <mc.cache@web.de>
This commit is contained in:
Aurélien
2021-08-07 11:09:33 +02:00
committed by GitHub
parent 14b3fd2085
commit abaa347ad4
8 changed files with 61 additions and 11 deletions

View File

@ -67,12 +67,14 @@ import org.bukkit.inventory.InventoryHolder;
import java.lang.ref.WeakReference;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
@ -470,6 +472,14 @@ public class BukkitWorld extends AbstractWorld {
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
}
//FAWE start
@Override
public Collection<BaseItemStack> getBlockDrops(BlockVector3 position) {
return getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ()).getDrops().stream()
.map(BukkitAdapter::adapt).collect(Collectors.toList());
}
//FAWE end
@Override
public boolean canPlaceAt(BlockVector3 position, com.sk89q.worldedit.world.block.BlockState blockState) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();