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

Jobs integration cleanup & fixes #414

Merged
merged 7 commits into from
Jul 30, 2023

Conversation

tal5
Copy link
Member

@tal5 tal5 commented Jul 30, 2023

Changes

  • Moved all of the Warnings to JobsBridge, just to have them all in once place for easier bumping in the future.
  • Changed the Warning's field names to match their IDs, just a standard used in core/Denizen.
  • Updated jobs (tag base) to the ListTag convertor constructor.
  • Cleaned up the jobs_job constructor tag's handling to use JobsJobTag as the param type instead of handling it manually.
  • Moved JobsCommand registration to be with the rest of the registrations instead of at the bottom.
  • Updated JobsCommand to modern command handling (with legacy handling for out-of-order args).
  • Minor meta correction in JobsCommand, new line after dot.
  • Added tab-complete for the job names in JobsCommand.
  • JobsCommand now uses the methods on PlayerManager instead of the ones on JobsPlayer, as these are the ones that handle saving the changes and all (reported on Discord).
  • Updated JobsCommand to the modern switch syntax.
  • Gave all jobs event a general update (modern determinations, switch syntax, meta, and using tryArgObject for JobsJobTag matching).
  • Corrected the UUID in JobsJobTag's meta example (it was meant to be mcmonkey's UUID, but the wrong mcmonkey was used. This is a very big problem).
  • Implemented advancedMatches and added Matchable meta to JobsJobTag.
  • Improved JobsJobTag#valueOf's handling of the player UUID input - It now parses it as just a UUID instead of a PlayerTag, mainly as stuff like PlayerName,job shouldn't be allowed.
    Also changed the checking of whether the player is valid to trying to get it from jobs + a null check, instead of PlayerTag#isValid.
  • Improved the handling for the job name input to now give a proper error and return null instead of throwing an NPE for invalid names.
  • Added a starts with prefix -> true into JobsJobTag#matches, before doing a valueOf != null.
  • Changed JobsJobTag#get/setOwner to use a UUID instead of a PlayerTag.
  • Did a bit of method re-ordering in JobsJobTag, to have less relevant methods such as get/setPrefix at the bottom and stuff like register higher up.
  • Marked ElementTags as plain-text where relevant.
  • Changed JobsJobTag.xp/max_xp (tag) to use early return.
  • Changed JobsJobTag.level to use a ternary operator.
  • Updated JobsJobTag.xp (mechanism) to modern mech registration.
  • Marked JobsJobTag.tagProcessor as final.
  • Implemented JobsJobTag#debuggable.
  • Updated JobsPlayerProperties to a modern JobsPlayerExtensions extension class.
  • Replaced places that got a jobs player by name with getting it by UUID.
  • Removed the registerPropertyTagHandlers call in JobsJobTag#register, as it doesn't look like it has any properties?
  • Removed the weird contains("@") -> null check in JobsJobTag#valueOf, which seems like it was a mistake or something? don't see a reason to have that, but correct me if I'm wrong.
  • Changed JobsJobTag#identify to use the new JobsJobTag#identify(prefix, separator) method.

Additions

  • jobsSingleLineDescription deprecation warning for JobsJobTag.description, as it was deprecated but didn't have a proper warning.
  • JobsJobTag#identify(String prefix, String separator) - used by identify and debuggable to avoid duplicate logic.


// <--[ObjectType]
// @name JobsJobTag
// @prefix job
// @base ElementTag
// @format
// The identity format for jobs is the player UUID (optional), followed by the job name
// For example: job@05f57b6e-77ba-4546-b214-b58dacc30356,job_name
// For example: job@460e96b9-7a0e-416d-b2c3-4508164b8b1b,job_name
Copy link
Member

Choose a reason for hiding this comment

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

lol

@mcmonkey4eva mcmonkey4eva merged commit 2fc7df4 into DenizenScript:master Jul 30, 2023
1 check passed
@tal5 tal5 deleted the Jobs_Integration_Cleanup_Fix branch October 11, 2023 19:54
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.

None yet

2 participants