Merge remote-tracking branch 'upstream/master' into extension-exposing

This commit is contained in:
LeoDog896 2021-03-24 09:10:42 -04:00
commit d1e0247754
2 changed files with 15 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package net.minestom.server.listener;
import net.minestom.server.MinecraftServer;
import net.minestom.server.data.Data;
import net.minestom.server.entity.Entity;
import net.minestom.server.entity.EntityType;
import net.minestom.server.entity.GameMode;
import net.minestom.server.entity.Player;
import net.minestom.server.event.player.PlayerBlockInteractEvent;
@ -122,9 +123,11 @@ public class BlockPlacementListener {
// Check if the player is trying to place a block in an entity
boolean intersect = player.getBoundingBox().intersect(blockPosition);
if (!intersect && block.isSolid()) {
// TODO push entities too close to the position
for (Entity entity : entities) {
// 'player' has already been checked
if (entity == player)
if (entity == player ||
entity.getEntityType() == EntityType.ITEM)
continue;
intersect = entity.getBoundingBox().intersect(blockPosition);

View File

@ -302,6 +302,17 @@ public final class ConnectionManager {
this.playerInitializations.add(playerInitialization);
}
/**
* Removes an existing player initialization consumer.
* <p>
* Removal of player initializations should be done by reference, and not cloning.
*
* @param playerInitialization the {@link Player} initialization consumer
*/
public void removePlayerInitialization(@NotNull Consumer<Player> playerInitialization) {
this.playerInitializations.remove(playerInitialization);
}
/**
* Gets the kick reason when the server is shutdown using {@link MinecraftServer#stopCleanly()}.
*