Anvil GUI for players and for admin

#1
This is for admin. Change the ranks on line 401 (staff) for who you want to give permission to.

cmd delete adanvil
cmd create adanvil (Admin Anvil) §a(AUD)
cmd edit adanvil 400 #400 (Anvil)§a(AUD)
cmd edit adanvil 401 let %staff% = array(\"Owner\", \"CoOwner\", \"Builder\")
cmd edit adanvil 402 let %allowed% = playergroup(%p%)
cmd edit adanvil 403 if %allowed% in %staff% then goto 406
cmd edit adanvil 404 message %p% You don’t have permission for this command!
cmd edit adanvil 405 exit
cmd edit adanvil 406 %all% = onlineplayers()
cmd edit adanvil 407 %form%[\"type\"] = \"custom_form\"
cmd edit adanvil 408 %form%[\"title\"] = \"Admin Anvil\"
cmd edit adanvil 409 %i1%[\"type\"] = \"dropdown\"
cmd edit adanvil 410 %i1%[\"text\"] = \"Select a Player!\"
cmd edit adanvil 411 %i1%[\"options\"] = %all%
cmd edit adanvil 415 %i2%[\"type\"] = \"input\"
cmd edit adanvil 416 %i2%[\"text\"] = \"Item to be renamed\"
cmd edit adanvil 417 %i2%[\"placeholder\"] = \"Enter Item Name or ID Here:\"
cmd edit adanvil 418 %i3%[\"type\"] = \"input\"
cmd edit adanvil 419 %i3%[\"text\"] = \"Items new name\"
cmd edit adanvil 420 %i3%[\"placeholder\"] = \"Enter New Name Here\"
cmd edit adanvil 421 %i4%[\"type\"] = \"input\"
cmd edit adanvil 422 %i4%[\"text\"] = \"Lore\"
cmd edit adanvil 423 %i4%[\"placeholder\"] = \"Enter Lore Here:\"
cmd edit adanvil 424 %con%[] = %i1%
cmd edit adanvil 425 %con%[] = %i2%
cmd edit adanvil 426 %con%[] = %i3%
cmd edit adanvil 427 %con%[] = %i4%
cmd edit adanvil 428 %form%[\"content\"] = %con%
cmd edit adanvil 429 %res% = dialog(%p%, %form%)
cmd edit adanvil 430 if %res% = %false% then exit
cmd edit adanvil 431 %index% = %res%[0]
cmd edit adanvil 432 %name% = %all%[%index%]
cmd edit adanvil 433 %item% = %res%[1]
cmd edit adanvil 434 %newname% = %res%[2]
cmd edit adanvil 435 %lore% = %res%[3]
cmd edit adanvil 436 if %lore% = \"\" then goto 439
cmd edit adanvil 437 asop /give %name% %item% 1 {display:{Name:"%newname%",Lore:["%lore%"]}}
cmd edit adanvil 438 exit
cmd edit adanvil 439 asop /give %name% %item% 1 {display:{Name:"%newname%"}}
cmd edit adanvil 440 exit


-----------------------------------------------------------------
This is for players. They must hold item to change its name and lore.

cmd delete anvil
cmd create anvil (PlayerAnvil) §a(AUD)
cmd edit anvil 400 #400 (Anvil)§a(AUD)
cmd edit anvil 401 %ph% = playerhand(%p%)
cmd edit anvil 407 %form%[\"type\"] = \"custom_form\"
cmd edit anvil 408 %form%[\"title\"] = \"Anvil\"
cmd edit anvil 418 %i1%[\"type\"] = \"input\"
cmd edit anvil 419 %i1%[\"text\"] = \"Items new name\"
cmd edit anvil 420 %i1%[\"placeholder\"] = \"Enter New Name Here\"
cmd edit anvil 421 %i2%[\"type\"] = \"input\"
cmd edit anvil 422 %i2%[\"text\"] = \"Lore\"
cmd edit anvil 423 %i2%[\"placeholder\"] = \"Enter Lore Here:\"
cmd edit anvil 424 %con%[] = %i1%
cmd edit anvil 425 %con%[] = %i2%
cmd edit anvil 428 %form%[\"content\"] = %con%
cmd edit anvil 429 %res% = dialog(%p%, %form%)
cmd edit anvil 430 if %res% = %false% then exit
cmd edit anvil 431 %ph% = playerhand(%p%)
cmd edit anvil 432 if %ph%["id"] = \"\" then message %p% §eYou must hold Item to change name!!!
cmd edit anvil 433 if %ph%["id"] = \"\" then exit
cmd edit anvil 434 %held% = %ph%["id"]
cmd edit anvil 435 %newname% = %res%[0]
cmd edit anvil 436 %lore% = %res%[1]
cmd edit anvil 437 if %lore% = \"\" then goto 440
cmd edit anvil 438 asop /give %p% %held% 1 {display:{Name:"%newname%",Lore:["%lore%"]}}
cmd edit anvil 439 exit
cmd edit anvil 440 asop /give %p% %held% 1 {display:{Name:"%newname%"}}
cmd edit anvil 441 exit
 

madhon

MadCommands Dev
#4
Instead of managing permissions in your code, you can use /setgperm XYZ cmd.run.adanvil to give group XYZ the permission or /setgperm XYZ -cmd.run.adanvil to block group XYZ from using the command (if it is allowed by default)