Fix bug when you could send a break a custom block with a finished digging packet

This commit is contained in:
themode 2020-10-16 09:12:31 +02:00
parent 660a67e53e
commit 9e2e48f79c
12 changed files with 100 additions and 91 deletions

View File

@ -711,7 +711,7 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer {
} }
/** /**
* Change the gravity of the entity. * Changes the gravity of the entity.
* *
* @param gravityDragPerTick the gravity drag per tick * @param gravityDragPerTick the gravity drag per tick
*/ */

View File

@ -220,7 +220,7 @@ public abstract class EntityCreature extends LivingEntity {
} }
/** /**
* Change the entity target * Changes the entity target
* *
* @param target the new entity target * @param target the new entity target
*/ */

View File

@ -27,7 +27,7 @@ public class FakePlayerController {
} }
/** /**
* Make the player write a message * Makes the player write a message
* *
* @param message the message to write * @param message the message to write
*/ */
@ -142,7 +142,7 @@ public class FakePlayerController {
} }
/** /**
* Make the player receives a packet * Makes the player receives a packet
* WARNING: pretty much unsafe, used internally to redirect packets here, * WARNING: pretty much unsafe, used internally to redirect packets here,
* you should instead use {@link net.minestom.server.network.player.PlayerConnection#sendPacket(ServerPacket)} * you should instead use {@link net.minestom.server.network.player.PlayerConnection#sendPacket(ServerPacket)}
* *

View File

@ -44,7 +44,7 @@ public class PFPathingEntity implements IPathingEntity {
} }
/** /**
* Change the search range of the entity * Changes the search range of the entity
* *
* @param searchRange the new entity's search range * @param searchRange the new entity's search range
*/ */

View File

@ -370,7 +370,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
} }
/** /**
* Change the time rate of the instance * Changes the time rate of the instance
* <p> * <p>
* 1 is the default value and can be set to 0 to be completely disabled (constant time) * 1 is the default value and can be set to 0 to be completely disabled (constant time)
* *
@ -392,7 +392,7 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
} }
/** /**
* Change the rate at which the client is updated about the time * Changes the rate at which the client is updated about the time
* <p> * <p>
* Setting it to null means that the client will never know about time change * Setting it to null means that the client will never know about time change
* (but will still change server-side) * (but will still change server-side)

View File

@ -350,7 +350,7 @@ public class Inventory implements InventoryModifier, InventoryClickHandler, View
} }
/** /**
* Change the internal player's cursor item * Changes the internal player's cursor item
* <p> * <p>
* WARNING: the player will not be notified by the change * WARNING: the player will not be notified by the change
* *

View File

@ -80,7 +80,15 @@ public class PlayerDiggingListener {
ClientPlayerDiggingPacket.Status.CANCELLED_DIGGING, true); ClientPlayerDiggingPacket.Status.CANCELLED_DIGGING, true);
break; break;
case FINISHED_DIGGING: case FINISHED_DIGGING:
breakBlock(instance, player, blockPosition, blockStateId); final CustomBlock customBlock = instance.getCustomBlock(blockPosition);
if (customBlock != null && customBlock.enableCustomBreakDelay()) {
// Is not supposed to happen, probably a bug
sendAcknowledgePacket(player, blockPosition, blockStateId,
ClientPlayerDiggingPacket.Status.FINISHED_DIGGING, false);
} else {
// Vanilla block
breakBlock(instance, player, blockPosition, blockStateId);
}
break; break;
case DROP_ITEM_STACK: case DROP_ITEM_STACK:
final ItemStack droppedItemStack = player.getInventory().getItemInMainHand().clone(); final ItemStack droppedItemStack = player.getInventory().getItemInMainHand().clone();

View File

@ -238,8 +238,9 @@ public final class ConnectionManager {
} }
/** /**
* Removes a {@link Player} from the players list, * Removes a {@link Player} from the players list.
* used during disconnection. * <p>
* Used during disconnection, you shouldn't have to do it manually.
* *
* @param connection the player connection * @param connection the player connection
*/ */

