Skip to content

Commit

Permalink
feat: Updated core/method/methods/join.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Dec 9, 2023
1 parent 98b1b56 commit 0cb6c88
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions core/method/methods/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
}

0 comments on commit 0cb6c88

Please sign in to comment.