Solved Resourcepack deny Skript-mirror

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

MeHow

Active Member
Feb 6, 2017
140
13
18
Lithuania
Hello, I get problem with resourcepack deny.Skript doesn't have support for this so I am using skript mirror.
What is the problem for this?
code_language.skript:
on script load:
    import "org.bukkit.event.player.PlayerResourcePackStatusEvent"
   
on "org.bukkit.event.player.PlayerResourcePackStatusEvent":
    if event.getStatus() is PlayerResourcePackStatusEvent.Status.DECLINED:
        make event.getPlayer() execute command "/mineb leave"

Problem: cant understand


Thanks for help if event.getStatus() is PlayerResourcePackStatusEvent.Status.DECLINED:
 
You can 't use it directly, you have to import the inner enum first (inner classes are delimited by the dollar sign):
code_language.skript:
on script load:

  # You don't have to import the event
  import "org.bukkit.event.player.PlayerResourcePackStatusEvent$Status" as {ResourcePackStatus}
Then to reference the enum constant you'd do:
code_language.skript:
if event.getStatus() is {ResourcePackStatus}.DECLINED!: #You need put ! at the end for any kind of field

This could also be done with MundoSK in the following way:
code_language.skript:
packet info aliases for play_client_resource_pack_status:

  result of %packet% = "ResourcePackStatus" penum 0 of %packet%

on packet event play_client_resource_pack_status:

  if result of event-packet is "DECLINED":
    execute player command "/mineb leave"
 
Status
Not open for further replies.