Commit Graph

57 Commits

Author SHA1 Message Date
Josh Roy
f6cb9ff470
Improve command codestyle (#3337)
Co-authored-by: MD <1917406+md678685@users.noreply.github.com>

Fixes #3579 (async `/skull` command)
Fixes #3336 (improve codestyle of commands)
Partially addresses #3339 (`/spawn` and `/setspawn` are now hidden from tabcomplete)
Closes #3087 (`/paytoggle` is now a loop command)
2020-08-11 19:09:22 +01:00
uf0h
f9de6763d3
Use playerNeverOnServer message where appropriate (#3489)
### Use `playerNeverOnServer` message where it should be used:

### 309e1c470d 
`playerNeverOnServer=\u00a74Player\u00a7c {0} \u00a74was never on this server.` is currently used in the **Commandmail** class at [Line 61](https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/commands/Commandmail.java#L61), [Line 116](https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/commands/Commandmail.java#L116) and [Line 129](https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/commands/Commandmail.java#L129) however is **not called** as PlayerNotFoundException is thrown by `#getPlayer` breaking current execution (below).
```
Commandmail#run() throws Exception {
...
    User u = getPlayer(server, args[1], true, true); // throws PlayerNotFoundException
        if (u == null) {
            throw new Exception(tl("playerNeverOnServer", args[1]));
    } 
...
}
```

Before changes:
![bm](https://user-images.githubusercontent.com/24858857/87236993-6b679180-c3e8-11ea-83a7-002194f5c467.png)
After changes:
![mailafter](https://user-images.githubusercontent.com/24858857/87237060-3576dd00-c3e9-11ea-8020-d5a80a958ca0.png)

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

**Commandseen** currently throws the default PlayerNotFoundException `playerNotFound` message for players that have not logged on to the server where it would be more appropriate to use the `playerNeverOnServer` message.

```
Commandseen#run throws Exception {
...
    AsyncRunnable#run() {
        User userFromBukkit = ess.getUserMap().getUserFromBukkit(args[0]);  <-- ***
        try {
            if (userFromBukkit != null) {                             <--- ***
                showUserSeen(userFromBukkit);
            } else {
                showUserSeen(getPlayer(server, sender, args, 0)); <--- ***
            }
        } catch (Exception e) {
            ess.showError(sender, e, commandLabel);
        }
    }
    private void showUserSeen(User user) throws Exception {
        if (user == null) {                                    <--- ***
            throw new PlayerNotFoundException();
        }
        showSeenMessage(server, sender, user, showBan, showIp, showLocation);
    }
...
}
```

**`<-- ***`:**
`usersFromBukkit` null check is performed before `#showUserSeen` so there is no need for another null check.
`EssentialsCommand#getPlayer` throws **NotEnoughArguementsException** or **PlayerNotFoundException** after [arg checks](https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java#L88) and [player checks](https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/com/earth2me/essentials/commands/EssentialsCommand.java#L103). https://github.com/EssentialsX/Essentials/pull/3489#issuecomment-657138524

Before changes:
![sb](https://user-images.githubusercontent.com/24858857/87237038-e9c43380-c3e8-11ea-8294-8f91e8b6f25d.png)
After changes:
![seenafter](https://user-images.githubusercontent.com/24858857/87237067-53444200-c3e9-11ea-92c5-1784b4dcd739.png)

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

### 725128e
Catch more specfic exception `PlayerNotFoundException`.

Before changes:
![banbefore](https://user-images.githubusercontent.com/24858857/87237021-c1d4d000-c3e8-11ea-99e4-eb97b5a5ba6d.png)
After changes:
![afterunban](https://user-images.githubusercontent.com/24858857/87237081-8d154880-c3e9-11ea-9d35-a25b8c105969.png)
2020-08-04 15:30:05 +01:00
Josh Roy
23f0f98af3
Cleanup code (#3067)
Co-Authored-By: md678685 <1917406+md678685@users.noreply.github.com>

Basically cleans up a bunch of warnings that are easily suppressed.
2020-04-25 13:08:57 +01:00
md678685
f5c21d1089 Merge branch '2.x' into final_mute_reason_issue#385 2019-03-15 11:52:50 +00:00
Max Lee
95ac4a4853 Extra permissions for /seen and /whois information (#735)
* Implemented separate permissions for seen extras

* Add an extra permission to the whois command too.
IPs are sensitive information that should only be accessible to an as small as possible amount of people
2018-03-20 21:50:42 -07:00
CreedTheFreak
822315a279 Updated the former pull request to include the specified formatting changes, and small edits to the hasMuteReason and Commandmute dealing with the muteReason. I also included the ability to see the mute reason from the seenOffline method which is identical to the seenOnline code. 2017-12-26 16:09:46 -08:00
delbertina
ff37ef3bc5 Added reason stuff to msg command and deleted reference line in seen command. Oops! 2017-12-24 00:03:36 -06:00
delbertina
3d33bbc33d Added 8 new messages for "...Reason" versions of mute messages and implemented em. 2017-12-20 00:35:51 -06:00
delbertina
e3ee9cb4c7 Fixed logic error in hasMuteReason and errors being thrown from seen and whois. 2017-12-18 20:37:34 -06:00
delbertina
034ffbd0bc Added space when adding reason to string. 2017-12-17 00:16:06 -06:00
delbertina
849b329213 Changed if else blocks to ternary operators. Not sure if way to avoid weird empty string usage. 2017-12-02 20:35:44 -06:00
delbertina
43cbab37f0 Changed muteFormat to muteReason.
Removed space at beginning of muteReason.
2017-11-26 01:32:22 -06:00
CreedTheFreak
f10a766442 fixed some wonky commit thing that happened, thus the following modifications are brought to you by Delbertina. 2017-09-03 19:49:57 -07:00
flcmc
1562a8f3ca Implement tab completion for seen and whois. (#1440) 2017-08-12 14:42:57 +01:00
vemacs
5968a6bc27 Run seen fallback code asynchronously, and clean it up 2016-03-01 08:36:41 -07:00
Ali Moghnieh
2e903acbaa Add support for using /seen with UUID. 2016-01-02 10:46:42 +00:00
vemacs
ad93d15197 Only utilize usercache lookup for seen command 2015-12-01 17:32:53 -07:00
vemacs
73ac6488ce Run IntelliJ IDEA inspections 2015-06-03 14:11:56 -06:00
drtshock
dde0b20775 Reformat 2015-04-14 23:06:16 -05:00
KHobbits
ffea359661 rework /seen to be a little stricter on argument matching. 2014-08-18 21:00:03 +01:00
KHobbits
3f1c996959 Use quicker ban lookup to reduce /seen lag. 2014-08-14 01:50:31 +01:00
KHobbits
c829a32555 Clean up tempban messages to be a little clearer. 2014-07-14 21:23:56 +01:00
KHobbits
0c416c8366 Remove ban check from /ess cleanup, no longer required.
Fix ban upgrade script.
2014-07-12 19:13:23 +01:00
FearFree
51be2131f7 Update to new ban method. 2014-07-12 17:40:14 +01:00
KHobbits
b40aa43872 Delay uuidconversion for 10s and show warning.
UUID conversion should now better handle offline conversion.
2014-04-26 23:50:12 +01:00
KHobbits
b6c0871daa Format /seen account history list, optimize map loading. 2014-04-18 05:57:47 +01:00
KHobbits
b080187808 Add previous account tracking to /seen 2014-04-18 04:48:34 +01:00
KHobbits
9e9409da1e Essentials UUID conversion. 2014-04-13 21:40:15 +01:00
KHobbits
36e580474f Converted emulated player class calls to use base class. 2014-04-13 01:01:49 +01:00
FearFree
5724c0c8df Future Java versions may not support _ as identifier. 2014-03-22 16:08:11 +11:00
KHobbits
6f85761f7f Extract CommandSender to CommandSource, this should prevent Ess user object leaks. 2013-10-16 21:05:33 +01:00
KHobbits
59b501b2b1 Clean Imports 2013-10-11 03:44:41 +01:00
KHobbits
c1e39c7007 Show if a IP is ip-banned on /seen <ip> 2013-07-19 02:25:50 +01:00
KHobbits
1abacf00df More cleanup 2013-07-07 13:02:40 +01:00
KHobbits
52ba151b81 Clean up exception types. 2013-06-22 16:33:22 +01:00
KHobbits
09f67c9723 Split util classes. 2013-06-08 22:31:19 +01:00
KHobbits
88c5b64694 GeoIP already has a perm, doesn't need hidden behind essentials.seen.extra as well. 2013-05-26 16:52:25 +01:00
KHobbits
66911bb0a9 Improve hidden player matching.
Replace essentials.teleport.hidden with essentials.vanish.interact
Fix perm checks in tpall and tpaall
2013-05-23 22:59:09 +01:00
GunfighterJ
e3183e66df Show Geolocation in /seen
Refactor argument for clarity
2013-04-01 16:00:09 -05:00
KHobbits
964bdc6d30 [Feature] Allow IP lookup in /seen command.
[Permission] essentials.seen.ipsearch - allows /seen <ip address>
2013-02-24 03:55:20 +00:00
KHobbits
0e7d64f9e7 Fix a couple of cosmetic errors in /seen 2013-02-17 01:18:50 +00:00
snowleo
3f31dc179b Fix /seen command 2013-02-08 22:26:21 +01:00
KHobbits
c97763c3c8 Make seen status's only show when true. 2012-12-22 03:36:56 +00:00
KHobbits
adb75b69c2 Allow certain commands while in jail, but only if the user normally has access to that command. 2012-12-20 22:53:52 +00:00
KHobbits
ce78125028 Add a little bit of extra information to /seen, this will show when user is online. 2012-12-20 20:37:04 +00:00
KHobbits
055603b09e Fix null locations in /seen 2012-04-14 15:57:47 +01:00
KHobbits
e52996609a Update seen to show better data for vanished users:
New Perm: essentials.seen.extra - Shows some extra information for staff
2012-04-04 01:20:57 +01:00
KHobbits
a3a3f81e11 Better hide vanished players. 2012-04-03 16:12:49 +01:00
KHobbits
7bcec32134 Cleaning up displaynames 2012-03-21 23:54:57 +00:00
KHobbits
2da802d4b7 New permission: essentials.seen.banreason
With this permission players can see why a user was banned, in /seen.
2012-03-12 15:00:44 +00:00