Skip to content

Commit

Permalink
fix(StackUtils): 修复 1.20.5 以上 PotionMeta 比较
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Aug 7, 2024
1 parent a98e175 commit ebbdf22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.StarWishsama</groupId>
<groupId>com.github.SlimefunGuguProject</groupId>
<artifactId>Slimefun4</artifactId>
<version>2024.3</version>
<version>38953fe13a</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/io/github/sefiraat/networks/utils/StackUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.sefiraat.networks.utils;

import io.github.sefiraat.networks.network.stackcaches.ItemStackCache;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.libraries.dough.data.persistent.PersistentDataAPI;
import lombok.experimental.UtilityClass;
Expand Down Expand Up @@ -268,8 +269,14 @@ public boolean canQuickEscapeMetaVariant(@Nonnull ItemMeta metaOne, @Nonnull Ite

// Potion
if (metaOne instanceof PotionMeta instanceOne && metaTwo instanceof PotionMeta instanceTwo) {
if (!instanceOne.getBasePotionData().equals(instanceTwo.getBasePotionData())) {
return true;
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20_5)) {
if (instanceOne.getBasePotionType() != instanceTwo.getBasePotionType()) {
return true;
}
} else {
if (!instanceOne.getBasePotionData().equals(instanceTwo.getBasePotionData())) {
return true;
}
}
if (instanceOne.hasCustomEffects() != instanceTwo.hasCustomEffects()) {
return true;
Expand Down

0 comments on commit ebbdf22

Please sign in to comment.