Created
April 5, 2023 17:35
-
-
Save iam4722202468/0bba1761df76804f968621d7120ddb19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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