- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register








The script repo is an archive of historical scripts. For modern scripts, or to post your own, please use the Scripts forum section.





Staff Pick: Denizen mail system


By BlackCoyote
Created: 2014/11/28 22:50:36 UTC-08:00 (10 years and 26 days ago)
Edited: 2014/12/28 16:42:57 UTC-08:00 (9 years and 361 days ago)
Likes: 0

Staff pick as of: 2014/12/02 21:48:04 UTC-08:00 (10 years and 22 days ago)
Denizen Version: 0.9.6
Script Version: 1.0
Description:

A denizen powered ripoff of the essentials mail system.

put in server, reload, and good to go.

usage:
/mail help


Download script | View raw script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
14700

"lumimails":
  type: world
  debug: false
  events:
    on mail command:
    - inject locally 'path:lumimailer'
    on mails command:
    - inject locally 'path:lumimailer'
    on lumimail command:
    - inject locally 'path:lumimailer'
    on lumimails command:
    - inject locally 'path:lumimailer'
  lumimailer:
    - if <context.args.get[1]> == send || <context.args.get[1]> == new || <context.args.get[1]> == create {
      - if <player.has_flag[<player.name>ismuted]> {
        - narrate "<&c>You can't do this when muted."
        - determine fulfilled
        - queue clear
        }
      - if <context.args.get[2]> == null {
        - narrate "<&c>Please specify a player or a group!"
        - narrate "<&c>/lumimail send [player/g:group] [message]"
        - determine fulfilled
        - queue clear
        }
      - if '<context.args.get[2].starts_with[g:]>' {
        - if <player.has_permission[lumimails.groupmail]> {
          - define grouptype '<context.args.get[2].replace[g:]>'
          - foreach <server.list_players> {
            - if <%value%.in_group[%grouptype%]> {
              - if <%value%.is_online> run tellmail as:<%value%>
              - if <%value%f.flag[lumimails].as_list> !contains '<&e><player.name>-<&6> <context.args.get[3].to[500].replace[li@].replace[|].with[ ]>' flag %value% 'LUMIMAILS:->:<&e><player.name>-<&6> <context.args.get[3].to[500].replace[li@].replace[|].with[ ]>'
              }
            }
          - narrate "<&6>You sent your mail to all players in the group <&e>%grouptype%"
          } else {
          - narrate "<&c>You do not have the permission to do this."
          }
        } else if <context.args.get[2]> == 'all' {
        - if <player.has_permission[lumimails.groupmail]> {
          - foreach <server.list_players> {
            - if <%value%.is_online> run tellmail as:<%value%>
            - if <%value%f.flag[lumimails].as_list> !contains '<&e><player.name>-<&6> <context.args.get[3].to[500].replace[li@].replace[|].with[ ]>' flag %value% 'LUMIMAILS:->:<&e><player.name>-<&6> <context.args.get[3].to[500].replace[li@].replace[|].with[ ]>'
            }
          - narrate "<&6>You sent your mail to all players that have been on this server before."
          } else {
          - narrate "<&c>You do not have the permission to do this."
          }
        } else {
        - define player <context.args.get[2]>
        - if <server.list_players> contains <p@%player%> {
          - if <p@<%player%.is_online>> run tellmail as:p@%player%
          - flag p@%player% 'LUMIMAILS:->:<&e><player.name>-<&6> <context.args.get[3].to[500].replace[li@].replace[|].with[ ]>'
          - narrate "<&6>You sent your mail to <&e>%player%."
          } else {
          - narrate "<&e>%player%<&c> has not been on this server before."
          }
        }
      } else if <context.args.get[1]> == read || <context.args.get[1]> == view {
        - if <player.flag[LUMIMAILS].as_list.size> !> 0 || <player.flag[LUMIMAILS]> == null {
          - narrate "<&6>You have no mails in your inbox."
          } else {
          - define mailnumber <context.args.get[2]||1>
          - if %mailnumber% == null {
            - define currentmail <player.flag[LUMIMAILS].as_list.get[1]>
            } else if %mailnumber% != 0 && '<m:%mailnumber%>' == 0.0 {
            - narrate "<&c>Please specify which mail you want to read with a number!"
            - narrate "<&c>/lumimail read [<&ns>]"
            - determine fulfilled
            - queue clear
            } else if %mailnumber% !> <player.flag[LUMIMAILS].as_list.size> {
            - define currentmail <player.flag[LUMIMAILS].as_list.get[%mailnumber%]>
            } else {
            - narrate "<&6>You don't have that many mails in your inbox!"
            - determine fulfilled
            - queue clear
            }
          - narrate '<&6>%currentmail%'
          - run scoreboardmailviewer def:%mailnumber%|<el@val[%currentmail%].strip_color>
          }
      } else if <context.args.get[1]> == list || <context.args.get[1]> == inbox {
        - if <player.flag[LUMIMAILS].as_list.size> > 8 {
          - define lumimaillistcounter 1
          - narrate "<&6>You have <player.flag[LUMIMAILS].as_list.size> mails in your inbox."
          - run scoreboardmaillist def:<player.flag[LUMIMAILS].as_list.size>
          - foreach <player.flag[LUMIMAILS].as_list.get[1].to[9]> {
            - narrate "<&6>%lumimaillistcounter%<&co> <el@val[%value%].substring[1,35]>..."
            - define lumimaillistcounter <el@val[<m:%lumimaillistcounter%+1>].as_int>
            }
          - narrate "<&6>And <player.flag[LUMIMAILS].as_list.size.sub[9].as_int> more."
          } else if <player.flag[LUMIMAILS]> == null {
          - narrate "<&6>You have no mails in your inbox."
          } else {
          - define lumimaillistcounter 1
          - narrate "<&6>You have <player.flag[LUMIMAILS].as_list.size> mails in your inbox."
          - foreach <player.flag[LUMIMAILS].as_list> {
            - narrate "<&6>%lumimaillistcounter%<&co> <el@val[%value%].substring[1,35]>..."
            - define lumimaillistcounter <el@val[<m:%lumimaillistcounter%+1>].as_int>
            }
          - run scoreboardmaillist def:<player.flag[LUMIMAILS].as_list.size>
          }
      } else if <context.args.get[1]> == clear || <context.args.get[1]> == delete || <context.args.get[1]> == inbox {
        - define mailnumber <context.args.get[2]>
        - if %mailnumber% == null {
          - flag LUMIMAILS:!
          - narrate "<&6>You cleared your inbox."
          - run removescoreboardwithcheck def:<player.name>maillist as:<player>
          } else if %mailnumber% != 0 && '<m:%mailnumber%>' == 0.0 {
          - flag LUMIMAILS:!
          - narrate "<&6>You cleared your inbox."
          - run removescoreboardwithcheck def:<player.name>maillist as:<player>
          } else {
          - define deletingmail '<player.flag[LUMIMAILS].as_list.get[%mailnumber%]>'
          - narrate %deletingmail%
          - flag 'LUMIMAILS:<-:%deletingmail%'
          - narrate "<&6>You removed mail %mailnumber% from your inbox."
          - run removescoreboardwithcheck def:<player.name>mail%mailnumber%
          - run scoreboardmaillist def:<player.flag[LUMIMAILS].as_list.size>
          }
      } else {
      - narrate "<&6>/mail send [player] [message]"
      - narrate "<&6>/mail list"
      - narrate "<&6>/mail read [<&ns>]"
      - narrate "<&6>/mail clear (<&ns>)"
    - determine fulfilled
"lumimailsupdater":
  type: world
  debug: false
  events:
    on player logs in:
    - run tellmail as:<player> delay:5s
"tellmail":
  type: task
  debug: false
  script:
    - wait 2
    - ^narrate "<&6>================================================="
    - ^narrate "<&e>You have <t[<player.has_flag[lumimails]>]:<player.flag[lumimails].as_list.size>||no> mail<t[<player.flag[lumimails].as_list.size.is[MORE].than[1]>]:s||> in your inbox!"
    - narrate "<&6>================================================="
  











View History