Commit Graph

500 Commits

Author SHA1 Message Date
Aikar b88b664dc2 (DEPLOYED ACF) Updated JavaDocs 2019-02-02 11:20:59 -05:00
Aikar c5ca1ac731 Fix issues with Paper Async Tab Completion
Works in 1.12, but 1.13 has problems at paper level, I will fix there.
2019-02-02 11:20:30 -05:00
Aikar 3fa9fdca65 add acf-example to project, switch to paper 2019-02-02 11:20:30 -05:00
Zollerboy1 77d091956b Complete German translation (#184)
I added missing German translations and improved some older ones.
2019-01-19 12:11:02 -05:00
MrMicky bf6788c072 Add French translation (#176) 2019-01-18 22:07:34 -05:00
Aikar 10f3202d51 (DEPLOYED ACF) Updated JavaDocs 2018-12-21 06:54:31 -05:00
simpleauthority aa6fa281cc Add unregister method for JDA (#174)
This PR is to allow users to unregister commands from the `JDACommandManager`

Currently slightly flawed, needs research. When re-registering it spits out a load of messages like so:
```
SEVERE: [ACF] ACF Error: settings registered subcommand boss role for root command settings - but it is already defined in settings
Sep 20, 2018 3:58:31 AM com.algorithmjunkie.freelance.gachapon.acf.JDACommandManager log
SEVERE: [ACF] 2 subcommands of the same prefix may not be spread over 2 different classes. Ignoring this.
```

Not sure if this is just for me, or if it's for all.
2018-10-23 11:00:11 -04:00
Aikar 01d1496c18 (DEPLOYED ACF) Updated JavaDocs 2018-09-09 20:59:53 -04:00
Aikar 71d0416f10 CommandIssuer should be IssuerOnly context
Likely fixes #170
2018-09-09 20:59:00 -04:00
Aikar 1d778b986f (DEPLOYED ACF) Updated JavaDocs 2018-09-01 20:29:30 -04:00
Diego Arias 82aaf9b701 Register SubClasses before Command register() (#169)
This is so the SubCommands from the SubClasses get added to the SubCommand map before calling **addChild()**
2018-09-01 20:27:55 -04:00
MrPowerGamerBR 9568e654e9 Fix typo (#164) 2018-08-27 14:06:15 -04:00
Gabik21MC 370e1047d2 Fixes #165 (#166)
This seems kind of wrong to me. Somone calling RegisteredCommand#getHelpText out of context will run into the same issue.
2018-08-27 14:05:57 -04:00
Aikar 5858c1ecec (DEPLOYED ACF) Updated JavaDocs 2018-08-19 10:27:57 -04:00
Aikar 6c7ccbd6da Register CommandIssuer context 2018-08-19 10:27:26 -04:00
Niklas Eicker 0aa4cfd457 Improve logging concerning command replacements (#161)
The code is now checking for placeholders, that are not replaced. This would also warn the dev if he completely forgets to register a replacement. 
The downside of this is, that any %.* kind of pattern, that is NOT supposed to be a replacement will cause an error message. But since I couldn't come up for a reason to include % in any of the Annotation values other than a replacement, I decided this is much easier than checking all "old" commands when a replacement is registered.
Alternatively, I could collect all these unreplaced replacements and check against the collection when a new one is registered. This would not warn a dev that forgot to register the replacement, but on the other hand still allows the use of %. Please tell me what you think.

resolves #160
2018-08-06 15:52:31 -04:00
Aikar a51333112e (DEPLOYED ACF) Updated JavaDocs 2018-08-03 14:18:09 -04:00
Mark Vainomaa 7742dc3238 Deny permissions if command is issued by a webhook (#156) 2018-08-03 13:57:20 -04:00
Mark Vainomaa 65ff5a5500 Replace Guava Iterables (#158)
Goes under #120

After this, only MultiMaps remain.
2018-08-03 09:57:38 -04:00
Aikar 8fda944311 (DEPLOYED ACF) Updated JavaDocs 2018-07-25 01:44:47 -04:00
simpleauthority 7a2e547766 Make Users optional arguments (#139)
This PR allows `User`s to be optional command arguments similar to how the annotation operates on Bukkit's `Player`.
2018-07-24 21:42:54 -04:00
Gabik21MC e181a2fabe fix compilation of example plugin (#154) 2018-07-24 17:41:08 -04:00
Osip Fatkullin 3c979a9ef2 Drop trivial Guava usages (#142)
#120, #127
2018-07-19 19:43:17 -04:00
willies952002 786ebe831f Sanitize Bukkit Command Label Before Passing On (#149)
Fixes #146 

This might not be the 100% perfect method for fixing this, but as it stands, it's the least amount of diff
 needed to fix said issue.
2018-07-04 01:27:01 -04:00
Aikar 422238b477 remove mvn build since travis does that 2018-06-22 20:48:59 -04:00
Aikar 7afa948e6f add Travis 2018-06-22 20:37:11 -04:00
Aikar d68d19b172 (DEPLOYED ACF) Updated JavaDocs 2018-06-18 22:01:47 -04:00
Aikar 9aac7d7809 Enable ability to disable logging of uncaught exceptions
You must pass your own exception handler in order to do this.

Implementors need to be sure to log if its not a desired throw or
otherwise you will have silent command failures.
2018-06-18 21:31:46 -04:00
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