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

EventListener does not properly check for enchantment compatibility when enchanting with books. #163

Closed
95CivicSi opened this issue May 21, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@95CivicSi
Copy link
Contributor

commented May 21, 2018

Please make sure your issue complies with these guidelines:

    • Server Software must be the official PMMP w/o vanilla patching plugins (i.e. TeaSpoon)
    • Issue must have not been reported previously
    • Make sure you are on the latest version of PMMP & PiggyCustomEnchants
    • Have a detailed title, like "CustomEnchants::getName() must be..."
    • If possible, provide crashdumps/errors related to the issue.

General

When trying to use a book to enchant an item that is not compatible with enchantment, the book is lost and the item is not enchanted, but enchant succeeded tip pops up above the hotbar.

Version:

  • PiggyCustomEnchants: 1.1.3
  • PMMP: PocketMine-MP 1.7dev-1001 「[REDACTED]」 implementing API version 3.0.0-ALPHA12 for Minecraft: PE v1.4.0 (protocol version 261)

Steps to Reproduce the Issue

  1. Put an item in your inventory that is not compatible with other enchants (I used a nether star).
  2. Enchant a book with an enchantment that is not compatible with the item you selected.
  3. Pick the book up and drop it on the item.

Extra Information

This is caused by an inaccurate use of canBeEnchanted() in EventListener.php.
https://github.com/DaPigGuy/PiggyCustomEnchants/blob/master/src/PiggyCustomEnchants/EventListener.php#L214

The docblock for canBeEnchanted() incorrectly identifies the return type as strictly bool when it should be bool|int
https://github.com/DaPigGuy/PiggyCustomEnchants/blob/master/src/PiggyCustomEnchants/Main.php#L720-L728

@95CivicSi 95CivicSi changed the title UseEnchantedBookTask does not properly check for enchantment compatibility. EventListener does not properly check for enchantment compatibility when enchanting with books. May 22, 2018

@DaPigGuy DaPigGuy closed this in 3ae04fc May 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.