Skip to content

Commit

Permalink
fix: prevent spectators from interacting with crystals
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyguy committed Jan 14, 2024
1 parent 89dd0ef commit a50af0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
FasterCrystals plugin = JavaPlugin.getPlugin(FasterCrystals.class);
Player player = (Player) event.getPlayer();
User user = plugin.getUsers().get(player);
if (player.getGameMode() == GameMode.SPECTATOR) return;
if (player.hasPotionEffect(PotionEffectType.WEAKNESS)) return; // ignore weakness hits, tool hits are slow anyway
if (user == null || !user.isFastCrystals()) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public void onPacketPlayReceive(PacketPlayReceiveEvent event) {

FasterCrystals plugin = JavaPlugin.getPlugin(FasterCrystals.class);
Player player = (Player) event.getPlayer();
if (player.getGameMode() == GameMode.SPECTATOR) return;

User user = plugin.getUsers().get(player);
if (user == null || !user.isFastCrystals()) return;

Expand Down

0 comments on commit a50af0d

Please sign in to comment.