mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
Fixed return value for un/registerChannel. Now returns properly indicate when un/register commands should be sent.
This commit is contained in:
1 parent
ebdc9b9464
commit
fcc781b100
1 file changed
+3
-5
@@ -69,9 +69,11 @@ public class MessageManager
|
||||
{
|
||||
ArrayList<IPacketHandler> handlers = channelToHandlers.get(channel);
|
||||
ArrayList<String> channels = handlerToChannels.get(handler);
|
||||
boolean ret = false;
|
||||
|
||||
if (handlers == null)
|
||||
{
|
||||
ret = true;
|
||||
handlers = new ArrayList<IPacketHandler>();
|
||||
channelToHandlers.put(channel, handlers);
|
||||
}
|
||||
@@ -82,16 +84,13 @@ public class MessageManager
|
||||
handlerToChannels.put(handler, channels);
|
||||
}
|
||||
|
||||
boolean ret = false;
|
||||
if (!channels.contains(channel))
|
||||
{
|
||||
channels.add(channel);
|
||||
ret = true;
|
||||
}
|
||||
if (!handlers.contains(handler))
|
||||
{
|
||||
handlers.add(handler);
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -113,17 +112,16 @@ public class MessageManager
|
||||
|
||||
if (handlers != null && handlers.contains(handler))
|
||||
{
|
||||
ret = true;
|
||||
handlers.remove(handler);
|
||||
if (handlers.size() == 0)
|
||||
{
|
||||
ret = true;
|
||||
channelToHandlers.remove(channel);
|
||||
}
|
||||
}
|
||||
|
||||
if (channels != null && channels.contains(channel))
|
||||
{
|
||||
ret = true;
|
||||
channels.remove(channel);
|
||||
if (handlers.size() == 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user