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

Update ChunkTag, AreaContainmentObject and ColorTag tag param usage. #2364

Merged
merged 5 commits into from
Aug 28, 2022
Merged

Update ChunkTag, AreaContainmentObject and ColorTag tag param usage. #2364

merged 5 commits into from
Aug 28, 2022

Conversation

BreadcrumbIsTaken
Copy link
Contributor

@BreadcrumbIsTaken BreadcrumbIsTaken commented Aug 28, 2022

Update ChunkTag, AreaContainmentObject, and ColorTag tag param usage, as per request from issue #2355.

Tags updated:

  • <AreaObject.contains[]>
  • <AreaObject.blocks_flagged[]>
  • <AreaObject.is_within[]>
  • <AreaObject.with_world[]>
  • <ChunkTag.add[]>
  • <ChunkTag.sub[]>
  • <ChunkTag.blocks_flagged[]>
  • <ColorTag.mix[]>

Now they use the new ✨ fancy ✨ automated attribute processing.

I think I did this right. When I tested it it worked the same so :)

ive never used java before in my life 😳

return null;
}
LocationTag loc = attribute.paramAsType(LocationTag.class);
processor.registerTag(ElementTag.class, LocationTag.class, "contains", (attribute, area, loc) -> {
if (loc == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Can remove these null checks, as the new argument handling makes sure the param is present and valid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh awesome! I'll push the changes right now :)

New tag processing makes sure the parameter is valid as pointed out by @tal5!
if (mixed_with != null) {
return new ColorTag(object.mixWith(mixed_with));
tagProcessor.registerTag(ColorTag.class, ColorTag.class, "mix", (attribute, object, mixWith) -> { // Temporarily non-static because the input could be 'random'
if (mixWith != null) {
Copy link
Member

Choose a reason for hiding this comment

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

Can remove null check and the error here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it! 🙌 Pushing the change now

@BreadcrumbIsTaken BreadcrumbIsTaken changed the title Update ChunkTag and AreaContainmentObject tag param usage. Update ChunkTag, AreaContainmentObject and ColorTag tag param usage. Aug 28, 2022
@mcmonkey4eva mcmonkey4eva merged commit 16e64a5 into DenizenScript:dev Aug 28, 2022
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.

3 participants