No footstep sounds plugin for hubs that hide players

Discussion in 'Archived: Plugin Requests' started by KevinEssence, Jul 19, 2013.

  1. Offline


    I have a hub and we have players hidden using the entity-tracking-range, which currently makes it so you can't see players. The only problem, you hear their footsteps :_ Can someone point me in the right direction please. Thank you.
  2. Offline


    Footstep sounds are done via the client so it is not possible to 'remove' them from the game but you could have the player floating an inch or two off the ground (flying) which will stop the sound of footsteps. And the players won't really notice as they can't see the other players. If you still haven't got this sorted in one hour, let me know and I will sort it out for you!

  3. Offline


    Wasn't able to figure out how to get them floating an inch or two above ground :p
  4. Offline


    I don't know for sure at all, but I think this MAY be possible somehow (perhaps with ProtocolLib Comphenix ?)
  5. Offline


    Stop the packet of the player. Simple.
  6. Offline


    I feel dumb asking this but where can one do that?
  7. Offline


    using protocol lib

    Dont use it much myself so i cant help you on how to do it should be fairly simple though
  8. Offline


    I'll give it a go thanks!
  9. Offline


    That's only partially true. Yes, the walking sound is handled by the client, but only for the player's own entity. The server does in fact send a sound packet for every nearby entity.

    Here's an example of how to suppress player walking sounds (download):
    1. public void onEnable() {
    2. ProtocolLibrary.getProtocolManager().addPacketListener(
    3. new PacketAdapter(this, ConnectionSide.SERVER_SIDE, Packets.Server.NAMED_SOUND_EFFECT) {
    4. public void onPacketSending(PacketEvent event) {
    5. PacketContainer packet = event.getPacket();
    6. World world = event.getPlayer().getWorld();
    8. String soundName = packet.getStrings().read(0);
    9. double x = (packet.getIntegers().read(0) / 8.0);
    10. double y = (packet.getIntegers().read(1) / 8.0);
    11. double z = (packet.getIntegers().read(2) / 8.0);
    12. Location loc = new Location(world, x, y, z);
    14. if (soundName.startsWith("step.")) {
    15. Player closest = null;
    16. double bestDistance = Double.MAX_VALUE;
    18. // Find the player closest to the sound
    19. for (Player player : world.getPlayers()) {
    20. double distance = player.getLocation().distance(loc);
    22. if (distance < bestDistance) {
    23. bestDistance = distance;
    24. closest = player;
    25. }
    26. }
    28. System.out.println("Cancelled " + soundName + " caused by " + closest);
    29. event.setCancelled(true);
    30. }
    31. }
    32. });
    33. }
  10. Offline


    Thanks so much!

    Thank you, now I must learn how to insert this code on my own. Appreciate it again can't wait to give it a go!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 3, 2016
  11. Offline


    Can't you just hide that player from every player on the hub? I believe doing so will basically hide the player from any interaction such as pvp, sound, etc.

    1. @EventHandler
    2. public void joinHidePlayer(PlayerJoinEvent event){
    3. Player player = event.getPlayer();
    4. for(Player p : Bukkit.getOnlinePlayers()){
    5. p.hidePlayer(player);
    6. player.hidePlayer(p);
    7. }
    8. }

Share This Page