File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed
modules/TinyProtocol/src/main/java/com/comphenix/tinyprotocol Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change 26
26
import org .bukkit .event .player .PlayerLoginEvent ;
27
27
import org .bukkit .event .server .PluginDisableEvent ;
28
28
import org .bukkit .plugin .Plugin ;
29
+ import org .bukkit .scheduler .BukkitRunnable ;
29
30
30
31
import com .comphenix .tinyprotocol .Reflection .FieldAccessor ;
31
32
import com .comphenix .tinyprotocol .Reflection .MethodInvoker ;
@@ -89,16 +90,32 @@ public abstract class TinyProtocol {
89
90
*
90
91
* @param plugin - the plugin.
91
92
*/
92
- public TinyProtocol (Plugin plugin ) {
93
+ public TinyProtocol (final Plugin plugin ) {
93
94
this .plugin = plugin ;
94
95
95
96
// Compute handler name
96
97
this .handlerName = getHandlerName ();
97
98
98
99
// Prepare existing players
99
100
registerBukkitEvents ();
100
- registerChannelHandler ();
101
- registerPlayers (plugin );
101
+
102
+ try {
103
+ registerChannelHandler ();
104
+ registerPlayers (plugin );
105
+ } catch (IllegalArgumentException ex ) {
106
+ // Damn you, late bind
107
+ plugin .getLogger ().info ("[TinyProtocol] Delaying server channel injection due to late bind." );
108
+
109
+ // Damn you, late bind
110
+ new BukkitRunnable () {
111
+ @ Override
112
+ public void run () {
113
+ registerChannelHandler ();
114
+ registerPlayers (plugin );
115
+ plugin .getLogger ().info ("[TinyProtocol] Late bind injection successful." );
116
+ }
117
+ }.runTask (plugin );
118
+ }
102
119
}
103
120
104
121
private void createServerChannelHandler () {
You can’t perform that action at this time.
0 commit comments