Added PlayerStartDiggingEvent warning

This commit is contained in:
themode 2020-11-18 13:22:23 +01:00
parent 408ce03cfb
commit f30330c59b
3 changed files with 7 additions and 2 deletions

View File

@ -8,6 +8,10 @@ import org.jetbrains.annotations.NotNull;
/**
* Called when a {@link Player} start digging a block,
* can be used to forbid the {@link Player} from mining it.
* <p>
* Be aware that cancelling this event does not necessary prevent the player from breaking the block
* (could be because of high latency or a modified client) so cancelling {@link PlayerBlockBreakEvent} is also necessary.
* Could be fixed in future Minestom version.
*/
public class PlayerStartDiggingEvent extends CancellableEvent {

View File

@ -74,6 +74,7 @@ public class NettyServer {
pipeline.addLast("traffic-limiter", channelTrafficShapingHandler);
// First check should verify if the packet is a legacy ping (from 1.6 version and earlier)
// Removed from the pipeline later in LegacyPingHandler if unnecessary (>1.6)
pipeline.addLast("legacy-ping", new LegacyPingHandler());
// Adds packetLength at start | Reads framed bytebuf

View File

@ -65,8 +65,8 @@ public class NettyPlayerConnection extends PlayerConnection {
public void setEncryptionKey(@NotNull SecretKey secretKey) {
Check.stateCondition(encrypted, "Encryption is already enabled!");
this.encrypted = true;
getChannel().pipeline().addBefore("framer", "decrypt", new Decrypter(MojangCrypt.getCipher(2, secretKey)));
getChannel().pipeline().addBefore("framer", "encrypt", new Encrypter(MojangCrypt.getCipher(1, secretKey)));
channel.pipeline().addBefore("framer", "decrypt", new Decrypter(MojangCrypt.getCipher(2, secretKey)));
channel.pipeline().addBefore("framer", "encrypt", new Encrypter(MojangCrypt.getCipher(1, secretKey)));
}
/**