Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
b1cd4604eb
Commit
c0b40d00a5
@ -86,7 +86,6 @@ public class PlaceItemUtils {
|
||||
* @param playSound enables sound of placing
|
||||
*/
|
||||
public PlaceItemResult placeItem(Player player, ItemStack itemStack, Block against, BlockFace againstSide, EquipmentSlot hand, boolean force, boolean applyPhysics, boolean rotateAway, boolean playSound) {
|
||||
// TODO: Place inside of player
|
||||
// If the ItemStack is null or air we cannot place it
|
||||
if (itemStack == null) return PlaceItemResult.NO_ITEM_HELD;
|
||||
if (itemStack.getType().isAir()) return PlaceItemResult.NO_ITEM_HELD;
|
||||
@ -248,6 +247,23 @@ public class PlaceItemUtils {
|
||||
worldAccessor.set(blockState, blockLocation.getWorld());
|
||||
}
|
||||
|
||||
if (blockData.getMaterial().isSolid()) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
Location min = p.getLocation().add(-0.3, 0, -0.3);
|
||||
Location max = p.getLocation().add(0.3, p.isSneaking() ? 1.5 : 1.8, 0.3);
|
||||
|
||||
Location blockmin = block.getLocation();
|
||||
Location blockmax = block.getLocation().add(1.0, 1.0, 1.0);
|
||||
if (
|
||||
max.getX() <= blockmin.getX() || min.getX() >= blockmax.getX() ||
|
||||
max.getY() <= blockmin.getY() || min.getY() >= blockmax.getY() ||
|
||||
max.getZ() <= blockmin.getZ() || min.getZ() >= blockmax.getZ()
|
||||
) {
|
||||
return PlaceItemResult.NO_PLACE_INSIDE_PLAYER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the generated BlockData to the BlockState and update the world without physics
|
||||
blockState.setBlockData(blockData);
|
||||
blockState.update(true, false);
|
||||
@ -471,6 +487,7 @@ public class PlaceItemUtils {
|
||||
NO_BUILD(false),
|
||||
NO_PLACE(false),
|
||||
NO_DOUBLE_HIGH_BLOCK_SPACE(false),
|
||||
NO_PLACE_INSIDE_PLAYER(false),
|
||||
SUCCESS(true),
|
||||
;
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren