Ok so, I have a method here that when the Entity hits the ground it saves the Location and the Block inside of a HashMap defined like so:
public static HashMap<Location, Material> blocks = new HashMap<Location, Material>();
Then a few ticks later on the server it sets the block back to original type, rather than doing this at the moment its just turning into a null block.
@EventHandler
public void onProjecitle(ProjectileHitEvent event){
if(event.getEntity().getType() == EntityType.ENDER_PEARL){
Block block = event.getEntity().getLocation().getBlock();
for (int z = -1; z <= 1; z++) {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
final Location loc = block.getRelative(x, y, z).getLocation();
if(loc.getBlock().getType() != Material.AIR){
Aure.blocks.put(loc.getBlock().getLocation(), block.getType());
loc.getBlock().setType(Material.WOOL);
Bukkit.getScheduler().runTaskLater(plugin, new Runnable(){
@Override
public void run() {
loc.getBlock().setType(Aure.blocks.get(loc.getBlock().getLocation()));
}
}, 40L);
}
}
}
}
}
}