Paper/patches/api/0166-Change-the-reserved-channel-check-to-be-sensible.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
09943450 Update SnakeYAML version
5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc
6f82b381 PR-788: Add getHand() to all relevant events

CraftBukkit Changes:
aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe
5329dd6fd PR-1107: Add getHand() to all relevant events
93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
2022-10-02 09:56:36 +02:00

35 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com>
Date: Tue, 23 Oct 2018 19:32:55 +0300
Subject: [PATCH] Change the reserved channel check to be sensible
diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
index 1d061412cdafa28c6940c7433747ab1dabe23de1..6fda7f3aa68e76af64362e9afed70fc6a5e92986 100644
--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java
@@ -172,7 +172,7 @@ public class StandardMessenger implements Messenger {
public boolean isReservedChannel(@NotNull String channel) {
channel = validateAndCorrectChannel(channel);
- return channel.contains("minecraft") && !channel.equals("minecraft:brand");
+ return channel.equals("minecraft:register") || channel.equals("minecraft:unregister"); // Paper
}
@Override
diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
index dce3d619a6f1791197e44277c2dee9eaf19ff56f..7e2335ed8acc692af1e70eddcf97ee7a56e30f68 100644
--- a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
+++ b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java
@@ -25,8 +25,8 @@ public class StandardMessengerTest {
assertTrue(messenger.isReservedChannel("minecraft:register"));
assertFalse(messenger.isReservedChannel("test:register"));
assertTrue(messenger.isReservedChannel("minecraft:unregister"));
- assertFalse(messenger.isReservedChannel("test:nregister"));
- assertTrue(messenger.isReservedChannel("minecraft:something"));
+ assertFalse(messenger.isReservedChannel("test:unregister")); // Paper - fix typo
+ assertFalse(messenger.isReservedChannel("minecraft:something")); // Paper - now less strict
assertFalse(messenger.isReservedChannel("minecraft:brand"));
}