diff --git a/src/main/java/cn/nukkit/Player.java b/src/main/java/cn/nukkit/Player.java index 264beea3e31..39d057340ad 100644 --- a/src/main/java/cn/nukkit/Player.java +++ b/src/main/java/cn/nukkit/Player.java @@ -3319,7 +3319,9 @@ public void onCompletion(Server server) { } break; case ProtocolInfo.COMMAND_REQUEST_PACKET: - VIOLATION_LISTENER.onCommandRequest(this); + CommandRequestPacket commandRequestPacket = (CommandRequestPacket) packet; + + VIOLATION_LISTENER.onCommandRequest(this, commandRequestPacket.command.length()); if (!this.spawned || !this.isAlive()) { break; @@ -3332,7 +3334,6 @@ public void onCompletion(Server server) { break; } - CommandRequestPacket commandRequestPacket = (CommandRequestPacket) packet; if (commandRequestPacket.command.length() > 512) { break; } @@ -4012,12 +4013,12 @@ public boolean chat(String message) { this.craftingType = CRAFTING_SMALL; if (this.messageCounter <= 0) { - VIOLATION_LISTENER.onChatTooFast(this); + VIOLATION_LISTENER.onChatTooFast(this, message.length()); return false; } if (message.length() > this.messageCounter * 512 + 1) { - VIOLATION_LISTENER.onChatTooLong(this); + VIOLATION_LISTENER.onChatTooLong(this, message.length()); return false; } diff --git a/src/main/java/cn/nukkit/item/food/Food.java b/src/main/java/cn/nukkit/item/food/Food.java index e38496e9205..44bab6878f3 100644 --- a/src/main/java/cn/nukkit/item/food/Food.java +++ b/src/main/java/cn/nukkit/item/food/Food.java @@ -30,7 +30,7 @@ public abstract class Food { .addEffect(Effect.getEffect(Effect.ABSORPTION).setDuration(2 * 60 * 20)) .addRelative(Item.GOLDEN_APPLE)); public static final Food apple_golden_enchanted = registerDefaultFood(new FoodEffective(4, 9.6F) - .addEffect(Effect.getEffect(Effect.REGENERATION).setAmplifier(4).setDuration(30 * 20)) + .addEffect(Effect.getEffect(Effect.REGENERATION).setAmplifier(1).setDuration(30 * 20)) .addEffect(Effect.getEffect(Effect.ABSORPTION).setDuration(2 * 60 * 20).setAmplifier(3)) .addEffect(Effect.getEffect(Effect.RESISTANCE).setDuration(5 * 60 * 20)) .addEffect(Effect.getEffect(Effect.FIRE_RESISTANCE).setDuration(5 * 60 * 20)) diff --git a/src/main/java/cn/nukkit/utils/PlayerViolationListener.java b/src/main/java/cn/nukkit/utils/PlayerViolationListener.java index 5f66e247201..93b1d83a9f2 100644 --- a/src/main/java/cn/nukkit/utils/PlayerViolationListener.java +++ b/src/main/java/cn/nukkit/utils/PlayerViolationListener.java @@ -6,12 +6,12 @@ public interface PlayerViolationListener { PlayerViolationListener NOPE = new PlayerViolationListener() { }; - default void onCommandRequest(Player player) { + default void onCommandRequest(Player player, int length) { } - default void onChatTooFast(Player player) { + default void onChatTooFast(Player player, int length) { } - default void onChatTooLong(Player player) { + default void onChatTooLong(Player player, int length) { } }