mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-13 11:15:57 -07:00
SPIGOT-4439: Allow minecraft:brand channel for use by plugins.
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -27,6 +27,9 @@ public interface Messenger {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the specified channel is a reserved name.
|
* 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.
|
* @param channel Channel name to check.
|
||||||
* @return True if the channel is reserved, otherwise false.
|
* @return True if the channel is reserved, otherwise false.
|
||||||
|
@@ -170,7 +170,7 @@ public class StandardMessenger implements Messenger {
|
|||||||
public boolean isReservedChannel(String channel) {
|
public boolean isReservedChannel(String channel) {
|
||||||
channel = validateAndCorrectChannel(channel);
|
channel = validateAndCorrectChannel(channel);
|
||||||
|
|
||||||
return channel.contains("minecraft");
|
return channel.contains("minecraft") && !channel.equals("minecraft:brand");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerOutgoingPluginChannel(Plugin plugin, String channel) {
|
public void registerOutgoingPluginChannel(Plugin plugin, String channel) {
|
||||||
|
@@ -27,6 +27,7 @@ public class StandardMessengerTest {
|
|||||||
assertTrue(messenger.isReservedChannel("minecraft:unregister"));
|
assertTrue(messenger.isReservedChannel("minecraft:unregister"));
|
||||||
assertFalse(messenger.isReservedChannel("test:nregister"));
|
assertFalse(messenger.isReservedChannel("test:nregister"));
|
||||||
assertTrue(messenger.isReservedChannel("minecraft:something"));
|
assertTrue(messenger.isReservedChannel("minecraft:something"));
|
||||||
|
assertFalse(messenger.isReservedChannel("minecraft:brand"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user