"So Jesus said to Peter, “Put your sword into its sheath; shall I not drink the cup that the Father has given me?” (John 18:11)
Judas the disciple of the Lord Jesus knew that the Lord will be in the Garden of Gethsemane. The Son of God who knew it all didn't try to run away from things or do things differently. A child of God is consistent in behavior. He is not perturbed by things that happen around him. Daniel who prayed three times a day didn't give up praying when the law was signed by King Darius. In fact consistent spiritual life is itself a victory and the evil devil can't overpower you. Judas came to Jesus with band of soldiers and some officers from the chief priests and the Pharisees. He also had lanterns and torches and weapons so that the arrest of the Lord Jesus will happen. In the dark of night they could not make out who the Lord was and we see the Lord Jesus asking them, "Whom do you seek?". They replied that it was Jesus of Nazareth whom they sought.
The Lord Himself revealed to them telling that He is the One whom they were seeking. He didn't ask any disciple to take His place or no Satan disguised as the Lord. As the Lord revealed Himself, the soldiers drew back and fell to the ground. The Lord again repeated the question He asked and revealed Himself again to them and desired that the disciples would be let free. Peter took a sword and struck off the right ear of Malchus (servant of High Priest).The Lord Jesus said to Peter ," Put your sword into its sheath; shall I not drink the cup that the Father has given me?"Our Lord Jesus didn't promote violence. He didn't retaliate or threaten. He was here to drink the cup given by the Father in heaven. He drank the bitter cup so that we would lift the cup of salvation and call on the name of the Lord. The Lord was on the earth for the hour of the Father to drink the cup that brought redemption to mankind.
For further reading: Luke 22:39-46, 1 Peter 2:21-24