diff --git a/pom.xml b/pom.xml
index fa2b463..85ba487 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,7 +34,7 @@
facecore
- 1.18.1.0
+ 1.18.1.1
jar
facecore
@@ -128,7 +128,7 @@
com.loohp
InteractiveChat
- 4.1.0.18
+ 4.1.1.14
provided
@@ -216,6 +216,29 @@
+
+
+
+ com.comphenix.protocol
+ ProtocolLib
+ 4.8.0-SNAPSHOT
+ provided
+
+
+ me.clip
+ placeholderapi
+ 2.11.1
+ provided
+
+
+ com.loohp
+ InteractiveChat
+ 4.1.1.14
+ provided
+
+
+
+
apache.snapshots
diff --git a/src/main/java/com/tealcube/minecraft/bukkit/facecore/profile/MoveListener.java b/src/main/java/com/tealcube/minecraft/bukkit/facecore/profile/MoveListener.java
index 96baae2..64e5b97 100644
--- a/src/main/java/com/tealcube/minecraft/bukkit/facecore/profile/MoveListener.java
+++ b/src/main/java/com/tealcube/minecraft/bukkit/facecore/profile/MoveListener.java
@@ -45,7 +45,6 @@ public void onPlayerMove(PlayerMoveEvent event) {
|| event.getFrom().getY() != event.getTo().getY()
|| event.getFrom().getZ() != event.getTo().getZ()) {
MoveUtil.setLastMoved(event.getPlayer());
- MoveUtil.setVelocity(event.getPlayer());
}
boolean grounded = ((Entity) event.getPlayer()).isOnGround();
diff --git a/src/main/java/com/tealcube/minecraft/bukkit/facecore/task/EveryTickTask.java b/src/main/java/com/tealcube/minecraft/bukkit/facecore/task/EveryTickTask.java
index 573cab0..d52ee61 100644
--- a/src/main/java/com/tealcube/minecraft/bukkit/facecore/task/EveryTickTask.java
+++ b/src/main/java/com/tealcube/minecraft/bukkit/facecore/task/EveryTickTask.java
@@ -33,6 +33,7 @@ public class EveryTickTask extends BukkitRunnable {
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
MoveUtil.setSneak(player);
+ MoveUtil.setVelocity(player);
}
}
}
diff --git a/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ItemUtils.java b/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ItemUtils.java
index 4592aee..bf587fa 100644
--- a/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ItemUtils.java
+++ b/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ItemUtils.java
@@ -23,10 +23,13 @@
package com.tealcube.minecraft.bukkit.facecore.utilities;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.bukkit.ChatColor;
import org.bukkit.Location;
+import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@@ -40,11 +43,26 @@ public static Map giveOrDrop(@Nonnull Player player, @Nullab
World world = player.getWorld();
Location location = player.getLocation();
drop.values().forEach((item) -> {
- world.dropItemNaturally(location, item);
+ if (item != null && item.getType() != Material.AIR) {
+ world.dropItemNaturally(location, item);
+ }
});
return drop;
} else {
return new HashMap();
}
}
+
+ public static boolean containsLore(ItemStack itemStack, List lore) {
+ if (itemStack == null || !itemStack.hasItemMeta() || !itemStack.getItemMeta().hasLore()) {
+ return false;
+ }
+ for (String s : TextUtils.getLore(itemStack)) {
+ String stripped = ChatColor.stripColor(s);
+ if (lore.contains(stripped)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/TextUtils.java b/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/TextUtils.java
index 2f64c41..539517c 100644
--- a/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/TextUtils.java
+++ b/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/TextUtils.java
@@ -22,10 +22,9 @@
*/
package com.tealcube.minecraft.bukkit.facecore.utilities;
-import io.pixeloutlaw.minecraft.spigot.garbage.ListExtensionsKt;
-import io.pixeloutlaw.minecraft.spigot.garbage.StringExtensionsKt;
import java.util.ArrayList;
import java.util.List;
+import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@@ -33,17 +32,21 @@
public class TextUtils {
public static List color(List text) {
+ List newList = new ArrayList<>();
if (text == null || text.size() == 0) {
- return new ArrayList<>();
+ return newList;
+ }
+ for (String s : text) {
+ newList.add(ChatColor.translateAlternateColorCodes('&', s));
}
- return ListExtensionsKt.chatColorize(text);
+ return newList;
}
public static String color(String text) {
if (StringUtils.isBlank(text)) {
return text;
}
- return StringExtensionsKt.chatColorize(text);
+ return ChatColor.translateAlternateColorCodes('&', text);
}
public static List getLore(ItemStack stack) {
diff --git a/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ToastUtils.java b/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ToastUtils.java
index d6cc7b6..56e443d 100644
--- a/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ToastUtils.java
+++ b/src/main/java/com/tealcube/minecraft/bukkit/facecore/utilities/ToastUtils.java
@@ -22,100 +22,20 @@
*/
package com.tealcube.minecraft.bukkit.facecore.utilities;
-import com.comphenix.protocol.events.PacketContainer;
-import com.loohp.interactivechat.InteractiveChat;
-import com.loohp.interactivechat.libs.net.kyori.adventure.text.Component;
-import com.loohp.interactivechat.libs.net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
-import com.loohp.interactivechat.utils.ChatComponentType;
-import com.loohp.interactivechat.utils.ClassUtils;
-import com.loohp.interactivechat.utils.ItemStackUtils;
-import com.loohp.interactivechat.utils.NMSUtils;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.bukkit.ChatColor;
+import com.loohp.interactivechat.api.InteractiveChatAPI;
+import com.loohp.interactivechat.objectholders.ICPlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import com.loohp.interactivechat.objectholders.ICPlayer;
public class ToastUtils {
- private static Class> nmsMinecraftKeyClass;
- private static Constructor> nmsMinecraftKeyConstructor;
- private static Class> nmsAdvancementRewardsClass;
- private static Class> nmsCustomFunctionAClass;
- private static Constructor> nmsAdvancementRewardsConstructor;
- private static Class> nmsAdvancementDisplayClass;
- private static Class> nmsItemStackClass;
- private static Class> nmsIChatBaseComponentClass;
- private static Class> nmsAdvancementFrameTypeClass;
- private static Constructor> nmsAdvancementDisplayConstructor;
- private static Object[] nmsAdvancementFrameTypeEnums;
- private static Class> nmsCriterionClass;
- private static Class> nmsCriterionTriggerImpossibleAClass;
- private static Constructor> nmsCriterionTriggerImpossibleAConstructor;
- private static Class> nmsCriterionInstanceClass;
- private static Constructor> nmsCriterionConstructor;
- private static Class> nmsAdvancementClass;
- private static Constructor> nmsAdvancementConstructor;
- private static Class> nmsAdvancementProgressClass;
- private static Constructor> nmsAdvancementProgressConstructor;
- private static Method nmsAdvancementProgressAMethod;
- private static Method nmsAdvancementProgressGetCriterionProgressMethod;
- private static Method nmsAdvancementProgressGetCriterionProgressBMethod;
- private static Class> nmsPacketPlayOutAdvancementsClass;
- private static Constructor> nmsPacketPlayOutAdvancementsConstuctor;
-
public static void sendToast(Player player, String message, ItemStack stack) {
sendToast(player, message, stack, ToastStyle.GOAL);
}
public static void sendToast(Player player, String message, ItemStack stack, ToastStyle style) {
- ICPlayer toastPlayer = new ICPlayer(player);
- sendPacketToast(toastPlayer, player, message, stack, style);
- }
-
- private static void sendPacketToast(ICPlayer sender, Player pinged, String message, ItemStack icon, ToastStyle style) {
- ChatColor.translateAlternateColorCodes('&', message);
- try {
- Object minecraftKey = nmsMinecraftKeyConstructor.newInstance("facecore", "toasty/" + sender.getUniqueId());
- Object advRewards = nmsAdvancementRewardsConstructor.newInstance(0, Array.newInstance(nmsMinecraftKeyClass, 0), Array.newInstance(nmsMinecraftKeyClass, 0), null);
- Object componentTitle = ChatComponentType.IChatBaseComponent.convertTo(
- LegacyComponentSerializer.legacySection().deserialize(message), InteractiveChat.version.isLegacy());
- Object componentSubtitle = ChatComponentType.IChatBaseComponent.convertTo(Component.empty(), InteractiveChat.version.isLegacy());
- Object advancementDisplay = nmsAdvancementDisplayConstructor.newInstance(ItemStackUtils.toNMSCopy(icon), componentTitle, componentSubtitle, null, nmsAdvancementFrameTypeEnums[style.ordinal()], true, false, true);
- Map advCriteria = new HashMap();
- String[][] advRequirements;
- advCriteria.put("for_free", nmsCriterionConstructor.newInstance(nmsCriterionTriggerImpossibleAConstructor.newInstance()));
- List fixedRequirements = new ArrayList();
- fixedRequirements.add(new String[]{"for_free"});
- advRequirements = Arrays.stream(fixedRequirements.toArray()).toArray(String[][]::new);
- Object saveAdv = nmsAdvancementConstructor.newInstance(minecraftKey, null, advancementDisplay, advRewards, advCriteria, advRequirements);
- Map