99import com .comphenix .protocol .ProtocolLibrary ;
1010import com .comphenix .protocol .ProtocolManager ;
1111import com .comphenix .protocol .events .ListenerPriority ;
12+ import static com .comphenix .protocol .events .ListenerPriority .HIGH ;
1213import com .comphenix .protocol .events .PacketAdapter ;
1314import com .comphenix .protocol .events .PacketContainer ;
1415import com .comphenix .protocol .events .PacketEvent ;
2829import org .bukkit .event .EventHandler ;
2930import org .bukkit .event .EventPriority ;
3031import org .bukkit .event .Listener ;
32+ import org .bukkit .event .player .PlayerCommandSendEvent ;
3133import org .bukkit .event .player .PlayerJoinEvent ;
3234import org .bukkit .event .player .PlayerLoginEvent ;
3335import org .bukkit .plugin .java .JavaPlugin ;
@@ -159,6 +161,8 @@ public void run() {
159161 }
160162
161163
164+
165+
162166 @ Override
163167 public boolean onCommand (CommandSender sender , Command cmd , String label , String [] args ) {
164168 if (!loaded ) return true ;
@@ -171,6 +175,14 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
171175 return false ;
172176 }
173177
178+ @ EventHandler (priority =EventPriority .HIGH )
179+ public void onCommandSuggestion (PlayerCommandSendEvent event ){
180+ Player player = event .getPlayer ();
181+ if (!ready ){
182+ event .getCommands ().clear ();
183+ }
184+ }
185+
174186 @ EventHandler (priority =EventPriority .HIGH )
175187 public void onPlayerLogin (PlayerLoginEvent event ){
176188 if (!loaded ) return ;
@@ -193,6 +205,7 @@ public void onPlayerJoin(PlayerJoinEvent event){
193205 }
194206
195207 private void processQueueFor (Player playerDestination ){
208+ if (!ready ) return ;//don't process queued packets until completely enabled!
196209 if (playerDestination ==null ) return ;
197210 InetSocketAddress addr = playerDestination .getAddress ();
198211 String name = playerDestination .getName ();
0 commit comments