make tests pass

This commit is contained in:
Jake Potrebic 2023-03-14 16:29:38 -07:00
parent 0f17027652
commit dbeef458b2
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
10 changed files with 103 additions and 72 deletions

View file

@ -114,10 +114,10 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+}
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
new file mode 100644
index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e052929863e
index 0000000000000000000000000000000000000000..7836ca97d2aa3a9c08e2ce69936bd801c857ad85
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -0,0 +1,704 @@
@@ -0,0 +1,705 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
@ -223,7 +223,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ */
+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors"))
+ .endsWith("_DOOR")
+ .ensureSize("DOORS", 11).lock();
+ .ensureSize("DOORS", 12).lock();
+
+ /**
+ * Covers all dyes.
@ -237,14 +237,14 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ */
+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates"))
+ .endsWith("_GATE")
+ .ensureSize("FENCE_GATES", 10).lock();
+ .ensureSize("FENCE_GATES", 11).lock();
+
+ /**
+ * Covers all variants of fences.
+ */
+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences"))
+ .endsWith("_FENCE")
+ .ensureSize("FENCES", 11).lock();
+ .ensureSize("FENCES", 12).lock();
+
+ /**
+ * Covers all variants of fish buckets.
@ -358,7 +358,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ */
+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates"))
+ .endsWith("_PRESSURE_PLATE")
+ .ensureSize("PRESSURE_PLATES", 14).lock();
+ .ensureSize("PRESSURE_PLATES", 15).lock();
+
+ /**
+ * Covers the variants of prismarine blocks.
@ -429,6 +429,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ public static final MaterialSetTag SKULLS = new MaterialSetTag(keyFor("skulls"))
+ .endsWith("_HEAD")
+ .endsWith("_SKULL")
+ .not(Material.POTTERY_SHARD_SKULL)
+ .not(Material.PISTON_HEAD)
+ .ensureSize("SKULLS", 14).lock();
+
@ -437,7 +438,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 76).lock();
+ .ensureSize("SPAWN_EGGS", 77).lock();
+
+ /**
+ * Covers all colors of stained glass.
@ -458,7 +459,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ */
+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
+ .endsWith("_TRAPDOOR")
+ .ensureSize("TRAPDOORS", 11).lock();
+ .ensureSize("TRAPDOORS", 12).lock();
+
+ /**
+ * Covers all wood variants of doors.
@ -466,7 +467,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors"))
+ .endsWith("_DOOR")
+ .not(Material.IRON_DOOR)
+ .ensureSize("WOODEN_DOORS", 10).lock();
+ .ensureSize("WOODEN_DOORS", 11).lock();
+
+ /**
+ * Covers all wood variants of fences.
@ -474,7 +475,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences"))
+ .endsWith("_FENCE")
+ .not(Material.NETHER_BRICK_FENCE)
+ .ensureSize("WOODEN_FENCES", 10).lock();
+ .ensureSize("WOODEN_FENCES", 11).lock();
+
+ /**
+ * Covers all wood variants of trapdoors.
@ -482,14 +483,14 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
+ .endsWith("_TRAPDOOR")
+ .not(Material.IRON_TRAPDOOR)
+ .ensureSize("WOODEN_TRAPDOORS", 10).lock();
+ .ensureSize("WOODEN_TRAPDOORS", 11).lock();
+
+ /**
+ * Covers the wood variants of gates.
+ */
+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates"))
+ .endsWith("_GATE")
+ .ensureSize("WOODEN_GATES", 10).lock();
+ .ensureSize("WOODEN_GATES", 11).lock();
+
+ /**
+ * Covers the variants of purpur.
@ -503,7 +504,7 @@ index 0000000000000000000000000000000000000000..0c3cd2856f7df3702ec0ff6b8dba1e05
+ */
+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
+ .endsWith("_SIGN")
+ .ensureSize("SIGNS", 40).lock();
+ .ensureSize("SIGNS", 44).lock();
+
+ /**
+ * Covers the variants of a regular torch.

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add missing isFuel Material entries
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f62117f6b2a0 100644
index 5387070a2f668871334ef522d8a3c645d899372a..bd32af93807815e23b9cf5e51ba6025170a1dee7 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -7696,6 +7696,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@ -52,7 +52,7 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
case BIRCH_LOG:
case BIRCH_PLANKS:
case BIRCH_PRESSURE_PLATE:
@@ -7741,6 +7761,22 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7741,6 +7761,24 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case BROWN_WOOL:
case CARTOGRAPHY_TABLE:
case CHARCOAL:
@ -64,6 +64,7 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
+ case CHERRY_FENCE:
+ case CHERRY_FENCE_GATE:
+ case CHERRY_HANGING_SIGN:
+ case CHERRY_LOG:
+ case CHERRY_PLANKS:
+ case CHERRY_PRESSURE_PLATE:
+ case CHERRY_SAPLING:
@ -71,11 +72,12 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
+ case CHERRY_SLAB:
+ case CHERRY_STAIRS:
+ case CHERRY_TRAPDOOR:
+ case CHERRY_WOOD:
+ // Paper end
case CHEST:
case CHISELED_BOOKSHELF:
case COAL:
@@ -7757,6 +7793,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7757,6 +7795,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case DARK_OAK_DOOR:
case DARK_OAK_FENCE:
case DARK_OAK_FENCE_GATE:
@ -83,7 +85,7 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
case DARK_OAK_LOG:
case DARK_OAK_PLANKS:
case DARK_OAK_PRESSURE_PLATE:
@@ -7785,6 +7822,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7785,6 +7824,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case JUNGLE_DOOR:
case JUNGLE_FENCE:
case JUNGLE_FENCE_GATE:
@ -91,7 +93,7 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
case JUNGLE_LOG:
case JUNGLE_PLANKS:
case JUNGLE_PRESSURE_PLATE:
@@ -7816,6 +7854,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7816,6 +7856,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case MANGROVE_DOOR:
case MANGROVE_FENCE:
case MANGROVE_FENCE_GATE:
@ -99,7 +101,7 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
case MANGROVE_LOG:
case MANGROVE_PLANKS:
case MANGROVE_PRESSURE_PLATE:
@@ -7833,6 +7872,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7833,6 +7874,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case OAK_DOOR:
case OAK_FENCE:
case OAK_FENCE_GATE:
@ -107,7 +109,7 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
case OAK_LOG:
case OAK_PLANKS:
case OAK_PRESSURE_PLATE:
@@ -7862,6 +7902,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7862,6 +7904,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case SPRUCE_DOOR:
case SPRUCE_FENCE:
case SPRUCE_FENCE_GATE:
@ -115,11 +117,15 @@ index ddcd5038e00fde469012171eef114df677cf2ecc..3376473ebcc9396ee334a40600b4f621
case SPRUCE_LOG:
case SPRUCE_PLANKS:
case SPRUCE_PRESSURE_PLATE:
@@ -7874,6 +7915,7 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -7874,8 +7917,11 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
case STICK:
case STRIPPED_ACACIA_LOG:
case STRIPPED_ACACIA_WOOD:
+ case STRIPPED_BAMBOO_BLOCK: // Paper
case STRIPPED_BIRCH_LOG:
case STRIPPED_BIRCH_WOOD:
+ case STRIPPED_CHERRY_LOG: // Paper
+ case STRIPPED_CHERRY_WOOD: // Paper
case STRIPPED_DARK_OAK_LOG:
case STRIPPED_DARK_OAK_WOOD:
case STRIPPED_JUNGLE_LOG:

View file

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 14 Mar 2023 16:28:02 -0700
Subject: [PATCH] Add missing biome enum
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
index d56e1b50dd7da18f40278cec4bfdc9414aae0be1..8228cc9f5005c13964e05fa654c5009c17e0c471 100644
--- a/src/main/java/org/bukkit/block/Biome.java
+++ b/src/main/java/org/bukkit/block/Biome.java
@@ -67,6 +67,10 @@ public enum Biome implements Keyed, net.kyori.adventure.translation.Translatable
LUSH_CAVES,
DEEP_DARK,
MEADOW,
+ // Paper start - add missing biome
+ @org.jetbrains.annotations.ApiStatus.Experimental
+ CHERRY_GROVE,
+ // Paper end
GROVE,
SNOWY_SLOPES,
FROZEN_PEAKS,

View file

@ -0,0 +1,24 @@
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 4a1148a76020089caf01f888f87afdbb35788dc0..46d9ad9cd8002770c26ed61f98593af71f534e71 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -30,11 +30,15 @@ public class PacketUtils {
try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
} catch (Exception exception) {
- if (listener.shouldPropagateHandlingExceptions()) {
- throw exception;
+ net.minecraft.network.Connection networkmanager = listener.getConnection();
+ if (networkmanager.getPlayer() != null) {
+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception);
+ } else {
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
}
-
- PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception);
+ net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
+ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
+ networkmanager.setReadOnly();
}
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);

View file

@ -0,0 +1,18 @@
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index aba1069d29389c07012ba9365fa6ae1d88fdf73c..23c81b3a96056f0b755735ad75fc81af9b046475 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -51,10 +51,11 @@ public class PacketUtils {
packet.handle(listener);
} catch (Exception exception) {
net.minecraft.network.Connection networkmanager = listener.getConnection();
+ String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>"; // Paper
if (networkmanager.getPlayer() != null) {
- LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception);
+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), playerIP, exception); // Paper
} else {
- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper
}
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));

View file

@ -18,10 +18,10 @@ index 18949b866cd8da3825b730a7d0545bd8af21afa2..d98add7d741e47d9ff095a817e0f895b
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
new file mode 100644
index 0000000000000000000000000000000000000000..1ec0f71cb9882648bdd1e645f5719d8c3cc53a3d
index 0000000000000000000000000000000000000000..f80a6ad7638453348ee82ea00b166a3aac029142
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
@@ -0,0 +1,373 @@
@@ -0,0 +1,374 @@
+package com.destroystokyo.paper.entity.ai;
+
+import com.destroystokyo.paper.entity.RangedEntity;
@ -267,6 +267,7 @@ index 0000000000000000000000000000000000000000..1ec0f71cb9882648bdd1e645f5719d8c
+ bukkitMap.put(net.minecraft.world.entity.animal.frog.Tadpole.class, org.bukkit.entity.Tadpole.class);
+ bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class);
+ bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class);
+ bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, org.bukkit.entity.Sniffer.class);
+ }
+
+ public static String getUsableName(Class<?> clazz) {
@ -791,7 +792,7 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31
LOOK,
JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ff5bfbc200d75ac10e9b8d8d30a963a406db3275..17cfd84e67682a95f19930964f9a5c9c44ada3b8 100644
index e6c089f45d3b205eeaa1e52a15bc0aa055773a2d..bec471a617780e4fa88d4c559c42175370687d7b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2699,5 +2699,11 @@ public final class CraftServer implements Server {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
index c4c1fc4e082d4d35327735e0704ada4e96195db2..fe66da8bfec647fc0ef5f26476877e6aff6da546 100644
index a30fa3d54b70ab63d24dd67a69f39742335aff1e..a79da4bc0ed06ff8ede0a34f00194f927251099b 100644
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
@@ -329,6 +329,7 @@ public enum ConnectionProtocol implements BundlerInfo.Provider {
@ -42,27 +42,3 @@ index 99b581052f937b0f2d6b5d73de699008c1d51774..81ec2011a93bb94200ad750f4666ba1c
for(int i = 0; i < bs.length; ++i) {
if (!byteBuf.isReadable()) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 4a1148a76020089caf01f888f87afdbb35788dc0..46d9ad9cd8002770c26ed61f98593af71f534e71 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -30,11 +30,15 @@ public class PacketUtils {
try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
} catch (Exception exception) {
- if (listener.shouldPropagateHandlingExceptions()) {
- throw exception;
+ net.minecraft.network.Connection networkmanager = listener.getConnection();
+ if (networkmanager.getPlayer() != null) {
+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception);
+ } else {
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
}
-
- PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception);
+ net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
+ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
+ networkmanager.setReadOnly();
}
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Added missing default perms for commands
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
index ca30f9c590f792caa8f1b76d7219e9121d932673..0f8c5fad3c999da15c5c22b4baed275cf396a5d2 100644
index ca30f9c590f792caa8f1b76d7219e9121d932673..ec771c480156db393c326fa2fbdc2d432fb76f53 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/permissions/CommandPermissions.java
@@ -25,12 +25,68 @@ public final class CommandPermissions {
@@ -25,12 +25,70 @@ public final class CommandPermissions {
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "list", "Allows the user to list all online players", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "gamemode", "Allows the user to change the gamemode of another player", PermissionDefault.OP, commands);
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "xp", "Allows the user to give themselves or others arbitrary values of experience", PermissionDefault.OP, commands);
@ -27,6 +27,7 @@ index ca30f9c590f792caa8f1b76d7219e9121d932673..0f8c5fad3c999da15c5c22b4baed275c
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "bossbar", "Allows the user to create and modify bossbars", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "clear", "Allows the user to clear items from player inventory", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "clone", "Allows the user to copy blocks from one place to another", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "damage", "Allows the user to use the damage command to damage entities", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "data", "Allows the user to get, merge, modify, and remove block entity and entity NBT data", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "datapack", "Allows the user to control loaded data packs", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "debug", "Allows the user to start or stop a debugging session", PermissionDefault.OP, commands);
@ -48,6 +49,7 @@ index ca30f9c590f792caa8f1b76d7219e9121d932673..0f8c5fad3c999da15c5c22b4baed275c
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "particle", "Allows the user to create particles", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "perf", "Allows the user to start/stop the vanilla performance metrics capture", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "playsound", "Allows the user to play a sound", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "ride", "Allows the user to use the /ride command to control passengers", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "recipe", "Allows the user to give or take recipes", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "reload", "Allows the user to reload loot tables, advancements, and functions from disk", PermissionDefault.OP, commands);
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "item", "Allows the user to replace items in inventories", PermissionDefault.OP, commands); // Remove in 1.17 (replaced by /item)

View file

@ -25,7 +25,7 @@ index e2f28c9c51f30b0e2b22055bb10899d41fc4bdf8..2ff278d085b25f40c1bdf0cc0cb564fb
// Paper end
}
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 46d9ad9cd8002770c26ed61f98593af71f534e71..aba1069d29389c07012ba9365fa6ae1d88fdf73c 100644
index 4a1148a76020089caf01f888f87afdbb35788dc0..52a84eeb3b7df782cbf91aac6df42fb8f99077f6 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -15,6 +15,24 @@ public class PacketUtils {
@ -62,7 +62,7 @@ index 46d9ad9cd8002770c26ed61f98593af71f534e71..aba1069d29389c07012ba9365fa6ae1d
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.isAcceptingMessages()) {
co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
@@ -43,6 +63,12 @@ public class PacketUtils {
@@ -39,6 +59,12 @@ public class PacketUtils {
} else {
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
}

View file

@ -4,24 +4,6 @@ Date: Tue, 5 Oct 2021 20:04:21 +0200
Subject: [PATCH] Add config option for logging player ip addresses
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index aba1069d29389c07012ba9365fa6ae1d88fdf73c..23c81b3a96056f0b755735ad75fc81af9b046475 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -51,10 +51,11 @@ public class PacketUtils {
packet.handle(listener);
} catch (Exception exception) {
net.minecraft.network.Connection networkmanager = listener.getConnection();
+ String playerIP = io.papermc.paper.configuration.GlobalConfiguration.get().logging.logPlayerIpAddresses ? String.valueOf(networkmanager.getRemoteAddress()) : "<ip address withheld>"; // Paper
if (networkmanager.getPlayer() != null) {
- LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), networkmanager.getRemoteAddress(), exception);
+ LOGGER.error("Error whilst processing packet {} for {}[{}]", packet, networkmanager.getPlayer().getScoreboardName(), playerIP, exception); // Paper
} else {
- LOGGER.error("Error whilst processing packet {} for connection from {}", packet, networkmanager.getRemoteAddress(), exception);
+ LOGGER.error("Error whilst processing packet {} for connection from {}", packet, playerIP, exception); // Paper
}
net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), net.minecraft.network.PacketSendListener.thenRun(() -> networkmanager.disconnect(error)));
diff --git a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
index 21393ad40095a4049e5b6871169b2db7aa92d13c..e6553b936dac1eb25a310d1a33acb0b1a5e646d2 100644
--- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
@ -49,7 +31,7 @@ index e5e2f763d9b4b955df79ea0c4c79565be1fe59f0..2beddfc0532c3835d50724551e3d46cb
networkmanager.send(new ClientboundDisconnectPacket(ichatmutablecomponent), PacketSendListener.thenRun(() -> {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 471e21f9e1f3ad6302e647d26a44b521fece223b..69498183a7637cd2dbb859c670e661f8722a090f 100644
index 595779cfd0ee1c405d7936f00a7cae1706125e7f..ed3af916dfa875dd0a5f1e730d20d11efd6419c6 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -206,7 +206,10 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,