Hey Guys, i am having trouble with a teleport plugin. I do not want people to spawn above water or lava, however the code i tried has not seemed to work. Here it Is Code:java if(loc.getBlock().isLiquid()){Bukkit.getServer().dispatchCommand(player, "rc");}if(!loc.getBlock().isLiquid()){player.teleport(loc);player.sendMessage((new StringBuilder()).append(ChatColor.GREEN).append("Whoooshh.....").toString());} Maybe this is not a problem with the code, it may be the fact that they seem to spawn ontop of the water.
jolbol1 Try to use something like this: Code:java if(player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()) { ...} Because you have to check the block below the player not the block the player's feet are in
How is there no player? Aren't you checking if the player spawns above a liquid? Wouldn't that be PlayerMoveEvent or something similar?
i just applied these to the loc int and it is fixed, thanks for your help. IM Checking if were im about to send the player if there is a liquid. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Please set your thread to solved so people like me don't read the entire thread only to find the issue is fixed. Seems petty on my part, but thank you anyways.