/
Role.java
178 lines (160 loc) · 7.18 KB
/
Role.java
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
* Copyright 2015-2016 Austin Keener & Michael Ritter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dv8tion.jda.core.entities;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.Permission;
import java.awt.*;
import java.util.Collection;
import java.util.List;
public interface Role extends ISnowflake, IMentionable, Comparable<Role>
{
/**
* The hierarchical position of this {@link net.dv8tion.jda.core.entities.Role Role} in the {@link net.dv8tion.jda.core.entities.Guild Guild} hierarchy.<br>
* (higher value means higher role).<br>
* The @everyone {@link net.dv8tion.jda.core.entities.Role Role} always return -1.
*
* @return
* The position of this {@link net.dv8tion.jda.core.entities.Role Role} as integer.
*/
int getPosition();
/**
* The actual position of the {@link net.dv8tion.jda.core.entities.Role Role} as stored and given by Discord.
* Role positions are actually based on a pairing of the creation time (as stored in the snowflake id)
* and the position. If 2 or more roles share the same position then they are sorted based on their creation date.
* The more recent a role was created, the lower it is in the heirarchy. This is handled by {@link #getPosition()}
* and it is most likely the method you want. If, for some reason, you want the actual position of the
* Role then this method will give you that value.
*
* @return
* The true, Discord stored, position of the {@link net.dv8tion.jda.core.entities.Role Role}.
*/
int getPositionRaw();
/**
* The Name of the {@link net.dv8tion.jda.core.entities.Role Role}.
*
* @return
* Never-null String containing the name of this {@link net.dv8tion.jda.core.entities.Role Role}.
*/
String getName();
/**
* Is this {@link net.dv8tion.jda.core.entities.Role Role} managed?<br>
* (Via plugins like Twitch).
*
* @return
* If this {@link net.dv8tion.jda.core.entities.Role Role} is managed.
*/
boolean isManaged();
/**
* Is this {@link net.dv8tion.jda.core.entities.Role Role} hoisted?<br>
* Members in a hoisted role are displayed in their own grouping on the user-list
*
* @return
* If this {@link net.dv8tion.jda.core.entities.Role Role} is hoisted.
*/
boolean isHoisted();
/**
* Returns wheter or not this Role is mentionable
*
* @return
* True if Role is mentionable.
*/
boolean isMentionable();
/**
* The <code>int</code> representation of the literal permissions that this {@link net.dv8tion.jda.core.entities.Role Role} has.<br>
* <b>NOTE:</b> these do not necessarily represent the permissions this role will have in a {@link net.dv8tion.jda.core.entities.Channel Channel}.
*
* @return
* Never-negative int containing offset permissions of this role.
*/
int getPermissionsRaw();
/**
* A list of the literal {@link net.dv8tion.jda.core.Permission Permissions} that this {@link net.dv8tion.jda.core.entities.Role Role} has.<br>
* <b>NOTE:</b> these do not necessarily represent the permissions this role will have in a {@link net.dv8tion.jda.core.entities.Channel Channel}.
*
* @return
* Possibly-empty list containing the literal permissions of this role.
*/
List<Permission> getPermissions();
List<Permission> getPermissions(Channel channel);
/**
* The color this {@link net.dv8tion.jda.core.entities.Role Role} is displayed in.
*
* @return
* Color value of Role-color
*/
Color getColor();
/**
* Checks if this {@link net.dv8tion.jda.core.entities.Role Role} has the provided {@link net.dv8tion.jda.core.Permission Permissions}.<br>
* This does not check the Channel-specific override {@link net.dv8tion.jda.core.Permission Permissions}.
*
* @param permissions
* The {@link net.dv8tion.jda.core.Permission Permissions} to check for
* @return
* If the given {@link net.dv8tion.jda.core.Permission Permissions} are available to this {@link net.dv8tion.jda.core.entities.Role Role}
*/
boolean hasPermission(Permission... permissions);
/**
* Checks if this {@link net.dv8tion.jda.core.entities.Role Role} has the {@link net.dv8tion.jda.core.Permission Permissions}
* in the provided Collection<Permission><br>
* This does not check the Channel-specific override {@link net.dv8tion.jda.core.Permission Permissions}.
*
* @param permissions
* The {@link net.dv8tion.jda.core.Permission Permissions} to check for
* @return
* If the given {@link net.dv8tion.jda.core.Permission Permissions} are available to this {@link net.dv8tion.jda.core.entities.Role Role}
*/
boolean hasPermission(Collection<Permission> permissions);
/**
* Checks if this {@link net.dv8tion.jda.core.entities.Role Role} has the provided {@link net.dv8tion.jda.core.Permission Permissions}
* in the specified {@link net.dv8tion.jda.core.entities.Channel Channel}.
*
* @param permissions
* The {@link net.dv8tion.jda.core.Permission Permissions} to check for
* @return
* If the given {@link net.dv8tion.jda.core.Permission Permissions} are available to this {@link net.dv8tion.jda.core.entities.Role Role} in this Channel
*/
boolean hasPermission(Channel chanel, Permission... permissions);
/**
* Checks if this {@link net.dv8tion.jda.core.entities.Role Role} has the {@link net.dv8tion.jda.core.Permission Permissions}
* in the provided Collection<Permission> in the specified {@link net.dv8tion.jda.core.entities.Channel Channel}.
*
* @param permissions
* The {@link net.dv8tion.jda.core.Permission Permissions} to check for
* @return
* If the given {@link net.dv8tion.jda.core.Permission Permissions} are available to this {@link net.dv8tion.jda.core.entities.Role Role} in this Channel
*/
boolean hasPermission(Channel channel, Collection<Permission> permissions);
/**
* Returns the {@link net.dv8tion.jda.core.entities.Guild Guild} this Role exists in
* @return
* the Guild containing this Role
*/
Guild getGuild();
// /**
// * Returns the {@link net.dv8tion.jda.managers.RoleManager RoleManager} for this Role.
// * In the RoleManager, you can modify all its values.
// *
// * @return
// * The RoleManager of this Role
// */
// RoleManager getManager();
/**
* Returns the {@link net.dv8tion.jda.core.JDA JDA} instance of this Role
* @return
* the corresponding JDA instance
*/
JDA getJDA();
}