Prevent despawning of '32' via Bukkit

Discussion in 'Plugin Development' started by DxDy, May 12, 2012.

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

    DxDy

    Hey,

    Is there a way to use the bukkit api to prevent the disappeareance of the Blocks with the ID '32'?

    I tried BlockFadeEvent, BlockGrowEvent, LeavesDecayEvent, BlockBreakEvent, BlockPhysicsEvent, BlockDamageEvent, BlockBurnEvent, BlockCanBuildEent, BlockFromToEvent, BlockDispenseEvent and BlockSpread event, but it seems that none of these Events get triggered when these little shrubs disappear.

    EDIT: I'm talking especially about 32-blocks that are placed on surfaces they don't belong to, like Stone.
     
  2. Offline

    Jacek

    They probably vanish on a physics update. So maybe the try PhysicsEvent or what ever it is actually called.
     
  3. BlockPhysicsEvent should trigger that... show what code you tried with that event :-?
     
  4. Offline

    DxDy

    Code:
        @EventHandler
        void onBPE(org.bukkit.event.block.BlockPhysicsEvent e)
        {
            if (e.getBlock().getTypeId() == 32)
            {
                e.setCancelled(true);
                System.out.println("BPE:");
            }
            return;
        }
     
  5. You shouldn't add checks when testing events, you should only print stuff that you get to be sure it triggers for what you need and if it prints the data you need.

    But anyway, I think the item doens't trigger any event at all, you could consult the bukkit issue tracker or the source regarding that...
     
  6. Offline

    DxDy

    Yeah, I know that ;) But it doesn't get called anyways. At least not for the blocks on inappropiate surfaces. Any hint where exactly it is handled in the bukkit sources? I'm not very anxious to dig into the sources for longer than I need to.
     
  7. DxDy I dunno, I'm not fond of the minecraft source either, that criptic code with those one-letter variables gives me headaches =)

    I guess BlockDeadBush or CraftWorld from net.minecraft.server.

    EDIT: I guess you should better add a post in the Bukkit issue tracker to add a event to trigger that bush despawning... but search first as it most likely was already suggested =)
     
Thread Status:
Not open for further replies.

Share This Page