From 0cb6c8881da40e05960f3d78db794a197ae40eb1 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sat, 9 Dec 2023 12:32:36 +0000 Subject: [PATCH] feat: Updated core/method/methods/join.go --- core/method/methods/join.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/method/methods/join.go b/core/method/methods/join.go index e4caef3..5a693c3 100644 --- a/core/method/methods/join.go +++ b/core/method/methods/join.go @@ -29,27 +29,29 @@ func (join Join) Description() string { return "Floods server with bots" } -func (join Join) Start() { +func (join *Join) Start() { join.ConnectionPool = mc.NewConnectionPool() utils.Init() - shouldRun = true + join.shouldRun = true port, err := strconv.Atoi(join.Info.Port) if err != nil { log.Fatal(err) } - handshakePacket = mcutils.GetHandshakePacket(join.Info.Ip, port, join.Info.Protocol, mcutils.Login) + join.handshakePacket = mcutils.GetHandshakePacket(join.Info.Ip, port, join.Info.Protocol, mcutils.Login) for i := 0; i < join.Info.Loops; i++ { go func() { - for shouldRun { + for join.shouldRun { for j := 0; j < join.Info.PerDelay; j++ { - loop(&join) + loop(join) } time.Sleep(join.Info.Delay) } }() + } +} var shouldRun = false var handshakePacket packet.Packet @@ -110,6 +112,7 @@ func connect(conn *mc.Connection, ip *string, port *string, protocol int, proxy return nil } -func (join Join) Stop() { - shouldRun = false +func (join *Join) Stop() { + join.shouldRun = false + join.ConnectionPool.CloseAllConnections() }