Being a friend of the world means acting according to wisdom from the devil. The devil offers people evil pleasure based on sin. This leads people to be full of pride and to want more and more things. It leads them to treat others in terrible ways.
People who live like this aren’t being faithful to God. God offers people true joy that comes from being near to him. People must be humble if they want to be close to God. They must recognise that they need his grace and need to be forgiven. They must recognise that God is the one who decides what is right and wrong.
That is what James meant about God being the Lawgiver. It’s also what he meant about God being the one who brings judgement. Speaking badly about other believers goes against what God wants. If someone goes against what God wants it shows that they are full of pride. Pride also makes people sure that what they plan will happen. Then they don’t admit that only God is in control of the future. James wanted believers to do good deeds each day instead of boasting about future plans.