Skip to content

Conversation

@darbyjack
Copy link
Member

@darbyjack darbyjack commented Apr 2, 2020

This is a remake of my original PR (#2645) that I did a good on when rebasing.

To make things easier, I have created a new PR with everything up-to-date.

Contents: Implements the ability to reset a Kit's Cooldown for a player.

Example:
image

Closes #163

@darbyjack darbyjack requested a review from Ichbinjoe April 2, 2020 02:57
@darbyjack darbyjack self-assigned this Apr 2, 2020
@pop4959 pop4959 added the type: enhancement Features and feature requests. label Apr 2, 2020
@darbyjack darbyjack requested a review from pop4959 April 2, 2020 04:55

@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
if (user.isAuthorized("essentials.kit.reset")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essentials already checks the permissions according to the name passed in the constructor - so this would require users to have both essentials.kitreset and essentials.kit.reset in order to trigger this action, which seems a little strange.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus if they don't have permission... nothing happens. This is bad UX.


@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
if (user.isAuthorized("essentials.kit.reset")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus if they don't have permission... nothing happens. This is bad UX.

final User userTo = getPlayer(server, user, args, 0);
final Kit kit = new Kit(args[1], ess);
kit.resetTime(userTo);
user.sendMessage(tl("kitReset", userTo.getDisplayName(), kit.getName()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what if user == userTo? They will be sent two messages... does this happen in other parts of EssX?

Copy link

@Destitution-SC Destitution-SC May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is sadly, but you can just add:
if(userTo != user) {
userTo.sendMessage(tl("kitResetPlayer", kit.getName()));
}

@Override
protected List<String> getTabCompleteOptions(final Server server, final User user, final String commandLabel, final String[] args) {
List<String> options = new ArrayList<>();
if (args.length == 1 && user.isAuthorized("essentials.kit.reset")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment about this perm, but in general doing two perm look ups feels clowny.

@Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
if (user.isAuthorized("essentials.kit.reset")) {
final User userTo = getPlayer(server, user, args, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EssentialsLoopCommand exists for the sole purpose of commands that act on other targets - you should be extending this class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, the player parameter should come before the kit in the command's syntax - this is consistent with other EssentialsX loop commands.

kitNotFound=\u00a74That kit does not exist.
kitOnce=\u00a74You can''t use that kit again.
kitReceive=\u00a76Received kit\u00a7c {0}\u00a76.
kitReset=\u00a76Resetting\u00a7c {0}''s\u00a76 cooldown for kit\u00a7c {1}\u00a76.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the username should be highlighted, not the 's.

@mdcfe mdcfe added the status: waiting on author Pull requests that require changes from the author in order to merge. label May 11, 2020
Copy link
Member

@pop4959 pop4959 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to address other requested changes

@darbyjack darbyjack force-pushed the reset-kit-cooldowns branch from b89ba35 to df3e108 Compare May 27, 2020 14:14
@pop4959
Copy link
Member

pop4959 commented Jul 24, 2020

Closing due to author inactivity. Can re-open if there are signs of life, especially addressing any concerns that have been mentioned.

@pop4959 pop4959 closed this Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting on author Pull requests that require changes from the author in order to merge. type: enhancement Features and feature requests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reset kit cooldown

6 participants