Devex_EXPV1.sk

Created by ShyDoge

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.

#  ____                        _____            _                                      _
# |  _ \  _____   _______  __ | ____|_ ____   _(_)_ __ ___  _ __  _ __ ___   ___ _ __ | |_
# | | | |/ _ \ \ / / _ \ \/ / |  _| | '_ \ \ / / | '__/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __|
# | |_| |  __/\ V /  __/>  <  | |___| | | \ V /| | | | (_) | | | | | | | | |  __/ | | | |_
# |____/ \___| \_/ \___/_/\_\ |_____|_| |_|\_/ |_|_|  \___/|_| |_|_| |_| |_|\___|_| |_|\__|
#


variables:
  {Queue} = 0
options:

  # The Prefix for all messages.
  prefix: "&6&lDevex"
  # The Message Color.
  color: "&f"
  # The time (In Ticks) before Devex cancels the current item.
  time-packet-cancel: 100
  # The time (In Ticks) before Devex cancels all items in queue.
  time-all-cancel: 500
  # The maximum amount of items allowed in the queue.
  maximum-item-queue: 500
  # The permission required to run Devex.
  devex-permission: "op"

command /devex [<text>] [<text>]:
  permission: {@devex-permission}
  trigger:
    if arg-1 is not set:
      send "%{@prefix}%%{@color}% An error occured while attempting to execute this command (Error: No Argument)"
    else if arg-1 is "help":
      send "%{@prefix}%%{@color}% Sending you a list of commands."
      send ""
      send "%{@prefix}%%{@color}% help - Sends you a list of commands" # DONE
      send "%{@prefix}%%{@color}% console - activates console mode" # ALMOST
      send "%{@prefix}%%{@color}% execute - executes a queue of commands (Paired with ""addex"")" # DONE
      send "%{@prefix}%%{@color}% addex - adds a command to the execution list" # DONE
      send "%{@prefix}%%{@color}% info - sends you server information"
      send "%{@prefix}%%{@color}% plrinfo - sends you player information"
      send "%{@prefix}%%{@color}% executeconsole - executes a queue of commands as the console." # DONE
      send "%{@prefix}%%{@color}% clear - clears the execution queue." # DONE
    else if arg-1 is "console":
      if {ConsoleMode::%player%} is true:
        set {ConsoleMode::%player%} to false
        send "%{@prefix}%%{@color}% You are no longer in console mode."
      else:
        set {ConsoleMode::%player%} to true
        send "%{@prefix}%%{@color}% You are now in console mode."
        log "%player%'s console mode was set to %{ConsoleMode::%player%}%" to "Devex/Console/%{SID}%"
    else if arg-1 is "execute":
      if {Queue} >= {@maximum-item-queue}:
        send "%{@prefix}%%{@color}% An error occured while attempting to execute this command (Error: Over Item Limit)"
      else if {Queue} is 0:
        send "%{@prefix}%%{@color}% An error occured while attempting to execute this command (Error: Nothing to execute)"
      else:
        set {CurrentItem} to 1
        loop {Queue} times:
          if {TimeOut} is true:
            send "%{@prefix}%%{@color}% Cancelled the queue! Timeout exceeded."
            exit 1 loop
          else:
            execute player command {Queue::%{CurrentItem}%}
            send "Devex Executed a command on behalf of %player% for %player% (SID: %{SID}%)"
            send "%{@prefix}%%{@color}% Executed command %{CurrentItem}%/%{Queue}% as %player%"
            add 1 to {CurrentItem}
            delete {Queue::%{CurrentItem}%}
        log "Devex executed %{Queue}% sequence commands as %player% for %player% (SID: %{SID}%)" to "Devex/Executions/%player%/%{SID}%"
        set {Queue} to 0
    else if arg-1 is "executeconsole":
      if {Queue} >= {@maximum-item-queue}:
        send "%{@prefix}%%{@color}% An error occured while attempting to execute this command (Error: Over Item Limit)"
      else if {Queue} is 0:
        send "%{@prefix}%%{@color}% An error occured while attempting to execute this command (Error: Nothing to execute)"
      else:
        set {CurrentItem} to 1
        loop {Queue} times:
          if {TimeOut} is true:
            send "%{@prefix}%%{@color}% Cancelled the queue! Timeout exceeded."
            exit 1 loop
          else:
            execute console command {Queue::%{CurrentItem}%}
            send "Devex Executed a command on behalf of CONSOLE for %player% (SID: %{SID}%)"
            send "%{@prefix}%%{@color}% Executed command %{CurrentItem}%/%{Queue}% as CONSOLE"
            add 1 to {CurrentItem}
            delete {Queue::%{CurrentItem}%}
        log "Devex executed %{Queue}% sequence commands as CONSOLE for %player% (SID: %{SID}%)" to "Devex/Executions/%player%/%{SID}%"
        set {Queue} to 0
    else if arg-1 is "addex":
      if arg-2 is not set:
        send "%{@prefix}%%{@color}% An error occured while attempting to execute this command (Error: Argument Not Found)"
      else:
        add 1 to {Queue}
        set {Queue::%{Queue}%} to arg-2
        send "%{@prefix}%%{@color}% Added an item to the queue!"
        log "Devex added ""%arg-2%"" to the Devex Queue for %player%." to "Devex/Queue/%{SID}%"
    else if arg-1 is "clear":
      set {CurrentItem} to 1
      loop {Queue} times:
        delete {Queue::%{CurrentItem}%}
        send "%{@prefix}%%{@color}% Deleted Queue Item ##%{CurrentItem}%"
      log "Devex cleared the Devex Queue for %player%." to "Devex/Queue/%{SID}%"
      set {Queue} to 0
    else if arg-1 is "clear":
      set {CurrentItem} to 1
      loop {Queue} times:
        delete {Queue::%{CurrentItem}%}
        send "%{@prefix}%%{@color}% Deleted Queue Item ##%{CurrentItem}%"
      set {Queue} to 0
    else if arg-1 is "info":
      send "&6Loading Server Information..."
      send "Devex Version: 1.0.0"
      send "Experimental Type: Divex"
      send "Uptime: %{Uptime}%"
      send "Session ID: %{SID}%"
      send ""
      send "Valid Requesting Code: %{SID}%"
    else if arg-1 is "plrinfo":
      if arg-2 is set:
        loop all players:
          if arg-2 is loop-value:
            set {FoundPlayer} to true
            set {RequestedPlayer} to loop-player
        if {FoundPlayer} is true:
          set {FoundPlayer} to false
          send "Found requested player"
          send "Loading Information..."
          set {RQPLRID} to {RequestedPlayer}'s uuid
          if {RequestedPlayer} has permission "op":
            set {RQPLROP} to true
          else:
            set {RQPLROP} to false
          wait 1 tick
          send "loaded information"
          send "&6%{RequestedPlayer}%"
          send "Username: %{RequestedPlayer}%"
          send "UUID: %{RQPLRID}%"
          send "Operator: %{RQPLROP}%"
          send ""
          send "Valid Requesting Code: %{SID}%"

every 1 second:
  add 1 to {Uptime}
on load:
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  send "Devexperimental 1.0.0 has loaded"
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  set {Uptime} to 0
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  send "Devexperimental is currently applying a new SID to your session."
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  set {SID} to random number between 99999 and 999999
  if {SID} is 99999:
    set {SID} to 100000
  set {CurrentItem} to 1
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  send "Devexperimental is currently wiping previous Sessions."
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  loop {Queue} times:
    delete {Queue::%{CurrentItem}%}
  set {Queue} to 0
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  send "Devexperimental has completed wiping Sessions."
  send "=-=-=-=-=-=-=-=-=-=-=-=-=-="
  log "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" to "Devex/Loadup/load.log"
  log "Session ID: %{SID}%" to "Devex/Loadup/load.log"