1

Plugin Dev Error - Please Help!

ericejs123 11/13/14 7:58 am
415
11/13/2014 3:06 pm
Hi, I am working on a plugin that has a block break listener. When a dirt block is broken, i want it to be replaced with a stone block. so far, i've gotten it to be able to replace the blocks around the broken block, but not the actual block being broken. Please Help! Heres a pastebin of my current code:
http://pastebin.com/prfAp0rT
Posted by
ericejs123
Level 4 : Apprentice Miner
2

  Have something to say?

JoinSign in

7

anonpmc844841
11/13/2014 11:27 am
Level 13 : Journeyman Miner
[deleted]
1
ericejs123
11/13/2014 12:20 pm
Level 4 : Apprentice Miner
It still wont actually replace the dirt block to stone.. :/
Heres my updated code:
http://pastebin.com/E6t7a8vS
1
anonpmc844841
11/13/2014 2:53 pm
Level 13 : Journeyman Miner
[deleted]
1
ericejs123
11/13/2014 2:56 pm
Level 4 : Apprentice Miner
THANKS! it works now!
1
anonpmc844841
11/13/2014 3:06 pm
Level 13 : Journeyman Miner
[deleted]
1
ericejs123
11/13/2014 11:11 am
Level 4 : Apprentice Miner
When I have that code, it tells me that i broke a dirt block, like before, but it doesnt actually replace the dirt with stone..

if(block.getType() == Material.DIRT) {
block.setType(Material.STONE);
player.sendMessage("You mined a dirt block!");
}
else {
return;
}

What this code does in game is when i break a dirt block, it doesnt get replaced, but it doesnt drop anything either. it just disapears
1
Samstrongman
11/13/2014 8:08 am
Level 48 : Master Ninja
You're getting the relative blocks around the block you broke

if(block.getType() == Material.DIRT) {
block.setType(Martial.STONE)
}
else {
return false;
}
1

Welcome