ExprTool - Cleanup & Additional Test#7710
Conversation
Add initial suggestions Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
|
I'm a little apprehensive about using just I personally think that tool/item should remain required as this expression is specifically about the item, not the hand itself. |
I wouldn't see why the team would want to make a whole new comparison for handling that in click when it would likely be much easier to add an event-value for
I'm still not too sure on changing it, |
Using main/offhand isn't the same as left/right click. If you're holding a sword in the main hand, torch in the offhand, and you click place, it will use the offhand. But if the sword has a block component or whatever, it'll block with the sword. It's not that simple,
Well, you just do |
Fusezion
left a comment
There was a problem hiding this comment.
I've updated this PR to remove the option of main hand of %entity% and off hand of %entity% and am now just marking it as a class cleanup.
There's only one part in this that confuses me and leads to improper behavior
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
* Initial Commit * Fix Elements * Fix Entity Spawning * Update EntityData.java * Skip `-` prefix variable names when saving. (Ephemeral variables) (#7495) * Skip minus sign names when saving. * Remove minus sign from tokens list instead. * move check to before serialization --------- Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * [WIP] Add on screen kick message expr (#7658) * Add kick message expr * Add proper placeholder for version * Code clean up * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * We only support 1.19.4+ * use deprecated api * resolve suggestions * mark method as nullable * remove minimessage entirely * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * shorter import * implement EventRestrictedSyntax * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * apply changes * implement suggestions * Update src/main/java/ch/njol/skript/expressions/ExprOnScreenKickMessage.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprOnScreenKickMessage.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * ExprTool - Cleanup & Additional Test (#7710) * ExprTool.java - add mainhand and offhand * ExprTool.sk - Add basic testing * ExprTool.sk - new line * Apply suggestions from code review Add initial suggestions Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * ExprTool.java - Change toString to SSB * Remove support for only "offhand" and "mainhand" * Move patterns back into the method * Update src/main/java/ch/njol/skript/expressions/ExprTool.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Move equipment slot map to BukkitUtils * Requested changes * Update to a BiMap for equipmentslot * Update src/main/java/ch/njol/skript/bukkitutil/BukkitUtils.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * Changes * Remove Feature Changes * Requested Changes * Update EntityUtils.java * Requested Changes --------- Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> Co-authored-by: Moderocky <admin@moderocky.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> Co-authored-by: nopeless <38830903+nopeless@users.noreply.github.com> Co-authored-by: Fusezion <fusezionstream@gmail.com> Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
* ExprTool.java - add mainhand and offhand * ExprTool.sk - Add basic testing * ExprTool.sk - new line * Apply suggestions from code review Add initial suggestions Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * ExprTool.java - Change toString to SSB * Remove support for only "offhand" and "mainhand" * Move patterns back into the method * Update src/main/java/ch/njol/skript/expressions/ExprTool.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Move equipment slot map to BukkitUtils * Requested changes * Update to a BiMap for equipmentslot * Update src/main/java/ch/njol/skript/bukkitutil/BukkitUtils.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
* Initial Commit * Fix Elements * Fix Entity Spawning * Update EntityData.java * Skip `-` prefix variable names when saving. (Ephemeral variables) (SkriptLang#7495) * Skip minus sign names when saving. * Remove minus sign from tokens list instead. * move check to before serialization --------- Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * [WIP] Add on screen kick message expr (SkriptLang#7658) * Add kick message expr * Add proper placeholder for version * Code clean up * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * We only support 1.19.4+ * use deprecated api * resolve suggestions * mark method as nullable * remove minimessage entirely * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> * shorter import * implement EventRestrictedSyntax * Update src/main/java/ch/njol/skript/expressions/ExprKickMessage.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * apply changes * implement suggestions * Update src/main/java/ch/njol/skript/expressions/ExprOnScreenKickMessage.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Update src/main/java/ch/njol/skript/expressions/ExprOnScreenKickMessage.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * ExprTool - Cleanup & Additional Test (SkriptLang#7710) * ExprTool.java - add mainhand and offhand * ExprTool.sk - Add basic testing * ExprTool.sk - new line * Apply suggestions from code review Add initial suggestions Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * ExprTool.java - Change toString to SSB * Remove support for only "offhand" and "mainhand" * Move patterns back into the method * Update src/main/java/ch/njol/skript/expressions/ExprTool.java Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> * Move equipment slot map to BukkitUtils * Requested changes * Update to a BiMap for equipmentslot * Update src/main/java/ch/njol/skript/bukkitutil/BukkitUtils.java Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com> * Changes * Remove Feature Changes * Requested Changes * Update EntityUtils.java * Requested Changes --------- Co-authored-by: SirSmurfy2 <82696841+TheAbsolutionism@users.noreply.github.com> Co-authored-by: Moderocky <admin@moderocky.com> Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com> Co-authored-by: nopeless <38830903+nopeless@users.noreply.github.com> Co-authored-by: Fusezion <fusezionstream@gmail.com> Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
Description
This PR aims to clean up the ExprTool class as well as include some more test for it.
The patterns have been split to hopefully increase readability of the pattern itself making it clear what is what.
Additionally a new method to the BukkitUtils class has been added to get equipment slot from their indices as well as the indices of the slots themselves.
I will say the handling of the events in this expression does not make any sense to happen, these should have been event-values, however it's sadly too late to change them.
Target Minecraft Versions: any
Requirements: none
Related Issues: #5700