From 0c74d4575c8cba06f84e99aa281daa4bd319bbe0 Mon Sep 17 00:00:00 2001 From: DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com> Date: Sat, 1 Dec 2018 02:08:31 +0200 Subject: [PATCH] Change the reserved channel check to be sensible (#1610) --- LICENSE.md | 1 + ...eserved-channel-check-to-be-sensible.patch | 37 +++++++++++++++++++ ...-after-profile-lookups-if-not-needed.patch | 30 +++++++-------- 3 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 Spigot-API-Patches/0170-Change-the-reserved-channel-check-to-be-sensible.patch diff --git a/LICENSE.md b/LICENSE.md index 1e398936e0..335252cf65 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -39,4 +39,5 @@ willies952002 MicleBrick Trigary rickyboy320 +DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com> ``` diff --git a/Spigot-API-Patches/0170-Change-the-reserved-channel-check-to-be-sensible.patch b/Spigot-API-Patches/0170-Change-the-reserved-channel-check-to-be-sensible.patch new file mode 100644 index 0000000000..163a3a2b59 --- /dev/null +++ b/Spigot-API-Patches/0170-Change-the-reserved-channel-check-to-be-sensible.patch @@ -0,0 +1,37 @@ +From eb7842870179959eb5cec665ae4e51cda37da706 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 f21cae72..865028d3 100644 +--- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java ++++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java +@@ -170,7 +170,7 @@ public class StandardMessenger implements Messenger { + public boolean isReservedChannel(String channel) { + channel = validateAndCorrectChannel(channel); + +- return channel.contains("minecraft") && !channel.equals("minecraft:brand"); ++ return channel.equals("minecraft:register") || channel.equals("minecraft:unregister"); // Paper + } + + public void registerOutgoingPluginChannel(Plugin plugin, String channel) { +diff --git a/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java b/src/test/java/org/bukkit/plugin/messaging/StandardMessengerTest.java +index c15fa003..31ff2f61 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")); + } + +-- +2.19.1 + diff --git a/Spigot-Server-Patches/0399-Don-t-sleep-after-profile-lookups-if-not-needed.patch b/Spigot-Server-Patches/0399-Don-t-sleep-after-profile-lookups-if-not-needed.patch index d6bcb9aeab..1b3e6347ee 100644 --- a/Spigot-Server-Patches/0399-Don-t-sleep-after-profile-lookups-if-not-needed.patch +++ b/Spigot-Server-Patches/0399-Don-t-sleep-after-profile-lookups-if-not-needed.patch @@ -1,4 +1,4 @@ -From d92a33da313b20dcf7bfcf7a9070c403e961444e Mon Sep 17 00:00:00 2001 +From 59ba59cc95b4a0887b189efc1012a2c294a29e9d Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 23 Oct 2018 20:25:05 -0400 Subject: [PATCH] Don't sleep after profile lookups if not needed @@ -7,30 +7,30 @@ Mojang was sleeping even if we had no more requests to go after the current one finished, resulting in 100ms lost per profile lookup diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java -index 26a743722..6ed3199c3 100644 +index 71e48e87b..23f1447cf 100644 --- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java +++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java @@ -42,6 +42,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { - } - - final int page = 0; + } + + final int page = 0; + boolean hasRequested = false; // Paper - - for (final List request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) { - int failCount = 0; + + for (final List request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) { + int failCount = 0; @@ -67,6 +68,12 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { - LOGGER.debug("Couldn't find profile {}", name); - callback.onProfileLookupFailed(new GameProfile(null, name), new ProfileNotFoundException("Server did not find the requested profile")); - } + LOGGER.debug("Couldn't find profile {}", name); + callback.onProfileLookupFailed(new GameProfile(null, name), new ProfileNotFoundException("Server did not find the requested profile")); + } + // Paper start + if (!hasRequested) { + hasRequested = true; + continue; + } + // Paper end - - try { - Thread.sleep(DELAY_BETWEEN_PAGES); + + try { + Thread.sleep(DELAY_BETWEEN_PAGES); -- -2.19.2 +2.19.1