Slimefun / Slimefun4

Slimefun 4 - A unique Spigot/Paper plugin that looks and feels like a modpack. We've been giving you backpacks, jetpacks, reactors and much more since 2013.
GNU General Public License v3.0
958 stars 547 forks source link

Optimize SlimefunUtils#isItemSimilar / Optimize SlimefunUtils#equalsItemMeta #4135

Closed IAISI closed 6 months ago

IAISI commented 6 months ago

Optimize SlimefunUtils#isItemSimilar Optimize SlimefunUtils#equalsItemMeta

Description

We can skip some of slow ItemMeta checks that relay on getDisplayName() and getLore() which both deserialize string from JSON internally in Spigot

Proposed changes

We check SF Item IDs first if those are available and then fallback to ItemMeta check.

Related Issues (if applicable)

Checklist

github-actions[bot] commented 6 months ago
Pro Tip! You can help us label your Pull Requests by using the following branch naming convention next time you create a pull request. โค๏ธ Branch naming convention Label
feature/** ๐ŸŽˆ Feature
fix/** โœจ Fix
chore/** ๐Ÿงน Chores
api/** ๐Ÿ”ง API
performance/** ๐Ÿ’ก Performance Optimization
compatibility/** ๐Ÿค Compatibility

If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! ๐Ÿ‘€

J3fftw1 commented 6 months ago

We have another PR changing this already as said many times on discord. https://github.com/Slimefun/Slimefun4/pull/4120

IAISI commented 6 months ago

The https://github.com/Slimefun/Slimefun4/pull/4120 doesn't remove those functions from SlimeFunUtils class tho? If so it's possible they would still be used? By other addons and stuff that is not related to Cargo?

WalshyDev commented 6 months ago

We cannot just remove public API without a deprecation period. The PR deprecates them as is our policy. That PR changes all Slimefun usages of the functions including Cargo.

They will be removed after the next RC when it's merged.

IAISI commented 6 months ago

Sounds good, I guess I can just close this?

J3fftw1 commented 6 months ago

Closed in favour of #4120