Skip to content

Commit

Permalink
Removing permission stuff [bloats jar and is normally handled separat…
Browse files Browse the repository at this point in the history
…ely]
  • Loading branch information
comportment committed Aug 3, 2017
1 parent 5820a2b commit b0c262f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 75 deletions.
48 changes: 23 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,36 @@

<groupId>me.diax.comportment</groupId>
<artifactId>JDA-Command</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>

<organization>
<name>Diax Software</name>
<url>http://diax.me</url>
</organization>

<developers>
<developer>
<name>Comportment</name>
<id>Comportment</id>
<url>http://www.diax.me</url>
<organization>Diax</organization>
<id>comportment</id>
<name>Ryan Arrowsmith</name>
<timezone>Europe/London</timezone>
<url>http://comp.diax.me</url>
<email>comportment@protonmail.com</email>
<organization>Diax Software</organization>
<organizationUrl>http://diax.me</organizationUrl>
<roles>
<role>Developer</role>
<role>development</role>
<role>documentation</role>
<role>discord-bot</role>
<role>irc-bot</role>
</roles>
<email>comportment@diax.me</email>
<timezone>0</timezone>
<properties>
<discord>comportment#9489</discord>
<twitter>@ComportmentUK</twitter>
</properties>
</developer>
</developers>


<licenses>
<license>
<name>Apache License, Version 2.0</name>
Expand All @@ -36,11 +50,6 @@
<description>JDA-Command command framework for JDA.</description>
<url>https://github.com/Comportment/JDA-Command</url>

<organization>
<url>https://github.com/Comportment</url>
<name>Comportment</name>
</organization>

<repositories>
<repository>
<id>jcenter</id>
Expand All @@ -62,22 +71,11 @@
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
</configuration>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.1.1_215</version>
<version>3.2.0_241</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,4 @@
* @since 1.0.0
*/
CommandAttribute[] attributes() default {};

/**
* This represents an Array of {@link CommandPermission} that the {@link Command} which is annotated with this {@link CommandDescription} has.
*
* @return An array of {@link CommandPermission}s, could be <code>null</code>.
* @since 1.0.8
*/
CommandPermission[] permissions() default {};
}
15 changes: 2 additions & 13 deletions src/main/java/me/diax/comportment/jdacommand/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,8 @@ public Command findCommand(String trigger) {
* @throws ExecutionException If the command could not be executed.
* @since 1.0.0
*/
public void execute(Command command, Message message, String args) throws ExecutionException, CommandPermissionException {
public void execute(Command command, Message message, String args) throws ExecutionException {
CommandDescription cd = command.getDescription();
if(message.getGuild() != null){
boolean havePermission = false;
if(!message.getMember().equals(message.getGuild().getOwner()) && !message.getMember().hasPermission(Permission.ADMINISTRATOR)){
for (CommandPermission commandPermission : cd.permissions()) {
if(message.getMember().hasPermission(commandPermission.permissions())) havePermission = true;
}
}else{
havePermission = true;
}
if(!havePermission) throw new CommandPermissionException();
}
if (cd == null) return;
//if (cd.args() > args.split("\\s+").length) return;
try {
Expand All @@ -177,7 +166,7 @@ public void execute(Command command, Message message, String args) throws Execut
* @see #execute(Command, Message, String)
* @since 1.0.1
*/
public void findAndExecute(String trigger, Message message, String args) throws ExecutionException, CommandPermissionException {
public void findAndExecute(String trigger, Message message, String args) throws ExecutionException {
Command command = this.findCommand(trigger);
if (command == null || command.getDescription() == null) return;
this.execute(command, message, args);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public class JDACommandInfo {
*
* @since 1.0.1
*/
public static final String VERSION = "1.0.8";
public static final String VERSION = "1.1.0";
}

0 comments on commit b0c262f

Please sign in to comment.