@hook.command("lettherebelight") def onCommand(sender, args): name = sender.getName() if name == "CONSOLE": msg(sender,"I'm not quite sure where you are looking at, so i'm afraid that won't work") else: # get block the player is looking at blocks = sender.getLastTwoTargetBlocks(None,20) # 20 is the maximum range block = blocks[-1] if blocks else None if block is not None: block.getWorld().strikeLightningEffect(block.getLocation()) block.setType(bukkit.Material.GLOWSTONE) return True