View File

@ -76,7 +76,7 @@ public class Team {
private String[] entities; private String[] entities;
/** /**
* Default constructor to creates a team * Default constructor to creates a team.
* *
* @param teamName The registry name for the team * @param teamName The registry name for the team
*/ */
@ -113,9 +113,9 @@ public class Team {
} }
/** /**
* Adds a member to the {@link Team} * Adds a member to the {@link Team}.
* <br> * <br>
* This member can be a {@link Player} or an {@link LivingEntity} * This member can be a {@link Player} or an {@link LivingEntity}.
* *
* @param member The member to be added * @param member The member to be added
*/ */
@ -139,7 +139,7 @@ public class Team {
} }
/** /**
* Removes a member from the {@link Team} * Removes a member from the {@link Team}.
* *
* @param member The member to be removed * @param member The member to be removed
*/ */
@ -165,9 +165,9 @@ public class Team {
} }
/** /**
* Change the display name of the team * Changes the display name of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param teamDisplayName The new display name * @param teamDisplayName The new display name
*/ */
@ -177,7 +177,7 @@ public class Team {
} }
/** /**
* Change the display name of the team and sends an update packet * Changes the display name of the team and sends an update packet.
* *
* @param teamDisplayName The new display name * @param teamDisplayName The new display name
*/ */
@ -187,9 +187,9 @@ public class Team {
} }
/** /**
* Change the {@link NameTagVisibility} of the team * Changes the {@link NameTagVisibility} of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param visibility The new tag visibility * @param visibility The new tag visibility
*/ */
@ -199,7 +199,7 @@ public class Team {
} }
/** /**
* Change the {@link NameTagVisibility} of the team and sends an update packet * Changes the {@link NameTagVisibility} of the team and sends an update packet.
* *
* @param nameTagVisibility The new tag visibility * @param nameTagVisibility The new tag visibility
*/ */
@ -209,9 +209,9 @@ public class Team {
} }
/** /**
* Change the {@link CollisionRule} of the team * Changes the {@link CollisionRule} of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param rule The new rule * @param rule The new rule
*/ */
@ -221,7 +221,7 @@ public class Team {
} }
/** /**
* Change the collision rule of the team and sends an update packet * Changes the collision rule of the team and sends an update packet.
* *
* @param collisionRule The new collision rule * @param collisionRule The new collision rule
*/ */
@ -231,9 +231,9 @@ public class Team {
} }
/** /**
* Change the color of the team * Changes the color of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param color The new team color * @param color The new team color
*/ */
@ -243,7 +243,7 @@ public class Team {
} }
/** /**
* Change the color of the team and sends an update packet * Changes the color of the team and sends an update packet.
* *
* @param teamColor The new team color * @param teamColor The new team color
*/ */
@ -253,9 +253,9 @@ public class Team {
} }
/** /**
* Change the prefix of the team * Changes the prefix of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param prefix The new prefix * @param prefix The new prefix
*/ */
@ -265,7 +265,7 @@ public class Team {
} }
/** /**
* Change the prefix of the team and sends an update packet * Changes the prefix of the team and sends an update packet.
* *
* @param prefix The new prefix * @param prefix The new prefix
*/ */
@ -275,9 +275,9 @@ public class Team {
} }
/** /**
* Change the suffix of the team * Changes the suffix of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param suffix The new suffix * @param suffix The new suffix
*/ */
@ -287,7 +287,7 @@ public class Team {
} }
/** /**
* Change the suffix of the team and sends an update packet * Changes the suffix of the team and sends an update packet.
* *
* @param suffix The new suffix * @param suffix The new suffix
*/ */
@ -297,9 +297,9 @@ public class Team {
} }
/** /**
* Change the friendly flags of the team * Changes the friendly flags of the team.
* <br><br> * <br><br>
* <b>Warning:</b> This is only changed on the <b>server side</b> * <b>Warning:</b> This is only changed on the <b>server side</b>.
* *
* @param flag The new friendly flag * @param flag The new friendly flag
*/ */
@ -309,7 +309,7 @@ public class Team {
} }
/** /**
* Change the friendly flags of the team and sends an update packet * Changes the friendly flags of the team and sends an update packet.
* *
* @param flag The new friendly flag * @param flag The new friendly flag
*/ */
@ -319,7 +319,7 @@ public class Team {
} }
/** /**
* Gets the registry name of the team * Gets the registry name of the team.
* *
* @return the registry name * @return the registry name
*/ */
@ -328,7 +328,7 @@ public class Team {
} }
/** /**
* Gets the creation packet to add a team * Gets the creation packet to add a team.
* *
* @return the packet to add the team * @return the packet to add the team
*/ */
@ -341,7 +341,7 @@ public class Team {
} }
/** /**
* Creates an destruction packet to remove the team * Creates an destruction packet to remove the team.
* *
* @return the packet to remove the team * @return the packet to remove the team
*/ */
@ -353,7 +353,7 @@ public class Team {
} }
/** /**
* Obtains an unmodifiable {@link Set} of registered players who are on the team * Obtains an unmodifiable {@link Set} of registered players who are on the team.
* *
* @return an unmodifiable {@link Set} of registered players * @return an unmodifiable {@link Set} of registered players
*/ */
@ -362,7 +362,7 @@ public class Team {
} }
/** /**
* Gets the display name of the team * Gets the display name of the team.
* *
* @return the display name * @return the display name
*/ */
@ -371,7 +371,7 @@ public class Team {
} }
/** /**
* Gets the friendly flags of the team * Gets the friendly flags of the team.
* *
* @return the friendly flags * @return the friendly flags
*/ */
@ -380,7 +380,7 @@ public class Team {
} }
/** /**
* Gets the tag visibility of the team * Gets the tag visibility of the team.
* *
* @return the tag visibility * @return the tag visibility
*/ */
@ -389,7 +389,7 @@ public class Team {
} }
/** /**
* Gets the collision rule of the team * Gets the collision rule of the team.
* *
* @return the collision rule * @return the collision rule
*/ */
@ -398,7 +398,7 @@ public class Team {
} }
/** /**
* Gets the color of the team * Gets the color of the team.
* *
* @return the team color * @return the team color
*/ */
@ -407,7 +407,7 @@ public class Team {
} }
/** /**
* Gets the prefix of the team * Gets the prefix of the team.
* *
* @return the team prefix * @return the team prefix
*/ */
@ -416,7 +416,7 @@ public class Team {
} }
/** /**
* Gets the suffix of the team * Gets the suffix of the team.
* *
* @return the suffix team * @return the suffix team
*/ */
@ -429,7 +429,7 @@ public class Team {
} }
/** /**
* Sends an {@link TeamsPacket.Action#UPDATE_TEAM_INFO} packet * Sends an {@link TeamsPacket.Action#UPDATE_TEAM_INFO} packet.
*/ */
public void sendUpdatePacket() { public void sendUpdatePacket() {
final TeamsPacket updatePacket = new TeamsPacket(); final TeamsPacket updatePacket = new TeamsPacket();

View File

@ -6,7 +6,7 @@ import net.minestom.server.network.packet.server.play.TeamsPacket.CollisionRule;
import net.minestom.server.network.packet.server.play.TeamsPacket.NameTagVisibility; import net.minestom.server.network.packet.server.play.TeamsPacket.NameTagVisibility;
/** /**
* A builder which represents a fluent Object to built teams * A builder which represents a fluent Object to built teams.
*/ */
public class TeamBuilder { public class TeamBuilder {
@ -24,7 +24,7 @@ public class TeamBuilder {
private boolean updateTeam; private boolean updateTeam;
/** /**
* Creates an team builder * Creates an team builder.
* *
* @param name The name of the new team * @param name The name of the new team
* @param teamManager The manager for the team * @param teamManager The manager for the team
@ -34,7 +34,7 @@ public class TeamBuilder {
} }
/** /**
* Creates an team builder * Creates an team builder.
* *
* @param team The new team * @param team The new team
* @param teamManager The manager for the team * @param teamManager The manager for the team
@ -46,7 +46,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the prefix of the {@link Team} * Updates the prefix of the {@link Team}.
* *
* @param prefix The new prefix * @param prefix The new prefix
* @return this builder, for chaining * @return this builder, for chaining
@ -56,7 +56,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the prefix of the {@link Team} * Updates the prefix of the {@link Team}.
* *
* @param prefix The new prefix * @param prefix The new prefix
* @return this builder, for chaining * @return this builder, for chaining
@ -67,7 +67,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the color of the {@link Team} * Updates the color of the {@link Team}.
* *
* @param color The new color * @param color The new color
* @return this builder, for chaining * @return this builder, for chaining
@ -78,7 +78,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the suffix of the {@link Team} * Updates the suffix of the {@link Team}.
* *
* @param suffix The new suffix * @param suffix The new suffix
* @return this builder, for chaining * @return this builder, for chaining
@ -88,7 +88,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the suffix of the {@link Team} * Updates the suffix of the {@link Team}.
* *
* @param suffix The new suffix * @param suffix The new suffix
* @return this builder, for chaining * @return this builder, for chaining
@ -99,7 +99,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the display name of the {@link Team} * Updates the display name of the {@link Team}.
* *
* @param displayName The new display name * @param displayName The new display name
* @return this builder, for chaining * @return this builder, for chaining
@ -109,7 +109,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the display name of the {@link Team} * Updates the display name of the {@link Team}.
* *
* @param displayName The new display name * @param displayName The new display name
* @return this builder, for chaining * @return this builder, for chaining
@ -120,7 +120,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the {@link CollisionRule} of the {@link Team} * Updates the {@link CollisionRule} of the {@link Team}.
* *
* @param rule The new rule * @param rule The new rule
* @return this builder, for chaining * @return this builder, for chaining
@ -131,7 +131,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the {@link NameTagVisibility} of the {@link Team} * Updates the {@link NameTagVisibility} of the {@link Team}.
* *
* @param visibility The new tag visibility * @param visibility The new tag visibility
* @return this builder, for chaining * @return this builder, for chaining
@ -142,7 +142,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the friendly flags of the {@link Team} * Updates the friendly flags of the {@link Team}.
* *
* @param flag The new friendly flag * @param flag The new friendly flag
* @return this builder, for chaining * @return this builder, for chaining
@ -153,7 +153,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the friendly flags for allow friendly fire * Updates the friendly flags for allow friendly fire.
* *
* @return this builder, for chaining * @return this builder, for chaining
*/ */
@ -162,7 +162,7 @@ public class TeamBuilder {
} }
/** /**
* Updates the friendly flags to sees invisible players of own team * Updates the friendly flags to sees invisible players of own team.
* *
* @return this builder, for chaining * @return this builder, for chaining
*/ */
@ -171,9 +171,9 @@ public class TeamBuilder {
} }
/** /**
* Change the prefix of the {@link Team} without an update packet * Changes the prefix of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param prefix The new prefix * @param prefix The new prefix
* @return this builder, for chaining * @return this builder, for chaining
@ -183,9 +183,9 @@ public class TeamBuilder {
} }
/** /**
* Change the prefix of the {@link Team} without an update packet * Changes the prefix of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param prefix The new prefix * @param prefix The new prefix
* @return this builder, for chaining * @return this builder, for chaining
@ -196,9 +196,9 @@ public class TeamBuilder {
} }
/** /**
* Change the suffix of the {@link Team} without an update packet * Changes the suffix of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param suffix The new suffix * @param suffix The new suffix
* @return this builder, for chaining * @return this builder, for chaining
@ -209,9 +209,9 @@ public class TeamBuilder {
} }
/** /**
* Change the suffix of the {@link Team} without an update packet * Changes the suffix of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param suffix The new suffix * @param suffix The new suffix
* @return this builder, for chaining * @return this builder, for chaining
@ -222,9 +222,9 @@ public class TeamBuilder {
} }
/** /**
* Change the color of the {@link Team} without an update packet * Changes the color of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param color The new team color * @param color The new team color
* @return this builder, for chaining * @return this builder, for chaining
@ -235,9 +235,9 @@ public class TeamBuilder {
} }
/** /**
* Change the display name of the {@link Team} without an update packet * Changes the display name of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param displayName The new display name * @param displayName The new display name
* @return this builder, for chaining * @return this builder, for chaining
@ -247,9 +247,9 @@ public class TeamBuilder {
} }
/** /**
* Change the display name of the {@link Team} without an update packet * Changes the display name of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param displayName The new display name * @param displayName The new display name
* @return this builder, for chaining * @return this builder, for chaining
@ -260,9 +260,9 @@ public class TeamBuilder {
} }
/** /**
* Change the {@link CollisionRule} of the {@link Team} without an update packet * Changes the {@link CollisionRule} of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param rule The new rule * @param rule The new rule
* @return this builder, for chaining * @return this builder, for chaining
@ -273,9 +273,9 @@ public class TeamBuilder {
} }
/** /**
* Change the {@link NameTagVisibility} of the {@link Team} without an update packet * Changes the {@link NameTagVisibility} of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param visibility The new tag visibility * @param visibility The new tag visibility
* @return this builder, for chaining * @return this builder, for chaining
@ -286,9 +286,9 @@ public class TeamBuilder {
} }
/** /**
* Change the friendly flags of the {@link Team} without an update packet * Changes the friendly flags of the {@link Team} without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @param flag The new flag * @param flag The new flag
* @return this builder, for chaining * @return this builder, for chaining
@ -299,9 +299,9 @@ public class TeamBuilder {
} }
/** /**
* Change the friendly flags for allow friendly fire without an update packet * Changes the friendly flags for allow friendly fire without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @return this builder, for chaining * @return this builder, for chaining
*/ */
@ -310,9 +310,9 @@ public class TeamBuilder {
} }
/** /**
* Change the friendly flags to sees invisible players of own team without an update packet * Changes the friendly flags to sees invisible players of own team without an update packet.
* <br><br> * <br><br>
* <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b> * <b>Warning: </b> If you do not call {@link #updateTeamPacket()}, this is only changed of the <b>server side</b>.
* *
* @return this builder, for chaining * @return this builder, for chaining
*/ */
@ -321,7 +321,7 @@ public class TeamBuilder {
} }
/** /**
* Allows to send an update packet when the team is built * Allows to send an update packet when the team is built.
* *
* @return this builder, for chaining * @return this builder, for chaining
*/ */
@ -331,7 +331,7 @@ public class TeamBuilder {
} }
/** /**
* Built a team * Built a team.
* *
* @return the built team * @return the built team
*/ */

View File

@ -21,7 +21,7 @@ public final class PlayerInventoryUtils {
} }
/** /**
* Convert a packet slot to an internal one * Converts a packet slot to an internal one.
* *
* @param slot the packet slot * @param slot the packet slot
* @param offset the slot count separating the up part of the inventory to the bottom part (armor/craft in PlayerInventory, inventory slots in others) * @param offset the slot count separating the up part of the inventory to the bottom part (armor/craft in PlayerInventory, inventory slots in others)

View File

@ -7,7 +7,7 @@ public enum TimeUnit {
TICK, DAY, HOUR, MINUTE, SECOND, MILLISECOND; TICK, DAY, HOUR, MINUTE, SECOND, MILLISECOND;
/** /**
* Convert a value and its unit to milliseconds * Converts a value and its unit to milliseconds.
* *
* @param value the time value * @param value the time value
* @return the converted milliseconds based on the time value and the unit * @return the converted milliseconds based on the time value and the unit