Correct nullPointerException on help #21
This commit is contained in:
parent
9a24739113
commit
9cec8b3ff1
@ -115,8 +115,16 @@ public class Help implements Commande {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
StringBuilder txt= new StringBuilder();
|
StringBuilder txt= new StringBuilder();
|
||||||
|
|
||||||
|
boolean isAdmin;
|
||||||
|
if(event.isFromType(ChannelType.PRIVATE))
|
||||||
|
isAdmin = event.getJDA().getGuilds().get(0).getMember(event.getAuthor()).hasPermission(Permission.ADMINISTRATOR);
|
||||||
|
else
|
||||||
|
isAdmin = event.getMember().hasPermission(Permission.ADMINISTRATOR);
|
||||||
|
|
||||||
|
|
||||||
for (Map.Entry<String, Commande> e : MainBot.commandes.entrySet()) {
|
for (Map.Entry<String, Commande> e : MainBot.commandes.entrySet()) {
|
||||||
if(!e.getValue().isAdminCmd() || event.getMember().hasPermission(Permission.ADMINISTRATOR))
|
if(!e.getValue().isAdminCmd() || isAdmin)
|
||||||
txt.append("\n- ").append(e.getKey());
|
txt.append("\n- ").append(e.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +139,7 @@ public class Help implements Commande {
|
|||||||
|
|
||||||
|
|
||||||
String role;
|
String role;
|
||||||
if(event.getMember().hasPermission(Permission.ADMINISTRATOR))
|
if(isAdmin)
|
||||||
role = "Admin";
|
role = "Admin";
|
||||||
else
|
else
|
||||||
role = "Non Admin";
|
role = "Non Admin";
|
||||||
|
Loading…
Reference in New Issue
Block a user