mails.sk

Created by Aroup

Other available versions. Ordered by newest to oldest versions:

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:
   help-message: &cUse command &a&l/send (name) (title) (message) &cto send a message!

   message-length: 60 #letter
   message-too-long: &cThe message is too long!

   cooldown-time: 300 #seconds
   cooldown-message: &cPlease wait before sending a new message

#---------------------------------------------------------------------------------------------------------------
function mainmenu(p: player):
   set {page.mail.%uuid of {_p}%} to 0
   set {_gui} to a new chest inventory with 3 row with name "Your Mail"
   set slot 1 of {_gui} to skull of ("MyNameIsHelga" parsed as offline player) named "&c&l404" with lore "&7Your mail is empty!" and "&7Start a message conversation by using:" and "&a&l/send (name) (title) (message)&7."
   set slot 26 of {_gui} to Barrier named "&6&lNext Page" with lore "&7the next page is &cempty&7."
   set {_loop} to 1
   set {_checkleftmsg} to 0
   loop {mails.%uuid of {_p}%::*}:
      if {_loop} is not 26:
         set slot {_loop} of {_gui} to loop-value
         add 1 to {_loop}
      else:
         add 1 to {_checkleftmsg}
         set slot 26 of {_gui} to arrow named "&6&lNext Page" with lore "&6%{_checkleftmsg}% &7messages left"
   set {_loop} to 0
   loop {gifts.mail.%uuid of {_p}%::*}:
      add 1 to {_loop}
   set slot 0 of {_gui} to chest named "&a&lGIFTS" with lore "" and "&7Click to claim" and "&7You got &6%{_loop}%&7 gifts"
   open {_gui} to {_p}
function nextpage(p: player):
   set {_gui} to a new chest inventory with 3 row with name "Your Mail"
   set slot 26 of {_gui} to Barrier named "&6&lNext Page" with lore "&7the next page is &cempty&7."
   set {_loop} to 1
   set {_checkloop} to 0
   set {_checkleftmsg} to 0
   loop {mails.%uuid of {_p}%::*}:
      if {_loop} is not 26:
         if {_checkloop} is less than {page.mail.%uuid of {_p}%}:
            add 1 to {_checkloop} 
         else:
            set slot {_loop} of {_gui} to loop-value
            add 1 to {_loop}
      else:
         add 1 to {_checkleftmsg}
         set slot 26 of {_gui} to arrow named "&6&lNext Page" with lore "&6%{_checkleftmsg}% &7messages left"
   set slot 0 of {_gui} to arrow named "&6&lPrevious Page"
   open {_gui} to {_p}
function giftsmenu(p: player):
   set {page.gifts.%uuid of {_p}%} to 0
   set {_gui} to a new chest inventory with 3 row with name "Your Gifts"
   set slot 0 of {_gui} to Trapped Chest named "&6&lBack"
   set slot 26 of {_gui} to Barrier named "&6&lNext Page" with lore "&7the next page is &cempty&7."
   set {_loop} to 1
   set {_checkleftmsg} to 0
   loop {gifts.mail.%uuid of {_p}%::*}:
      if {_loop} is not 26:
         set slot {_loop} of {_gui} to loop-value
         add 1 to {_loop}
      else:
         add 1 to {_checkleftmsg}
         set slot 26 of {_gui} to arrow named "&6&lNext Page" with lore "&6%{_checkleftmsg}% &7gifts left"
   open {_gui} to {_p}
function giftnextpage(p: player):
   set {_gui} to a new chest inventory with 3 row with name "Your Gifts"
   set slot 26 of {_gui} to Barrier named "&6&lNext Page" with lore "&7the next page is &cempty&7."
   set {_loop} to 1
   set {_checkloop} to 0
   set {_checkleftmsg} to 0
   loop {gifts.mail.%uuid of {_p}%::*}:
      if {_loop} is not 26:
         if {_checkloop} is less than {page.gifts.%uuid of {_p}%}:
            add 1 to {_checkloop} 
         else:
            set slot {_loop} of {_gui} to loop-value
            add 1 to {_loop}
      else:
         add 1 to {_checkleftmsg}
         set slot 26 of {_gui} to arrow named "&6&lNext Page" with lore "&6%{_checkleftmsg}% &7gifts left"
   set slot 0 of {_gui} to arrow named "&6&lPrevious Page"
   open {_gui} to {_p}
