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

Enchant changes #117

Merged
merged 5 commits into from
Dec 24, 2014
Merged

Enchant changes #117

merged 5 commits into from
Dec 24, 2014

Conversation

jonfabe
Copy link
Contributor

@jonfabe jonfabe commented Dec 23, 2014

Reenables enchant command that had been previously disabled during the switch to Info.lua command registering. Updates the enchant command to behave more like vanilla minecraft, and adds the ienchant command to allow only enchanting ones own items (similar to the difference between give and item commands ).

…r to vanilla

The code was there, but it appears it was forgotten when changing over to the Info.lua command registration format and was thus inactive. Also changed command to behave more like vanilla (adding player name option, disallowing certain parameter combinations, etc.). Added /ienchant command to maintain behavior of previous command without player name option.
SendMessageFailure(Player, "You haven't a item in the hand!")

-- Try to enchant the item
local Success = cRoot:Get():FindAndDoWithPlayer( PlayerName, DoEnchantment )
Copy link
Member

Choose a reason for hiding this comment

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

To avoid having to check the player name match, use the DoWithPlayer() function instead - it only calls the callback on an exact match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that function exported to lua? Its not listed on the generated API docs for the cRoot class. Also, does that function ignore case like FindAndDoWithPlayer() does? The one exported in cWorld seems to imply that its case sensitive.

Copy link
Member

Choose a reason for hiding this comment

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

You're right, it doesn't seem to have been exported yet. Alright, I'll merge this as is.

madmaxoft added a commit that referenced this pull request Dec 24, 2014
@madmaxoft madmaxoft merged commit 1b43db1 into cuberite:master Dec 24, 2014
@jonfabe jonfabe deleted the EnchantChanges branch December 29, 2014 23:33
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