Commit 34b8439fec989305f09768f89b849d857622d62a
1 parent
97328206
fix integrated server plugin channels being continuously re-registered in single player
Showing
4 changed files
with
14 additions
and
6 deletions
java/common/com/mumfrey/liteloader/core/ClientPluginChannels.java
| @@ -131,6 +131,12 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | @@ -131,6 +131,12 @@ public abstract class ClientPluginChannels extends PluginChannels<PluginChannelL | ||
| 131 | 131 | ||
| 132 | try | 132 | try |
| 133 | { | 133 | { |
| 134 | + // Enumerate mods for plugin channels | ||
| 135 | + for (PluginChannelListener pluginChannelListener : this.pluginChannelListeners) | ||
| 136 | + { | ||
| 137 | + this.addPluginChannelsFor(pluginChannelListener); | ||
| 138 | + } | ||
| 139 | + | ||
| 134 | byte[] registrationData = this.getRegistrationData(); | 140 | byte[] registrationData = this.getRegistrationData(); |
| 135 | if (registrationData != null) | 141 | if (registrationData != null) |
| 136 | { | 142 | { |
java/common/com/mumfrey/liteloader/core/Events.java
| @@ -219,6 +219,8 @@ public abstract class Events<TClient, TServer extends MinecraftServer> implement | @@ -219,6 +219,8 @@ public abstract class Events<TClient, TServer extends MinecraftServer> implement | ||
| 219 | for (ServerCommandProvider commandProvider : this.serverCommandProviders) | 219 | for (ServerCommandProvider commandProvider : this.serverCommandProviders) |
| 220 | commandProvider.provideCommands(serverCommandManager); | 220 | commandProvider.provideCommands(serverCommandManager); |
| 221 | } | 221 | } |
| 222 | + | ||
| 223 | + LiteLoader.getServerPluginChannels().onServerStartup(); | ||
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | /** | 226 | /** |
java/common/com/mumfrey/liteloader/core/PluginChannels.java
| @@ -133,12 +133,6 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | @@ -133,12 +133,6 @@ public abstract class PluginChannels<L extends CommonPluginChannelListener> impl | ||
| 133 | */ | 133 | */ |
| 134 | protected byte[] getRegistrationData() | 134 | protected byte[] getRegistrationData() |
| 135 | { | 135 | { |
| 136 | - // Enumerate mods for plugin channels | ||
| 137 | - for (L pluginChannelListener : this.pluginChannelListeners) | ||
| 138 | - { | ||
| 139 | - this.addPluginChannelsFor(pluginChannelListener); | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | // If any mods have registered channels, send the REGISTER packet | 136 | // If any mods have registered channels, send the REGISTER packet |
| 143 | if (this.pluginChannels.keySet().size() > 0) | 137 | if (this.pluginChannels.keySet().size() > 0) |
| 144 | { | 138 | { |
java/common/com/mumfrey/liteloader/core/ServerPluginChannels.java
| @@ -71,6 +71,12 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | @@ -71,6 +71,12 @@ public class ServerPluginChannels extends PluginChannels<ServerPluginChannelList | ||
| 71 | void onServerStartup() | 71 | void onServerStartup() |
| 72 | { | 72 | { |
| 73 | this.clearPluginChannels(null); | 73 | this.clearPluginChannels(null); |
| 74 | + | ||
| 75 | + // Enumerate mods for plugin channels | ||
| 76 | + for (ServerPluginChannelListener pluginChannelListener : this.pluginChannelListeners) | ||
| 77 | + { | ||
| 78 | + this.addPluginChannelsFor(pluginChannelListener); | ||
| 79 | + } | ||
| 74 | } | 80 | } |
| 75 | 81 | ||
| 76 | /** | 82 | /** |