Skip to content

Commit e992722

Browse files
committed
additional layer of blocking early commands using newer method, provisionally before transitional testing of this event.
1 parent 6442269 commit e992722

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/com/github/crashdemons/aztectabcompleter/AZTabPlugin.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.comphenix.protocol.ProtocolLibrary;
1010
import com.comphenix.protocol.ProtocolManager;
1111
import com.comphenix.protocol.events.ListenerPriority;
12+
import static com.comphenix.protocol.events.ListenerPriority.HIGH;
1213
import com.comphenix.protocol.events.PacketAdapter;
1314
import com.comphenix.protocol.events.PacketContainer;
1415
import com.comphenix.protocol.events.PacketEvent;
@@ -28,6 +29,7 @@
2829
import org.bukkit.event.EventHandler;
2930
import org.bukkit.event.EventPriority;
3031
import org.bukkit.event.Listener;
32+
import org.bukkit.event.player.PlayerCommandSendEvent;
3133
import org.bukkit.event.player.PlayerJoinEvent;
3234
import org.bukkit.event.player.PlayerLoginEvent;
3335
import 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

Comments
 (0)