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

support color to filled map item #2504

Merged
merged 6 commits into from
Jul 14, 2023
Merged

support color to filled map item #2504

merged 6 commits into from
Jul 14, 2023

Conversation

pobab
Copy link
Contributor

@pobab pobab commented Jul 11, 2023

No description provided.

@CLAassistant
Copy link

CLAassistant commented Jul 11, 2023

CLA assistant check
All committers have signed the CLA.

@@ -19,15 +20,16 @@ public static boolean describes(ObjectTag item) {
return false;
}
Material mat = ((ItemTag) item).getBukkitMaterial();
// Leather armor and potions
// Leather armor, potions and filled map
Copy link
Member

Choose a reason for hiding this comment

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

missing comma: potions,

@@ -66,7 +68,7 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
// @mechanism ItemTag.color
// @group properties
// @description
// Returns the color of the leather armor item or potion item.
// Returns the color of the leather armor item, potion item or filled map item.
Copy link
Member

Choose a reason for hiding this comment

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

missing comma

@mcmonkey4eva
Copy link
Member

mcmonkey4eva commented Jul 12, 2023

This was not properly tested on real map items - getPropertyString will error as soon as you interact with an item.

Testing thoroughly is mandatory prior to PRs.

if (mat == Material.FILLED_MAP) {
MapMeta mapMeta = (MapMeta) item.getItemMeta();
if (!mapMeta.hasColor()) {
return BukkitColorExtensions.fromColor(Color.WHITE).getObjectAttribute(attribute.fulfill(1));
Copy link
Member

Choose a reason for hiding this comment

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

Is returning WHITE here correct? Seems like it should probably be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tbh... i dont know which default color of filled_map 😅, that why i put white color. i'll change it asap, thanks for remind me to using null

if (!mapMeta.hasColor()) {
return null;
}
return BukkitColorExtensions.fromColor((mapMeta.getColor())).getObjectAttribute(attribute.fulfill(1));
Copy link
Member

Choose a reason for hiding this comment

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

minor format - too many parens here

if (!mapMeta.hasColor()) {
return null;
}
return BukkitColorExtensions.fromColor(mapMeta.getColor()).getObjectAttribute(attribute.fulfill((1)));
Copy link
Member

Choose a reason for hiding this comment

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

... you fixed one and unfixed the other???

@@ -79,6 +81,13 @@ public ObjectTag getObjectAttribute(Attribute attribute) {
}
return BukkitColorExtensions.fromColor(pm.getColor()).getObjectAttribute(attribute.fulfill((1)));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i thought it was correct because i follow on this line.... but, i realize and didn't get how getObjectAttribute work. should i change this line too?

Copy link
Member

Choose a reason for hiding this comment

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

this whole file is weird and needs cleaning up, but not really required for your PR to fix pre-existing issues (it'd be really handy if you did tho! - check #2355 if you're interested in helping cleanup the codebase)

@mcmonkey4eva mcmonkey4eva merged commit 880dba0 into DenizenScript:dev Jul 14, 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.

None yet

3 participants