Commit Graph

472 Commits

Author SHA1 Message Date
Aikar 46edb06f9b Unwrap CommandExceptions thrown by Bukkit before passing to Exception handlers 2018-06-18 21:22:21 -04:00
Gabik21MC 9975c3c24e Forgot to implement method for sponge (#144) 2018-06-18 15:58:58 -04:00
Gabik21MC 7c75cdd48c Improvements (#143)
Improve help output for commands split over multiple base commands
Fix help last page detection
Fix missing argument on Player Context Resolve
Expose registered root commands
2018-06-18 15:15:03 -04:00
Osip Fatkullin 444212ade5 Add russian translation (#141) 2018-06-17 12:03:36 -04:00
Aikar 7495eab323 (DEPLOYED ACF) Updated JavaDocs 2018-06-12 22:33:38 -04:00
Aikar eb639427d2 Use collections instead of lists for static completions 2018-06-12 22:33:06 -04:00
Aikar 54d64e69a2 (DEPLOYED ACF) Updated JavaDocs 2018-06-12 22:24:09 -04:00
Aikar 59c45f12ce Add support for static command completions 2018-06-12 22:23:38 -04:00
Frank Kusmiruk 288a53e6c0 Update Spanish translations (#140) 2018-06-05 12:52:33 -04:00
Aikar 0a78bbad08 (DEPLOYED ACF) Updated JavaDocs 2018-06-03 15:51:20 -04:00
simpleauthority 3319ab78a2 [JDA] Fix User context resolution (#138)
When @ mentioning someone in Discord, if you manually click the user's name then the ID will be in the chat field as "<@!...>". However, one can _also_ mention a user like so "<@...>".

This PR handles both cases.
2018-06-03 15:47:21 -04:00
Aikar 0499f83e42 (DEPLOYED ACF) Updated JavaDocs 2018-06-03 12:59:35 -04:00
simpleauthority cbe1507b1c Repair context types, add Role context, add CrossGuild annotation (#137)
In a previous PR, some contexts were not changed from **IssuerOnly** to **IssuerAware**. This has been patched.

I've added a context to resolve a Role. It makes use of the next item I added.

The CrossGuild annotation is used to signify whether or not the context is to be interpreted from a guild perspective or a bot perspective (i.e. all guilds). This annotation could probably be better named.
2018-06-03 12:58:24 -04:00
Aikar f947ef6930 Add Save Actions plugin for auto reformat 2018-06-03 12:07:27 -04:00
Aikar b6b07456bb (DEPLOYED ACF) Updated JavaDocs 2018-06-03 00:33:49 -04:00
simpleauthority fbfb8decd0 Implement CommandPermissionResolver (#135)
This pull request is an initial attempt at implementing permission for commands for the JDA module.

It includes one added file, **JDACommandPermissionResolver** which implements CommandPermissionResolver.

I created a map to store the Discord permission offsets stored mapped by their kebab-cased name (i.e. "ADMINISTRATOR" becomes "administrator", "MANAGE_SERVER" becomes "manage-server".

The implementation of `hasPermission(JDACommandEvent, String)` is fairly simple:

- Get the issuer's Member object
- Check if it's null; if so, return false.
- Get the permission offset from the aforementioned map
- Check if it's null; if so, return false.
- Return whether or not the member has the permission.

---------------------------------------

This PR allows new commands to use the `@CommandPermission` annotation like so:
```java
@CommandAlias("test|t")
public class Command extends BaseCommand {
  @Subcommand("admin|a")
  @CommandPermission("manage-server")
  public void adminCommand(MessageReceivedEvent event) {
    //...
  }
}
```
2018-06-03 00:28:19 -04:00
simpleauthority 7478d030d0 Reimplement JDAMessageFormatter for Discord (#136)
Because Discord does not support coloring messages outside of embeddable fields, it is safe to use a simple message formatter than just returns the message itself.

As I was testing my previous PR, I noticed messages coming through with coloring symbols (e.g. `<c1></c1>`), and each only went up to `c3` maximum. Finally, I figured out these were colors that needed to be handled in each case.

To remove colored messages from Discord, the message formatter is passed three empty strings for each of `c1`, `c2`, and `c3` respectively.

Finally, the default formatter is set inside of `JDACommandManager` but can always be overridden by the user.
2018-06-02 10:36:57 -04:00
Aikar 27eb9fa733 More Documentation 2018-05-31 19:33:48 -04:00
Proximyst 0be34242db Updated JavaDocs from PR #116 2018-05-31 19:33:28 -04:00
Aikar 0b65989c7b (DEPLOYED ACF) Updated JavaDocs 2018-05-30 20:05:50 -04:00
Aikar 027662e14d update javadoc plugin 2018-05-30 20:05:23 -04:00
Gabik21MC 961009a77c Support old user names (#133)
Recently a player with a two letter account joined on my server and I noticed that the context resolver for the player interface does not work. This PR also fixes crazy names like these:
https://de.namemc.com/profile/%24.1
https://de.namemc.com/profile/u.1
2018-05-29 11:04:14 -04:00
Aikar f64be04e61 (DEPLOYED ACF) Updated JavaDocs 2018-05-27 12:44:46 -04:00
Aikar d57dbcefab Update Maven Plugins, hopefully will fix #129 2018-05-27 12:43:32 -04:00
Aikar ce73e21967 (DEPLOYED ACF) Updated JavaDocs 2018-05-27 12:13:06 -04:00
Aikar cbc01b8b41 Set Annotation Targets on all the annotations
Fixes Kotlin for Dependency
2018-05-27 12:11:26 -04:00
chickeneer 68cdf30878 (DEPLOYED ACF) Updated JavaDocs 2018-05-24 09:40:58 -05:00
chickeneer 88130a5574 Replace incorrect usage of MIN_VALUE with -MAX_VALUE
The javadocs for Float and Double specify this for the MIN_VALUE:
A constant holding the smallest positive nonzero value of type...

So the true minimum value must be calculated by the negative max value.
2018-05-24 09:38:26 -05:00
Aikar 0c2c7bb9d4 (DEPLOYED ACF) Updated JavaDocs 2018-04-20 11:43:05 -04:00
MiniDigger 6bd101ac30 leftover from #124 (#125) 2018-04-20 11:38:37 -04:00
MiniDigger 95fe4577be add a new annotation to hide commands from tabcompletion and help (#124)
* add a new annotation to hide commands from tabcompletion and help (implements #123)

* do the annotation lookup once
2018-04-20 11:28:22 -04:00
Aikar 2d45e03dae Replace use of Guava Table with my own table - Closes #121 2018-03-31 00:59:21 -04:00
chickeneer ac362d7aa6 Fix deprecation warning for UnknownHandler, should point to CatchUnknown 2018-03-30 16:46:48 -05:00
Daniel Ennis b1d65ab6aa Update LICENSE 2018-03-29 22:42:56 -04:00
Daniel Ennis 7cf88a0837 Rename LICENSE.md to LICENSE 2018-03-29 22:33:09 -04:00
Aikar ffdf597811 Add contributing doc 2018-03-29 22:32:38 -04:00
Aikar 8007b933dd Disable setDefaultCompletion as not done yet 2018-03-29 22:01:51 -04:00
DarkPaladin 87613fb59b WIP: Set default completion contexts (#101)
* Register default completion

* Remove auto add @ because it is possible to have completion ids without them

Aikar note - Going to make this private in next commit until feature is done
2018-03-29 21:59:38 -04:00
Aikar 7286b75466 move help output structure to formatter so it can be overridden 2018-03-29 21:55:44 -04:00
Daniel Ennis 246ac1f6a8 Rename LICENSE to LICENSE.md 2018-03-29 14:44:43 -04:00
Aikar 7b1e4f085d (DEPLOYED ACF) Updated JavaDocs 2018-03-26 01:50:43 -04:00
Aikar d1054d52ef Revert all Method Handle stuff.
According to https://gist.github.com/raphw/881e1745996f9d314ab0 its not faster in dynamic, unknown situations.
2018-03-26 01:48:14 -04:00
Aikar 8147d3ce61 (DEPLOYED ACF) Updated JavaDocs 2018-03-25 02:55:35 -04:00
chickeneer e423b877ff Disable method handles to use reflection due to WrongMethodTypeException 2018-03-24 20:55:00 -05:00
JanTuck 31743b0326 Fix methodHandle error (#119)
Fix exception thrown by incorrect function
2018-03-24 19:47:38 -05:00
Aikar 785040707a (DEPLOYED ACF) Updated JavaDocs 2018-03-24 15:58:20 -04:00
Aikar d61c937dce fix dupe command prefix 2018-03-24 15:57:48 -04:00
Mariell 44c942101b Add Norwegian bokmål & nynorsk (#111)
* Add bokmål & nynorsk

* Fix colour
2018-03-24 11:02:19 -04:00
Mariell 11dcee8b39 Use MethodHandles for invocation (#112)
* Use method handles for invocation

* Fix parsing, add more safety and add for named MessageChannels, and format

* Add methodhandle support to BaseCommand
2018-03-24 10:59:43 -04:00
MiniDigger a44e48ef9a fix #117 (#118) 2018-03-24 10:55:38 -04:00