function sendmenu(p: player, o: offline player, t: text, r: text):
   set {_gui} to a new chest inventory with 3 row with name "Send Mail" 
   set slots (all integers between 0 and 26) of {_gui} to dark gray glass pane named "&7"
   set slots (all integers between 6 and 8) of {_gui} to red glass pane named "&a&L&oGIFT" with lore "&7Put a gift in the empty spot"
   set slots (all integers between 24 and 26) of {_gui} to red glass pane named "&a&L&oGIFT" with lore "&7Put a gift in the empty spot"
   set slots (all integers between 15 and 17) of {_gui} to red glass pane named "&a&L&oGIFT" with lore "&7Put a gift in the empty spot"
   set slot 16 of {_gui} to air
   set slot 10 of {_gui} to skull of ("%{_o}%" parsed as offline player) named "&aMail to &6%{_o}%" 
   set slot 11 of {_gui} to paper named "&aInformation about the message" with lore "&7" and "&7This message to &a%{_o}%" and "&7The title of the message &6%{_t}%" and "&7" and "&7The message:" and "&e&l%{_r}%"
   set slot 13 of {_gui} to Firework Rocket named "&aSend" with lore "&7Once you send the message" and "&7you &ccan not undo &7it, so make" and "&7sure everything is right" and "&7before you send!"
   open {_gui} to {_p}
   set {last.sendto.%{_p}%} to {_o}
   set {last.title.%{_p}%} to {_t}
   set {last.text.%{_p}%} to {_r}
on join:
   if {cooldown.mail.%player%} is set:
      wait {@cooldown-time} second
      clear {cooldown.mail.%player%}
on inventory click:
   if name of event-inventory is "Your Mail":
      if event-inventory isn't player's inventory:
         name of event-item is not "&c&l404" or "&a&lGIFTS" or "&6&lPrevious Page" or "&6&lNext Page":
            remove event-item from {mails.%player's uuid%::*} 
            mainmenu(player)
            stop
      cancel event
      if clicked slot is 0:
         if slot 0 of player's current inventory is chest:
            giftsmenu(player)
         if slot 0 of player's current inventory is arrow:
            remove 26 from {page.mail.%player's uuid%}
            if {page.mail.%player's uuid%} is less than 26:
               mainmenu(player)
               stop
            nextpage(player)
      if clicked slot is 26:
         if slot 26 of player's current inventory is arrow:
            add 26 to {page.mail.%player's uuid%}
            nextpage(player)
   if name of event-inventory is "Your Gifts":
      if event-inventory isn't player's inventory:
         name of event-item is not "&6&lNext Page" or "&6&lBack" or "&6&lPrevious Page":
            add event-item to player's inventory
            remove event-item from {gifts.mail.%player's uuid%::*}
            giftsmenu(player)
            stop
      cancel event
      if clicked slot is 0:
         if slot 0 of player's current inventory is Trapped Chest:
            mainmenu(player)
         if slot 0 of player's current inventory is arrow:
            remove 26 from {page.gifts.%player's uuid%}
            if {page.gifts.%player's uuid%} is less than 26:
               giftnextpage(player)
               stop
            nextpage(player)
      if clicked slot is 26:
         if slot 26 of player's current inventory is arrow:
            add 26 to {page.gifts.%player's uuid%}
            giftnextpage(player)
   if name of player's current inventory is "Send Mail":
      if clicked slot is not 16:
         if event-inventory is not player's inventory:
            cancel event
      if clicked slot is 13:
         add skull of ("%{last.sendto.%player%}%" parsed as offline player) named "&aMessage form &6%player%" with lore "&a%now%" and "" and "&7&oTittle: &a&l%{last.title.%player%}%" and "&e%{last.text.%player%}%" to {mails.%uuid of {last.sendto.%player%}%::*} 
         if slot 16 of player's current inventory is not air:
            add slot 16 of player's current inventory with lore "gift from %player% to %{last.sendto.%player%}%" to {gifts.mail.%uuid of {last.sendto.%player%}%::*} 
         close player's inventory
         send "&aSuccessfully sent a message to &6%{last.sendto.%player%}% &aat %now%"
         delete {last.sendto.%player%} 
         delete {last.title.%player%} 
         delete {last.text.%player%} 
command /mail [<text>]:
   trigger:
      mainmenu(player)
command /block [<offline player>] [<text>]:
   trigger:
      loop {blocklist.%player%::*}:
         if loop-value is arg-1:
            remove arg-1 from {blocklist.%player%::*}
            send "&aSuccessfully, You have unblocked %arg-1%"
            stop
      add arg-1 to {blocklist.%player%::*}
      send "&aSuccessfully, You have blocked %arg-1%"
command /send [<offline player>] [<text>] [<text>]:
   trigger:
      if arg-1 is player:
         send "&cYou can not send message to yourself."
         stop
      loop {blocklist.%arg-1%::*}:
         if loop-value is arg-1:
            send "&cYou are blocked from %arg-1%"
            stop
      if {cooldown.mail.%player%} is set:
         send "{@cooldown-message}"
         stop
      if arg-1 is set:
         if arg-2 is set:
            if arg-3 is set:
               set {_length} to length of the string argument-2
               if {_length} <= {@message-length}:
                  sendmenu(player, argument 1, argument 2, argument 3)
                  set {cooldown.mail.%player%} to true
                  wait {@cooldown-time} second
                  clear {cooldown.mail.%player%}
               else:
                  send "{@message-too-long}"
            else:
               send "{@help-message}"
         else:
            send "{@help-message}"
      else:
         send "{@help-message}"