changing block type

is there anyway to change the type of a block for example
@EventHandler
public void onPlace(BlockPlaceEvent e){
Block placed = e.getBlock();
placed. ??
}
nothing works, I used to make Bukkit plugins but cant fin
 

Joshua CC

Member
Make sure the event/listener is registered and if it still doesn't work, try debugging it by sending a message and let me know if anything pops up.

Mostly, you can use 'placed' as the location so its usually setBlockAt(placed, Block.STONE); for setting it.

Couldn't respond you fast, I replied to this thread like 1 AM for me, and now it's currently 9 AM. 😅
 
Make sure the event/listener is registered and if it still doesn't work, try debugging it by sending a message and let me know if anything pops up.

Mostly, you can use 'placed' as the location so its usually setBlockAt(placed, Block.STONE); for setting it.

Couldn't respond you fast, I replied to this thread like 1 AM for me, and now it's currently 9 AM. 😅
Ok thank you I'll try it, dont worry about the time thing, i replied just before going to bed hoping I could get a reply the next morning, I live in GMT+2 (South africa)😅
 
Make sure the event/listener is registered and if it still doesn't work, try debugging it by sending a message and let me know if anything pops up.

Mostly, you can use 'placed' as the location so its usually setBlockAt(placed, Block.STONE); for setting it.

Couldn't respond you fast, I replied to this thread like 1 AM for me, and now it's currently 9 AM. 😅
It still doesn't work
code:
@EventHandler
public void onPlace(BlockPlaceEvent e) {

Block placed = e.getBlock();

placed.getLevel().setBlockAt(placed, Block.STONE);

}
error:
The method setBlockAt(int, int, int, int) in the type ChunkManager is not applicable for the arguments (Block, int)
 

Joshua CC

Member
It still doesn't work
code:
@EventHandler
public void onPlace(BlockPlaceEvent e) {

Block placed = e.getBlock();

placed.getLevel().setBlockAt(placed, Block.STONE);

}
error:
The method setBlockAt(int, int, int, int) in the type ChunkManager is not applicable for the arguments (Block, int)
oops, i didn't thought setBlockAt and setBlock was different, I was at phone and wasn't sure if it was the right thing 😅

also, if you already did setBlock(placed, Block.get(Block.STONE)); and didn't work, try registering the listener first because the method works fine
>
for an alternative if it still doesn't work, try cancelling the event then do the setBlock()
 
Top