up3
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/df-mc/dragonfly/server/world"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
||||
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
||||
)
|
||||
|
||||
// CommandRequestHandler handles the CommandRequest packet.
|
||||
type CommandRequestHandler struct {
|
||||
origin protocol.CommandOrigin
|
||||
}
|
||||
|
||||
// Handle ...
|
||||
func (h *CommandRequestHandler) Handle(p packet.Packet, _ *Session, _ *world.Tx, c Controllable) error {
|
||||
pk := p.(*packet.CommandRequest)
|
||||
if pk.Internal {
|
||||
return fmt.Errorf("command request packet must never have the internal field set to true")
|
||||
}
|
||||
|
||||
h.origin = pk.CommandOrigin
|
||||
c.ExecuteCommand(pk.CommandLine)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user