Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get exact char instead of last for /pay modifier; Added pay-modifier-enabled config line #5496

Closed
wants to merge 7 commits into from
Closed

Conversation

AjMaacc
Copy link

@AjMaacc AjMaacc commented Aug 26, 2023

Information

This PR closes #5495

Details

Proposed feature:

This feature allows the ability to enable/disable usage of /pay modifiers such as 1k, 1m, 1b ,1t
Along with that when the command is checking for those modifiers, it checks the first char after the number instead of the last.

Environments tested:

OS: Linux

Java version: 17

  • Most recent Paper version (1.20.1, git-Paper-145)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

Demonstration:

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.

Fundamentally this doesn't change anything, the same manipulation can be done with the first character as the last character. A proper fix is checking for exactly the modifier, and if anything else is entered reject the input.

@pop4959
Copy link
Member

pop4959 commented Aug 29, 2023

Also worth considering if pay modifiers should even be enabled by default.

@AjMaacc
Copy link
Author

AjMaacc commented Aug 29, 2023

Fundamentally this doesn't change anything, the same manipulation can be done with the first character as the last character. A proper fix is checking for exactly the modifier, and if anything else is entered reject the input.

I agree with only looking for the exact char. Would it be better to just ignore the modifier if it is not exact?

Also worth considering if pay modifiers should even be enabled by default.

I'll have it default false

pay-modifier-enabled is default false
@AjMaacc AjMaacc requested a review from pop4959 August 29, 2023 02:21
@AjMaacc AjMaacc changed the title Get first char instead of last for /pay modifier; Added pay-modifier-enabled config line Get exact char instead of last for /pay modifier; Added pay-modifier-enabled config line Aug 29, 2023
@pop4959
Copy link
Member

pop4959 commented Aug 29, 2023

I agree with only looking for the exact char. Would it be better to just ignore the modifier if it is not exact?

I think it's safer to throw an exception there, and not assume the modifier (or no modifier) that the user intended to send if it's invalid. This shouldn't happen often, and showing an error will allow the user to make corrections and send the correct amount.

@AjMaacc

This comment was marked as spam.

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.

Couple minor things, overall looks fine to me

@AjMaacc
Copy link
Author

AjMaacc commented Sep 3, 2023

Resolved Issues

@AjMaacc AjMaacc requested a review from pop4959 September 3, 2023 05:19
@AjMaacc

This comment was marked as spam.

@AjMaacc AjMaacc closed this by deleting the head repository Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toggle /pay modifiers in config
4 participants