Open Terrain Generator (OTG)

Open Terrain Generator (OTG)

10M Downloads

[Bug]: BlockPlaceEvent#getBlock() returning wrong Block

YellowZaki opened this issue ยท 5 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Spigot 1.12, OTG v9.4 BiomeBundle

When I listen to BlockPlaceEvent, sometimes, BlockPlaceEvent#getBlock() or BlockPlaceEvent#getPlacedBlock() returns a block on wrong coordinates.
When I break the placed block and I placed again, the issue is fixed.

I've tried with only OTG installed (no other plugins) and the issue is still there.

Expected Behavior

BlockPlaceEvent#getPlacedBlock() should return the correct Block

Which platforms have you reproduced this issue using?

Spigot/Paper

OTG Version

1.12.2 v9.4

Platform Version

Paper 1.12.2 (Latest build)

Steps To Reproduce

  1. Setup a listener to BlockPlaceEvent like:
    @EventHandler
    public void onPlace(BlockPlaceEvent e) {
        e.getPlayer().sendMessage("debug0: " + e.getBlock().getLocation());
    }
  1. Generate map by flying on the world, and try to place a block anywhere.
  2. Sometimes (if the bug doesn't happen, keep trying), e.getBlock().getLocation() returns a location on other coords.

Log file

No errors

Anything else?

No response

commented

Thanks for this report. We have mostly reached EOL for 1.12.2 support, but if you can provide an MCVE demonstrating that OTG is interfering with this event, someone might be able to look into it. You're also welcome to PR any improvements.

commented

Thanks for this report. We have mostly reached EOL for 1.12.2 support, but if you can provide an MCVE demonstrating that OTG is interfering with this event, someone might be able to look into it. You're also welcome to PR any improvements.

Thank you, what is MCVE?

commented

https://stackoverflow.com/help/minimal-reproducible-example

Thank you. I've written this code:

    @EventHandler
    public void onPlace(BlockPlaceEvent e) {
        e.getPlayer().sendMessage("PlacedBlockLocation: " + e.getBlock().getLocation());
        e.getPlayer().sendMessage("PlayerLocation: " + e.getPlayer().getLocation());
        if (e.getBlock().getLocation().distance(e.getPlayer().getLocation()) > 8) {
            e.getPlayer().sendMessage("ERROR: Wrong PlacedBlockLocation");
        }
        e.getPlayer().sendMessage("----------");       

    }

If the placed block is more than 8 blocks distance from player, it is on wrong location, since it is impossible to place a block 8 blocks away from your current location.

commented

Can you create a sample server setup with a minimal plugin demonstrating the issue and attach it as a zip?