Here is yet another one of my simple questions. Anyway! I am making a sorta grappling hook plugin and was wondering if there was a method or short code to remove player from the inside of a block, kinda like an unstuck command, but call it after the player is teleported. I took a look at WorldEdit's code and it appears to over complicate things that I don't need.
mattrick16 Perhaps check if they are in a block, and then check the area in a 2x2 radius if there is air, and if so, teleport them there, if not, go up 1, and try again.
Hmm...that will probably work Is there a method for that? I kinda wanted to do it automatically and seamlessly.
Check if the block they TP to is air Code:java if(/**get the TP location*/.getBlock().getType() != Material.AIR) {player.teleport(new Location(player.getWorld(), /**get the old tp location*/.getX(), /**get the old tp location*/.getY() + /**some number*/, /**get the old tp location*/.getZ());}//UNTESTED!