Skip to content

Instantly share code, notes, and snippets.

@iam4722202468
Created April 5, 2023 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iam4722202468/0bba1761df76804f968621d7120ddb19 to your computer and use it in GitHub Desktop.
Save iam4722202468/0bba1761df76804f968621d7120ddb19 to your computer and use it in GitHub Desktop.
func rpCommand(p *SimpleProxy) brigodier.LiteralNodeBuilder {
runCommand := command.Command(func(c *command.Context) error {
player, ok := c.Source.(proxy.Player)
if !ok {
return c.Source.SendMessage(&Text{Content: "You must be a player to run this command."})
}
rp := proxy.ResourcePackInfo{
URL: "http://localhost:8080/resourcepack?id=00000000-0000-0000-0000-000000000000" + "&" + strconv.FormatInt(time.Now().Unix(), 10),
ShouldForce: true,
Prompt: &Text{Content: "You don't have permission to join this server."},
}
fmt.Println("Resourcepack", rp.URL)
err := player.SendResourcePack(rp)
if err != nil {
fmt.Println(err)
return c.Source.SendMessage(&Text{Content: "Error sending resource pack."})
}
return c.Source.SendMessage(&Text{Content: "Resource pack sent"})
})
return brigodier.Literal("rp2").Then().
// Adds message argument as in "/broadcast <message>"
Executes(runCommand)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment