Skip to content

Commit

Permalink
invis player
Browse files Browse the repository at this point in the history
  • Loading branch information
boiscljo committed Sep 19, 2023
1 parent c3de060 commit 7c65e32
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,16 @@ public void onInteractPlace(PlayerInteractEvent event) {

BlockFace face = event.getBlockFace();
Location loc = event.getClickedBlock().getRelative(face).getLocation();

Collection<Entity> players = loc.getNearbyEntitiesByType(Player.class, 1.5, 1.5, 1.5, null);
for (Entity playerEntity : players) {
Player player = (Player) playerEntity;
if (player.getGameMode() != GameMode.SURVIVAL) {
player.teleport(player.getLocation().add(0, 1.5, 0), TeleportCause.SPECTATE);
try {
Collection<Entity> players = loc.getNearbyEntitiesByType(Player.class, 1.5, 1.5, 1.5, null);
for (Entity playerEntity : players) {
Player player = (Player) playerEntity;
if (player.getGameMode() != GameMode.SURVIVAL) {
player.teleport(player.getLocation().add(0, 1.5, 0), TeleportCause.SPECTATE);
}
}
} catch (Throwable t) {
//Does not work on spigot
}
}

Expand Down

0 comments on commit 7c65e32

Please sign in to comment.