mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-10 11:15:06 +00:00
parent
494e82e581
commit
ce88c0e1e4
5 changed files with 8 additions and 9 deletions
|
@ -7,9 +7,9 @@ import com.earth2me.essentials.utils.EnumUtil;
|
|||
import com.earth2me.essentials.utils.FormatUtil;
|
||||
import com.earth2me.essentials.utils.MaterialUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.nms.refl.ReflUtil;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.FireworkEffect;
|
||||
|
@ -529,14 +529,14 @@ public class MetaItemStack {
|
|||
}
|
||||
pmeta.addCustomEffect(pEffect, true);
|
||||
stack.setItemMeta(pmeta);
|
||||
if (ReflUtil.getNmsVersionObject().isHigherThanOrEqualTo(ReflUtil.V1_9_R1)) {
|
||||
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_9_R01)) {
|
||||
if (isSplashPotion && stack.getType() != Material.SPLASH_POTION) {
|
||||
stack.setType(Material.SPLASH_POTION);
|
||||
} else if (!isSplashPotion && stack.getType() != Material.POTION) {
|
||||
stack.setType(Material.POTION);
|
||||
}
|
||||
} else {
|
||||
final Potion potion = Potion.fromItemStack(stack);
|
||||
final Potion potion = Potion.fromDamage(stack.getDurability());
|
||||
potion.setSplash(isSplashPotion);
|
||||
potion.apply(stack);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import com.earth2me.essentials.MetaItemStack;
|
|||
import com.earth2me.essentials.Potions;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.StringUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.ess3.nms.refl.ReflUtil;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -42,7 +42,7 @@ public class Commandpotion extends EssentialsCommand {
|
|||
}
|
||||
|
||||
boolean holdingPotion = stack.getType() == Material.POTION;
|
||||
if (!holdingPotion && ReflUtil.getNmsVersionObject().isHigherThanOrEqualTo(ReflUtil.V1_9_R1)) {
|
||||
if (!holdingPotion && VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_9_R01)) {
|
||||
holdingPotion = stack.getType() == Material.SPLASH_POTION || stack.getType() == Material.LINGERING_POTION;
|
||||
}
|
||||
if (holdingPotion) {
|
||||
|
|
|
@ -279,7 +279,7 @@ public abstract class AbstractItemDb implements IConf, net.ess3.api.IItemDb {
|
|||
serializeEffectMeta(sb, fireworkEffectMeta.getEffect());
|
||||
}
|
||||
} else if (MaterialUtil.isPotion(material)) {
|
||||
final Potion potion = Potion.fromItemStack(is);
|
||||
final Potion potion = Potion.fromDamage(is.getDurability());
|
||||
for (final PotionEffect e : potion.getEffects()) {
|
||||
// long but needs to be effect:speed power:2 duration:120 in that order.
|
||||
sb.append("splash:").append(potion.isSplash()).append(" ").append("effect:").append(e.getType().getName().toLowerCase()).append(" ").append("power:").append(e.getAmplifier()).append(" ").append("duration:").append(e.getDuration() / 20).append(" ");
|
||||
|
|
|
@ -3,8 +3,8 @@ package com.earth2me.essentials.items;
|
|||
import com.earth2me.essentials.ManagedFile;
|
||||
import com.earth2me.essentials.utils.EnumUtil;
|
||||
import com.earth2me.essentials.utils.NumberUtil;
|
||||
import com.earth2me.essentials.utils.VersionUtil;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.nms.refl.ReflUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -204,7 +204,7 @@ public class LegacyItemDb extends AbstractItemDb {
|
|||
}
|
||||
retval = ess.getSpawnEggProvider().createEggItem(type);
|
||||
} else if (mat.name().endsWith("POTION")
|
||||
&& ReflUtil.getNmsVersionObject().isLowerThan(ReflUtil.V1_11_R1)) { // Only apply this to pre-1.11 as items.csv might only work in 1.11
|
||||
&& VersionUtil.getServerBukkitVersion().isLowerThan(VersionUtil.v1_11_R01)) { // Only apply this to pre-1.11 as items.csv might only work in 1.11
|
||||
retval = ess.getPotionMetaProvider().createPotionItem(mat, metaData);
|
||||
} else {
|
||||
retval.setDurability(metaData);
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.regex.Pattern;
|
|||
|
||||
public final class ReflUtil {
|
||||
public static final NMSVersion V1_12_R1 = NMSVersion.fromString("v1_12_R1");
|
||||
public static final NMSVersion V1_9_R1 = NMSVersion.fromString("v1_9_R1");
|
||||
public static final NMSVersion V1_11_R1 = NMSVersion.fromString("v1_11_R1");
|
||||
public static final NMSVersion V1_17_R1 = NMSVersion.fromString("v1_17_R1");
|
||||
private static final Map<String, Class<?>> classCache = new HashMap<>();
|
||||
|
|
Loading…
Reference in a new issue