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

Get wrong offhand tool in tool change event. #5094

Closed
1 task done
TUCAOEVER opened this issue Sep 10, 2022 · 1 comment
Closed
1 task done

Get wrong offhand tool in tool change event. #5094

TUCAOEVER opened this issue Sep 10, 2022 · 1 comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@TUCAOEVER
Copy link
Contributor

TUCAOEVER commented Sep 10, 2022

Skript/Server Version

[18:33:38 INFO]: [Skript] Server Version: git-Paper-794 (MC: 1.16.5)
[18:33:38 INFO]: [Skript] Skript Version: 2.6.3
[18:33:38 INFO]: [Skript] Installed Skript Addons:
[18:33:38 INFO]: [Skript]  - skript-fishing v1.0 (https://github.com/Fusezion/skript-fishing)
[18:33:38 INFO]: [Skript]  - Repuska v2.8.9
[18:33:38 INFO]: [Skript] Installed dependencies:
[18:33:38 INFO]: [Skript]  - Vault v1.7.3-b131
[18:33:38 INFO]: [Skript]  - WorldGuard v7.0.5+3827266

Bug Description

on tool change:
	send "%event.getPlayer().getInventory().getItemInOffHand()%" to console
	send "%offhand tool of event-player%" to console

the correct output should be same
but actually not same
"%offhand tool of event-player%" is always same as "%tool of event-player%" instead of actual item in player's offhand

Expected Behavior

offhand tool of event-player should always return player's offhand tool

Steps to Reproduce

on tool change:
	send "%event.getPlayer().getInventory().getItemInOffHand()%" to console
	send "%offhand tool of event-player%" to console

code to reproduce with skript-reflect installed.

Errors or Screenshots

image

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
TUCAOEVER added a commit to TUCAOEVER/Skript that referenced this issue Sep 10, 2022
@TheLimeGlass TheLimeGlass added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. PR available Issues which have a yet-to-be merged PR resolving it labels Sep 16, 2022
@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Sep 16, 2022

Thank you for the report and pull request.

Reasoning: This is only exclusive to the on tool change event. The event-value was grabbing the time specific value of the tool first and returning regardless if the Skript user defined off hand item or main hand. It would always be the main hand tool from the event.

The solution is to just ignore the event-value time state return if the user defined offhand item using the parser mark from the ExprTool expression. This results in the rest of the code execution from the ExprTool to grab the correct offhand item or main hand depending on the parser mark the user specified.

@TPGamesNL TPGamesNL added the priority: low Issues that are not harmful to the experience but are related to useful changes or additions. label Oct 2, 2022
@TheLimeGlass TheLimeGlass added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

3 participants