scrolls.sk

Created by Unknown

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

options:
  #Feel free to change the features below.
  sound: ENTITY_ENDER_EYE_DEATH
  prefix: &d&lSCROLLS &5&l>&r
  scroll-use: &5&oYou used a scroll.
  scroll-receive: &5&oYou have received a scroll.
  scroll-receive-multiple: &5&oYou have received {amount} scrolls.
  no-perms: &cYou are not allowed to use that!
  insufficient-args: &cYou gave me invalid arguments!
  scroll-name: &5&l&oScroll: &r{coloured name}
  scroll-exists: &cA scroll by that name already exists!
  notify-give: true
  remove-on-use: true
  header-footer: &5-----&d&lScrolls&r&5-----
  
  
  #DO NOT CHANGE THE FEATURES BELOW!
  version: 0.3


command /scrolls [<text>] [<text>] [<text>] [<text>] [<boolean = false>]:
  description: &5The admin command for &dScrolls {@version}&e.
  aliases: scroll
  usage: &d/scrolls &5add <thing>&d|&5list&d|&5remove <number>
  trigger:
  
    #----------HELP PAGE MANAGEMENT----------
    if arg-1 is not set:
      send "{@header-footer}"
      send "  &d/scrolls add (name) (command) (true|false [op])&5Creates a scroll."
      send "  &d/scrolls list &5Lists all scrolls."
      send "  &d/scrolls remove (number) &5Removes scroll &d(number)&5."
      send "  &d/scrolls reload &5Reloads the skript."
      send "  &d/scrolls give (player) (amount) (number) &5Give &d(player)&5 scroll &d(number)&5."
      send "{@header-footer}"
      stop
    if arg-1 is not "give" or "add" or "create" or "list" or "view" or "remove" or "delete" or "reload":
      send "{@header-footer}"
      send "  &d/scrolls add (name) (command) (true|false [op])&5Creates a scroll."
      send "  &d/scrolls list &5Lists all scrolls."
      send "  &d/scrolls remove (number) &5Removes scroll &d(number)&e."
      send "  &d/scrolls reload &5Reloads the skript."
      send "  &d/scrolls give (player) (amount) (number) &5Give &d(player) (amount) &5of scroll &d(number)&5."
      send "{@header-footer}"
      stop
    #----------HELP PAGE MANAGEMENT----------

    #----------GIVING SCROLLS----------
    if player has permission "scrolls.give":
      if arg-1 is "give":
        if arg-2 is not set:
          send "{@prefix} {@insufficient-args}"
          stop
        if arg-3 is not set:
          send "{@prefix} {@insufficient-args}"
          stop
        if arg-4 is not set:
          send "{@prefix} {@insufficient-args}"
          stop
        set {_c} to 0
        loop {scrolls::*}:
          add 1 to {_c}
          if {_c} is arg-4 parsed as number:
            set {_scroll::*} to loop-value split at ";;;"
            set {_target} to arg-2 parsed as player
            set {_a} to arg-3 parsed as number
            loop {_a} times:
              set {_parsevar} to "{@scroll-name}"
              replace all "{coloured name}" in {_parsevar} with coloured {_scroll::1}
              replace all "{colored name}" in {_parsevar} with coloured {_scroll::1}
              set {_paper} to paper named "%{_parsevar}%"
              enchant {_paper} with unbreaking 0
              drop {_paper} at block above location of {_target}
            if {@notify-give} is true:
              if {_a} is 1:
                send "{@prefix} {@scroll-receive}" to {_target}
              else:
                set {_text} to "{@scroll-receive-multiple}"
                replace all "{amount}" in {_text} with "%{_a}%"
                send "{@prefix} %{_text}%"
    #----------CREATING SCROLLS----------
    if player has permission "scrolls.add":
      if arg-1 is "add" or "create":
        if arg-2 is not set:
          send "{@prefix} {@insufficient-args}"
          stop
        
        loop {scrolls::*}:
          if loop-value starts with arg-2:
            set {_error} to "{@prefix} &cA scroll with that name already exists!"
            replace all "{player}" in {_error} with "%player%"
            send "%{_error}%"
            stop
        set {_arg3} to arg-3
        replace every "{s}" with " " in {_arg3}
        set {_ap} to "%arg-2%;;;%{_arg3}%;;;%arg-4%"
        add {_ap} to {scrolls::*}
        send "{@prefix} &eCreated scroll '&r%coloured arg-2%&e' for you."
    else:
      send "{@prefix} {@no-perms}"
    #----------CREATING SCROLLS----------

    #----------LISTING SCROLLS----------
    if player has permissions "scrolls.list":
      if arg-1 is "list" or "view":
        if {scrolls::*} is set:
          send "{@header-footer}"
          set {_c} to 0
          loop {scrolls::*}:
            set {_scroll::*} to loop-value split at ";;;"
            add 1 to {_c}
            send "&e%{_c}%. &e'&r%coloured {_scroll::1}%&e' Command: &5%coloured {_scroll::2}% &eExecuted as OP: %{_scroll::3}%"
          send "{@header-footer}"
        else:
          send "{@prefix} &cYou haven't created any scrolls yet!"
    else:
      send "{@prefix} {@no-perms}"
    #----------LISTING SCROLLS----------
    
    #----------REMOVING SCROLLS----------
    if player has permission "scrolls.remove":
      if arg-1 is "remove" or "delete":
        if arg-2 parsed as number is not set:
          send "{@prefix} {@insufficient-args}"
          stop
        set {_c} to 0
        loop {scrolls::*}:
          add 1 to {_c}
          if {_c} is arg-2 parsed as number:
            remove loop-value from {scrolls::*}
            send "{@prefix} &5Successfully removed scroll &d%arg 2%&5."
    #----------REMOVING SCROLLS----------
     
    #----------RELOADING-----------
    if player has permission "scrolls.reload":
      if arg-1 is "reload":
        send "{@prefix} &dReloading..."
        reload script script
        send "{@prefix} &dReloaded!"

on right click:

  loop {scrolls::*}:

    set {_scroll::*} to loop-value split at ";;;"
    set {parsevar} to "{@scroll-name}"
    replace all "{coloured name}" in {parsevar} with coloured {_scroll::1}
    replace all "{colored name}" in {parsevar} with coloured {_scroll::1}
    replace all "{player}" in {_scroll::1} with "%player%"
    replace all "{player}" in {_scroll::2} with "%player%"
    replace all "{player}" in {_scroll::3} with "%player%"

    if tool = paper:
      name of tool = "%{parsevar}%"
      play sound "{@sound}" with volume 10 and pitch 5 at player
      send "{@prefix} {@scroll-use}"
      
      if "{@remove-on-use}" is "true":
        wait a tick
        remove 1 of tool from tool
      if {_scroll::3} is not true:
        make event-entity execute "%{_scroll::2}%"
      else:
        op event-entity
        make event-entity execute "%{_scroll::2}%"
        deop event-entity