SPIGOT-4439: Allow minecraft:brand channel for use by plugins.

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2018-10-25 20:38:53 +11:00
parent 7bde974727
commit 017a3c55d7
3 changed files with 5 additions and 1 deletions

View File

@ -27,6 +27,9 @@ public interface Messenger {
/**
* Checks if the specified channel is a reserved name.
* <br>
* All channels within the "minecraft" namespace except for
* "minecraft:brand" are reserved.
*
* @param channel Channel name to check.
* @return True if the channel is reserved, otherwise false.

View File

@ -170,7 +170,7 @@ public class StandardMessenger implements Messenger {
public boolean isReservedChannel(String channel) {
channel = validateAndCorrectChannel(channel);
return channel.contains("minecraft");
return channel.contains("minecraft") && !channel.equals("minecraft:brand");
}
public void registerOutgoingPluginChannel(Plugin plugin, String channel) {

View File

@ -27,6 +27,7 @@ public class StandardMessengerTest {
assertTrue(messenger.isReservedChannel("minecraft:unregister"));
assertFalse(messenger.isReservedChannel("test:nregister"));
assertTrue(messenger.isReservedChannel("minecraft:something"));
assertFalse(messenger.isReservedChannel("minecraft:brand"));
}
@Test