How to get rid of it, BlockGlitching

Discussion in 'Plugin Development' started by iZanax, Dec 26, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    iZanax

    A huge problem that has no fix so far I've searched.
    I'm talking about the BlockBreak glitching, people break a block where they are not allowed and they block will re spawn but it take some time, in this time the player is able to jump over walls or travel thru bushes.

    I've used Gamemode 2 for a long time (adventure mode), but this doesn't help if the player got a tool for the block he tries to break. Is there a clean solution to this problem, because glitching out of the area is something I need to prevent.

    Thanks in advance
     
  2. Offline

    LaxWasHere

    3 blocks high walls. That's all you can do.
     
  3. Offline

    YoFuzzy3

    It's caused by lag, you can't really do anything about it.
     
  4. Offline

    iZanax

    Possible to prevent attempting block breaking?
    Maybe if player is trying to break block, replace the block with same block, so the break attempt resets?
     
  5. Offline

    YoFuzzy3

    What if you cancelled Action.LEFT_CLICK_BLOCK in PlayerInteractEvent?
     
  6. Offline

    fireblast709

    Somehow you can't cancel the actual continuation of the breaking, because it first handles the damaging and then always send the packet
     
  7. Offline

    YoFuzzy3

    Well if it's used in Adventure Mode then I guess an API can be added.
     
  8. Offline

    iZanax

    Sorry for bumping this (a bit old thread)

    This problem became a big issue in my server. (BlockBreak for 1sec to glitch thru it)
    People can go on placed that isn't allowed,
    I've found no fix for this, Adventure Mode did the job, but people has tools so they can break those blocks for a sec.
    So is there ANY thing that can be done?
     
  9. Offline

    DJSanderrr

    if it just is inposable to jump over, Just dectect if he got the cord's when he's almost over it, and if so, teleoprt him back?
     
  10. Offline

    ZeusAllMighty11

    There is no fix to this.
     
  11. Offline

    Comphenix

    Sure. Depending on the circumstances, you have a couple of options available to you:
    1. Define the area or volume that is legal for a player to occupy, either with WorldBorder or your own custom plugin, and force players that enters the space outside the legal area to be teleported back to the nearest legal spot or to spawn.
      This is probably your safest bet, though it may be tough defining the legal area if you're dealing with a lot of complex shapes and boundaries.

    2. Use adventure mode AND prevent players from using (or even storing in their inventory) tools that can be used to break the blocks of your wall.
    Unfortunately, I don't think it's possible for the server to prevent this kind of glitching - at least, not more than it already does.

    To reproduce this glitch, I wrote a simple plugin that can emulate the latency of a given player and disable or enable all block break. You can get it here. Try giving yourself a fake latency of 500 ms and toggle block protection:
    Note that Bukkit/Minecraft actually prevents a player from simply breaking a wall and walking straight through. You'll walk for a little bit, and then you'll get teleported back.

    Problem is, it's relatively easy to "trick" this protection system. If you have a 2 block high wall, all you need to do is break the topmost block and jump into the momentary space. When the block reappears due to the protection plugin, you simply jump again (after half a second), and you'll end up on the top of the wall.

    It may be possible to detect this as an illegal move and teleport the player back. But it's probably more difficult than simply implementing solution 1 or 2. So ... I'd go for that instead.
     
  12. Offline

    iZanax

    Comphenix

    Thanks for thinking with me.
    unfortunate I can't use option 2 since people will have tools in Adventure mode.
    And option 1 will be almost impossible since its not a square place where the walls are that people will glitch out.

    I'm very interested in TestLag, like when BlockBreakEvent's called make the player being unable to jump and get in that sweet spot to get over the wall. I don't know if Teleport on BlockBreakEvent will cause that the player can't get on the sweet spot. Thx anyways, I hope there will be a solution, because I'm sure I'm not the only one with this problem.
     
  13. Offline

    TheTrixsta

    This would work because its called when the player left clicks the block instead of calling it when its broken

    EDIT: Why not do this? Take an array and everytime a block is broken and its cancelled, then add the block to a list and check on player move if the coordinates match where the player has glitched to.

    ROUGH CODE:
    Code:
    ArrayList<Block> blocks = new ArrayList<Block>();
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event)
    {
        Block block = event.getBlock();
        if (block.getType() == Material.GRASS)
        {
        if (!blocks.contains(block))
        {
            blocks.add(block);
        }
            event.setCancelled(true);
        }
    }
     
    @EventHandler
    public void onPlayerMove(PlayerMoveEvent event)
    {
        Player player = event.getPlayer();
        if (blocks.contains(player.getLocation().getBlock()))
        {
            //set the player back where they came and remove the block from the list
        }
    }
     
  14. Offline

    iZanax

    PlayerInteractEvent is already cancel'd
    [ e.setCancelled(true); ]

    So that didn't help unfortunately.
     
  15. Offline

    TheTrixsta

    edited my post
     
  16. Offline

    Comphenix

    I tried it just now with TestLag:
    Code:java
    1. @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
    2. public void onPlayerInteract(PlayerInteractEvent event) {
    3. Player player = event.getPlayer();
    4.  
    5. if (event.getClickedBlock() != null && disableAll.contains(player.getName())) {
    6. getLogger().info("Cancelling click");
    7. event.setCancelled(true);
    8. }
    9. }

    Unfortunately, I can still "wall jump" with the same glitch at 500 ms.
     
  17. Offline

    TheTrixsta

    Just updated my post with an untested theory may want to give that a try instead it seems much more plausible.
     
  18. Offline

    Comphenix

    Interesting. It does actually kinda works. :)

    The only problem is that it's also triggered when a player digs a block down into the ground. But you might be able to filter that by checking nearby blocks (i.e. is this a wall or a floor?).

    You can get the updated TestLag plugin here.

    The source code (licensed under the LGPL if you're interested) can be found here:
    https://gist.github.com/4448838
     
    TheTrixsta likes this.
  19. Offline

    Jogy34

    Or you could just cancel the BlockDamagedEvent which is fired whenever a block is damaged by a player so the player's won't even be able to start to break the blocks.
     
  20. Offline

    Comphenix

    Sorry, but that doesn't work either.

    If a player is lagging by 500 ms, the client will still think it's okay to break the block, even if the damaged event is cancelled. It's simply not quick enough.

    Here's the test code though:
    Code:java
    1. @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
    2. public void onBlockDamaged(BlockDamageEvent event) {
    3. Player player = event.getPlayer();
    4.  
    5. if (disableAll.contains(player.getName())) {
    6. //cancelledBlocks.add(event.getBlock().getLocation());
    7. event.setCancelled(true);
    8. }
    9. }
     
  21. Offline

    TheTrixsta

    Think im gonna try to create a fix plugin for this right now
     
  22. Offline

    Comphenix

    Why not. It was your idea after all. :)

    You're free to use or base it on my implementation - it's LGPL after all. Though it would be nice with some credit if you do. :D
     
  23. Offline

    TheTrixsta

    Lol ofc im giving this to the community not to hog and sell :p
     
    Comphenix likes this.
  24. Offline

    chaseoes

    Someone made a plugin that prevented this a while back. I'll try to find it...
     
  25. Offline

    TheTrixsta

    What if you wrote a plugin that only fixed this, what im doing is just checking if a block was broken and if its cancelled by another plugin add it to a list and keep a player from glitching there :p
     
    suckycomedian likes this.
  26. Offline

    suckycomedian

    No more scaling walls with disappearing blocks? :( sad days
     
  27. Offline

    TheTrixsta

    Without this plugin, I would be at a 0% success rate right now
     
Thread Status:
Not open for further replies.

Share This Page