mirror of
https://github.com/HibiscusMC/HibiscusCommons.git
synced 2025-12-19 15:09:26 +00:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # common/src/main/java/me/lojosho/hibiscuscommons/hooks/misc/HookCustomFishing.java
This commit is contained in:
@@ -11,7 +11,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "me.lojosho"
|
||||
version = "0.6.0${getGitCommitHash()}"
|
||||
version = "0.6.1${getGitCommitHash()}"
|
||||
|
||||
allprojects {
|
||||
apply(plugin = "java")
|
||||
@@ -76,7 +76,7 @@ allprojects {
|
||||
compileOnly(fileTree("${project.rootDir}/lib") { include("*.jar") })
|
||||
|
||||
// Included externally
|
||||
compileOnly("com.mojang:authlib:1.5.25")
|
||||
compileOnly("com.mojang:authlib:3.13.56")
|
||||
//compileOnly("org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
|
||||
compileOnly("org.jetbrains:annotations:26.0.1")
|
||||
@@ -84,12 +84,12 @@ allprojects {
|
||||
compileOnly("com.nexomc:nexo:0.8.0-dev.8")
|
||||
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.3-beta-14")
|
||||
compileOnly("com.mineinabyss:geary-papermc:0.31.0-dev.4")
|
||||
compileOnly("it.unimi.dsi:fastutil:8.5.13")
|
||||
compileOnly("it.unimi.dsi:fastutil:8.5.15")
|
||||
compileOnly("com.denizenscript:denizen:1.2.7-SNAPSHOT")
|
||||
compileOnly("io.lumine:Mythic-Dist:5.2.1")
|
||||
compileOnly("com.github.LeonMangler:SuperVanish:6.2.17")
|
||||
compileOnly("net.Indyuce:MMOItems-API:6.9.4-SNAPSHOT")
|
||||
compileOnly("com.willfp:eco:6.67.2")
|
||||
compileOnly("com.willfp:eco:6.74.5")
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
compileOnly("LibsDisguises:LibsDisguises:10.0.44") {
|
||||
exclude("org.spigotmc", "spigot")
|
||||
@@ -97,23 +97,24 @@ allprojects {
|
||||
compileOnly("com.github.Xiao-MoMi:Custom-Fishing:2.2.26")
|
||||
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.2")
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:5.3.0")
|
||||
compileOnly("org.joml:joml:1.10.5")
|
||||
compileOnly("org.joml:joml:1.10.8")
|
||||
|
||||
// Lombok <3
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.34")
|
||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||
testCompileOnly("org.projectlombok:lombok:1.18.34")
|
||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.34")
|
||||
annotationProcessor("org.projectlombok:lombok:1.18.36")
|
||||
compileOnly("org.projectlombok:lombok:1.18.36")
|
||||
testCompileOnly("org.projectlombok:lombok:1.18.36")
|
||||
testAnnotationProcessor("org.projectlombok:lombok:1.18.36")
|
||||
|
||||
// Spigot Auto Loader Libraries
|
||||
compileOnly("net.kyori:adventure-api:4.18.0")
|
||||
compileOnly("net.kyori:adventure-text-minimessage:4.18.0")
|
||||
compileOnly("net.kyori:adventure-text-serializer-gson:4.18.0")
|
||||
compileOnly("net.kyori:adventure-platform-bukkit:4.3.4")
|
||||
compileOnly("org.apache.commons:commons-lang3:3.14.0")
|
||||
compileOnly("org.apache.commons:commons-lang3:3.17.0")
|
||||
|
||||
// Shaded Dependencies
|
||||
implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT")
|
||||
implementation("org.bstats:bstats-bukkit:3.0.2")
|
||||
implementation("org.bstats:bstats-bukkit:3.1.0")
|
||||
implementation("com.jeff_media:SpigotUpdateChecker:3.0.0")
|
||||
implementation("com.github.BG-Software-LLC:CommentedConfiguration:bed3c46369")
|
||||
}
|
||||
@@ -131,13 +132,12 @@ dependencies {
|
||||
tasks {
|
||||
compileJava {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
//options.release.set(17)
|
||||
}
|
||||
|
||||
runServer {
|
||||
dependsOn(shadowJar)
|
||||
dependsOn(jar)
|
||||
minecraftVersion("1.21.1")
|
||||
minecraftVersion("1.21.4")
|
||||
|
||||
downloadPlugins {
|
||||
hangar("PlaceholderAPI", "2.11.6")
|
||||
@@ -217,8 +217,9 @@ bukkit {
|
||||
libraries = listOf(
|
||||
"net.kyori:adventure-api:4.18.0",
|
||||
"net.kyori:adventure-text-minimessage:4.18.0",
|
||||
"net.kyori:adventure-text-serializer-gson:4.18.0",
|
||||
"net.kyori:adventure-platform-bukkit:4.3.4",
|
||||
"org.apache.commons:commons-lang3:3.14.0"
|
||||
"org.apache.commons:commons-lang3:3.17.0"
|
||||
//"org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT" // Readd when 4.2.0 releases
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,13 +20,6 @@ public final class HibiscusCommonsPlugin extends HibiscusPlugin {
|
||||
public void onStart() {
|
||||
instance = this;
|
||||
|
||||
try {
|
||||
NMSHandlers.setup();
|
||||
} catch (RuntimeException e) {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Detects if a user is running a paper server
|
||||
if (ServerUtils.hasClass("com.destroystokyo.paper.PaperConfig") || ServerUtils.hasClass("io.papermc.paper.configuration.Configuration")) {
|
||||
onPaper = true;
|
||||
@@ -38,6 +31,13 @@ public final class HibiscusCommonsPlugin extends HibiscusPlugin {
|
||||
getLogger().warning("Download Paper at: https://papermc.io/");
|
||||
}
|
||||
|
||||
try {
|
||||
NMSHandlers.setup();
|
||||
} catch (RuntimeException e) {
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Plugin startup logic
|
||||
Hooks.setup();
|
||||
|
||||
|
||||
@@ -63,12 +63,13 @@ public abstract class HibiscusPlugin extends JavaPlugin {
|
||||
.onSuccess((commandSenders, latestVersion) -> {
|
||||
this.latestVersion = (String) latestVersion;
|
||||
String pluginName = getDescription().getName();
|
||||
String version = getDescription().getVersion();
|
||||
|
||||
if (!this.latestVersion.equalsIgnoreCase(getDescription().getVersion())) {
|
||||
if (!this.latestVersion.equalsIgnoreCase(version)) {
|
||||
getLogger().info("+++++++++++++++++++++++++++++++++++");
|
||||
getLogger().info("There is a new update for " + pluginName + "!");
|
||||
getLogger().info("Please download it as soon as possible for possible fixes and new features.");
|
||||
getLogger().info("Current Version " + getDescription().getVersion() + " | Latest Version " + latestVersion);
|
||||
getLogger().info("Current Version " + version + " | Latest Version " + latestVersion);
|
||||
//getLogger().info("Spigot: https://www.spigotmc.org/resources/100107/");
|
||||
getLogger().info("Polymart: https://polymart.org/resource/" + resourceID);
|
||||
getLogger().info("+++++++++++++++++++++++++++++++++++");
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package me.lojosho.hibiscuscommons.api.events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HibiscusHooksAllActiveEvent extends Event {
|
||||
|
||||
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
}
|
||||
@@ -81,11 +81,8 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
if (itemMeta == null) return item;
|
||||
|
||||
if (!nameNode.virtual()) {
|
||||
if (HibiscusCommonsPlugin.isOnPaper()) {
|
||||
itemMeta.displayName(AdventureUtils.MINI_MESSAGE.deserialize(nameNode.getString("")));
|
||||
} else {
|
||||
itemMeta.setDisplayName(StringUtils.parseStringToString(nameNode.getString("")));
|
||||
}
|
||||
if (HibiscusCommonsPlugin.isOnPaper()) itemMeta.displayName(AdventureUtils.MINI_MESSAGE.deserialize(nameNode.getString("")));
|
||||
else itemMeta.setDisplayName(StringUtils.parseStringToString(nameNode.getString("")));
|
||||
}
|
||||
if (!unbreakableNode.virtual()) itemMeta.setUnbreakable(unbreakableNode.getBoolean());
|
||||
if (!glowingNode.virtual()) {
|
||||
@@ -93,13 +90,12 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
itemMeta.addEnchant(Enchantment.LUCK, 1, true);
|
||||
}
|
||||
if (!loreNode.virtual()) {
|
||||
if (HibiscusCommonsPlugin.isOnPaper()) {
|
||||
if (HibiscusCommonsPlugin.isOnPaper())
|
||||
itemMeta.lore(loreNode.getList(String.class, new ArrayList<>()).
|
||||
stream().map(AdventureUtils.MINI_MESSAGE::deserialize).collect(Collectors.toList()));
|
||||
} else {
|
||||
itemMeta.setLore(loreNode.getList(String.class, new ArrayList<>()).
|
||||
else itemMeta.setLore(loreNode.getList(String.class, new ArrayList<>()).
|
||||
stream().map(StringUtils::parseStringToString).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
}
|
||||
if (!modelDataNode.virtual()) itemMeta.setCustomModelData(modelDataNode.getInt());
|
||||
|
||||
@@ -113,13 +109,13 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
for (ConfigurationNode enchantNode : enchantsNode.childrenMap().values()) {
|
||||
String enchantName = enchantNode.key().toString().toLowerCase();
|
||||
NamespacedKey key = NamespacedKey.minecraft(enchantName);
|
||||
Enchantment enchant = Enchantment.getByKey(key);
|
||||
Enchantment enchant = Registry.ENCHANTMENT.get(key);
|
||||
if (enchant == null) continue;
|
||||
itemMeta.addEnchant(enchant, enchantNode.getInt(1), true);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (!itemFlagsNode.virtual()) {
|
||||
for (String itemFlag : itemFlagsNode.getList(String.class)) {
|
||||
if (!EnumUtils.isValidEnum(ItemFlag.class, itemFlag)) continue;
|
||||
@@ -127,9 +123,6 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
itemMeta.addItemFlags(ItemFlag.valueOf(itemFlag));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (item.getType() == Material.PLAYER_HEAD) {
|
||||
SkullMeta skullMeta = (SkullMeta) itemMeta;
|
||||
@@ -150,7 +143,7 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
skullMeta.getPersistentDataContainer().set(InventoryUtils.getSkullTexture(), PersistentDataType.STRING, textureString);
|
||||
}
|
||||
// Decodes the texture string and sets the texture url to the skull
|
||||
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.randomUUID());
|
||||
PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID());
|
||||
PlayerTextures textures = profile.getTextures();
|
||||
|
||||
String decoded = new String(Base64.getDecoder().decode(textureString));
|
||||
@@ -166,12 +159,11 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
skullMeta.setOwnerProfile(profile);
|
||||
}
|
||||
}
|
||||
itemMeta = skullMeta;
|
||||
}
|
||||
|
||||
if (!colorNode.virtual()) {
|
||||
if (ColorBuilder.canBeColored(item.getType())) {
|
||||
if (!redNode.virtual()) {
|
||||
if (!redNode.virtual() && !greenNode.virtual() && !blueNode.virtual()) {
|
||||
itemMeta = ColorBuilder.color(itemMeta, Color.fromRGB(redNode.getInt(0), greenNode.getInt(0), blueNode.getInt(0)));
|
||||
} else {
|
||||
itemMeta = ColorBuilder.color(itemMeta, ServerUtils.hex2Rgb(colorNode.getString("#FFFFFF")));
|
||||
@@ -186,6 +178,5 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
|
||||
public void serialize(final Type type, @Nullable final ItemStack obj, final ConfigurationNode node) throws SerializationException {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,21 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents a hook into other minecraft plugins
|
||||
*/
|
||||
public abstract class Hook implements Listener {
|
||||
|
||||
private final String id;
|
||||
|
||||
private boolean detected = false;
|
||||
private boolean active = false;
|
||||
|
||||
private boolean itemHook = false;
|
||||
private boolean entityHook = false;
|
||||
private boolean lateLoadHook = false;
|
||||
|
||||
public Hook(@NotNull String id, HookFlag... flags) {
|
||||
this.id = id;
|
||||
@@ -25,8 +32,12 @@ public abstract class Hook implements Listener {
|
||||
case ENTITY_SUPPORT:
|
||||
setEnabledEntityHook(true);
|
||||
break;
|
||||
case LATE_LOAD:
|
||||
setEnabledLateLoadHook(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Hooks.addHook(this);
|
||||
}
|
||||
|
||||
@@ -35,10 +46,11 @@ public abstract class Hook implements Listener {
|
||||
*
|
||||
* @implNote By default, this method does nothing. It should be overridden by child classes to implement any necessary loading logic
|
||||
*/
|
||||
public void load() { }
|
||||
public void load() {}
|
||||
|
||||
/**
|
||||
* Gets an {@link ItemStack} that is associated with the provided id from the hooked plugin
|
||||
*
|
||||
* @param itemId The id of the {@link ItemStack}
|
||||
* @return The {@link ItemStack} with the id provided. If an invalid id was provided or if the hook doesn't have any related {@link ItemStack}s then this will return null
|
||||
* @implNote By default, this method returns null. It should be overridden by child classes if you will to have your hook return a related {@link ItemStack}
|
||||
@@ -60,6 +72,7 @@ public abstract class Hook implements Listener {
|
||||
|
||||
/**
|
||||
* Gets whether this hook has been activated
|
||||
*
|
||||
* @return true if this hook is active, false otherwise
|
||||
* @deprecated As of release 2.2.5+, replaced by {@link #isActive()}
|
||||
*/
|
||||
@@ -70,6 +83,7 @@ public abstract class Hook implements Listener {
|
||||
|
||||
/**
|
||||
* Gets whether this hook has been activated
|
||||
*
|
||||
* @return true if this hook is active, false otherwise
|
||||
* @since 2.2.5
|
||||
*/
|
||||
@@ -79,16 +93,27 @@ public abstract class Hook implements Listener {
|
||||
|
||||
/**
|
||||
* Sets whether this hook is active
|
||||
*
|
||||
* @param active true to activate the hook, false otherwise
|
||||
*/
|
||||
public final void setActive(boolean active) {
|
||||
this.active = active;
|
||||
|
||||
if (hasEnabledLateLoadHook()) Hooks.checkHookLoadingStatus();
|
||||
}
|
||||
|
||||
public final boolean isDetected() {
|
||||
return this.detected;
|
||||
}
|
||||
|
||||
public final void setDetected(boolean detected) {
|
||||
this.detected = detected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the method {@link #getItem(String)} should return a non-null value
|
||||
* @return true if {@link #getItem(String)} should return a non-null value, false otherwise
|
||||
*
|
||||
* @return true if {@link #getItem(String)} should return a non-null value, false otherwise
|
||||
* @apiNote Even though this method returns true does not mean that {@link #getItem(String)} won't return null, rather if this returns false then {@link #getItem(String)} should return false everytime
|
||||
*/
|
||||
public final boolean hasEnabledItemHook() {
|
||||
@@ -99,8 +124,13 @@ public abstract class Hook implements Listener {
|
||||
return entityHook;
|
||||
}
|
||||
|
||||
public final boolean hasEnabledLateLoadHook() {
|
||||
return lateLoadHook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the method {@link #getItem(String)} should return a non-null value
|
||||
*
|
||||
* @param enabled true if {@link #getItem(String)} should return a non-null value, false otherwise
|
||||
*/
|
||||
public final void setEnabledItemHook(boolean enabled) {
|
||||
@@ -111,6 +141,10 @@ public abstract class Hook implements Listener {
|
||||
entityHook = enabled;
|
||||
}
|
||||
|
||||
public final void setEnabledLateLoadHook(boolean enabled) {
|
||||
lateLoadHook = enabled;
|
||||
}
|
||||
|
||||
public String getItemString(@NotNull ItemStack itemStack) {
|
||||
return null;
|
||||
}
|
||||
@@ -118,4 +152,12 @@ public abstract class Hook implements Listener {
|
||||
public String getEntityString(@NotNull Entity entity) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the entity is invisible (as defined by the hook)
|
||||
* @return true if the entity is invisible, false otherwise (or if the hook does not support entity invisibility)
|
||||
*/
|
||||
public boolean isInvisible(UUID uuid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,5 @@ package me.lojosho.hibiscuscommons.hooks;
|
||||
public enum HookFlag {
|
||||
ITEM_SUPPORT,
|
||||
ENTITY_SUPPORT,
|
||||
LATE_LOAD
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ package me.lojosho.hibiscuscommons.hooks;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusHooksAllActiveEvent;
|
||||
import me.lojosho.hibiscuscommons.hooks.items.*;
|
||||
import me.lojosho.hibiscuscommons.hooks.misc.*;
|
||||
import me.lojosho.hibiscuscommons.hooks.placeholders.HookPlaceholderAPI;
|
||||
import me.lojosho.hibiscuscommons.util.MessagesUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -15,10 +17,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Hooks {
|
||||
|
||||
private static final HashMap<String, Hook> hooks = new HashMap<>();
|
||||
private static final HashMap<String, Hook> HOOK_POOL = new HashMap<>();
|
||||
private static final HookNexo NEXO_HOOK = new HookNexo();
|
||||
private static final HookOraxen ORAXEN_HOOK = new HookOraxen();
|
||||
private static final HookItemAdder ITEMADDER_HOOK = new HookItemAdder();
|
||||
@@ -37,16 +42,18 @@ public class Hooks {
|
||||
private static final HookCustomFishing CF_HOOK = new HookCustomFishing();
|
||||
private static final HookGSit GSIT_HOOK = new HookGSit();
|
||||
|
||||
private static boolean allHooksActive = false;
|
||||
|
||||
public static Hook getHook(@NotNull String id) {
|
||||
return hooks.get(id.toLowerCase());
|
||||
return HOOK_POOL.get(id.toLowerCase());
|
||||
}
|
||||
|
||||
public static boolean isItemHook(@NotNull String id) {
|
||||
return hooks.containsKey(id.toLowerCase());
|
||||
return HOOK_POOL.containsKey(id.toLowerCase());
|
||||
}
|
||||
|
||||
public static void addHook(Hook hook) {
|
||||
hooks.put(hook.getId().toLowerCase(), hook);
|
||||
HOOK_POOL.put(hook.getId().toLowerCase(), hook);
|
||||
}
|
||||
|
||||
public static void addPlaceholderAPI(PlaceholderExpansion expansion) {
|
||||
@@ -63,14 +70,47 @@ public class Hooks {
|
||||
}
|
||||
|
||||
public static void setup() {
|
||||
for (Hook hook : hooks.values()) {
|
||||
for (Hook hook : HOOK_POOL.values()) {
|
||||
if (Bukkit.getPluginManager().getPlugin(hook.getId()) != null) {
|
||||
HibiscusCommonsPlugin.getInstance().getServer().getPluginManager().registerEvents(hook, HibiscusCommonsPlugin.getInstance());
|
||||
hook.setActive(true);
|
||||
hook.setDetected(true);
|
||||
hook.load();
|
||||
|
||||
HibiscusCommonsPlugin.getInstance().getLogger().info("Successfully hooked into " + hook.getId());
|
||||
}
|
||||
}
|
||||
|
||||
checkHookLoadingStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all hooked hooks are actually active
|
||||
* so {@link HibiscusHooksAllActiveEvent} is called.
|
||||
* This is an operation that occurs only once to allow plugins
|
||||
* load their stuff successfully when all hooks are active.
|
||||
*/
|
||||
public static void checkHookLoadingStatus() {
|
||||
if (allHooksActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Hook> lateLoadHooks = HOOK_POOL.values().stream().filter(Hook::isDetected).filter(Hook::hasEnabledLateLoadHook).toList();
|
||||
if (lateLoadHooks.isEmpty()) {
|
||||
MessagesUtil.sendDebugMessages("Not awaiting anymore plugins... All hooks are now active.");
|
||||
setAllHooksActive();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Hook> activeLateHooks = lateLoadHooks.stream().filter(Hook::isActive).toList();
|
||||
if (activeLateHooks.size() == lateLoadHooks.size()) {
|
||||
MessagesUtil.sendDebugMessages("Match Hook");
|
||||
setAllHooksActive();
|
||||
}
|
||||
}
|
||||
|
||||
private static void setAllHooksActive() {
|
||||
allHooksActive = true;
|
||||
Bukkit.getPluginManager().callEvent(new HibiscusHooksAllActiveEvent());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -88,13 +128,13 @@ public class Hooks {
|
||||
if (!isItemHook(split[0])) return null;
|
||||
Hook hook = getHook(split[0]);
|
||||
if (!hook.hasEnabledItemHook()) return null;
|
||||
if (!hook.isActive()) return null;
|
||||
if (!hook.isDetected() || !hook.isActive()) return null;
|
||||
return hook.getItem(split[1]);
|
||||
}
|
||||
|
||||
public static String getStringItem(ItemStack itemStack) {
|
||||
for (Hook hook : hooks.values()) {
|
||||
if (hook.isActive() && hook.hasEnabledItemHook()) {
|
||||
for (Hook hook : HOOK_POOL.values()) {
|
||||
if (hook.isDetected() && hook.hasEnabledItemHook()) {
|
||||
String stringyItem = hook.getItemString(itemStack);
|
||||
if (stringyItem == null) continue;
|
||||
return hook.getId() + ":" + stringyItem;
|
||||
@@ -104,8 +144,8 @@ public class Hooks {
|
||||
}
|
||||
|
||||
public static String getStringEntity(Entity entity) {
|
||||
for (Hook hook : hooks.values()) {
|
||||
if (hook.isActive() && hook.hasEnabledEntityHook()) {
|
||||
for (Hook hook : HOOK_POOL.values()) {
|
||||
if (hook.isDetected() && hook.hasEnabledEntityHook()) {
|
||||
String stringyEntity = hook.getEntityString(entity);
|
||||
if (stringyEntity != null) return hook.getId() + ":" + stringyEntity;
|
||||
}
|
||||
@@ -117,6 +157,16 @@ public class Hooks {
|
||||
public static boolean isActiveHook(String id) {
|
||||
Hook hook = getHook(id);
|
||||
if (hook == null) return false;
|
||||
if (!hook.isDetected()) return false;
|
||||
return hook.isActive();
|
||||
}
|
||||
|
||||
public static boolean isInvisible(UUID uuid) {
|
||||
for (Hook hook : HOOK_POOL.values()) {
|
||||
if (hook.isDetected()) {
|
||||
if (hook.isInvisible(uuid)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class HookDenizen extends Hook {
|
||||
public HookDenizen() {
|
||||
super("denizen", HookFlag.ITEM_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class HookEco extends Hook {
|
||||
public HookEco() {
|
||||
super("Eco", HookFlag.ITEM_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ public class HookGeary extends Hook {
|
||||
|
||||
public HookGeary() {
|
||||
super("geary", HookFlag.ITEM_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,10 +21,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public class HookItemAdder extends Hook {
|
||||
private boolean enabled = false;
|
||||
|
||||
public HookItemAdder() {
|
||||
super("itemsadder", HookFlag.ITEM_SUPPORT);
|
||||
super("itemsadder", HookFlag.ITEM_SUPPORT, HookFlag.LATE_LOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +31,7 @@ public class HookItemAdder extends Hook {
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getItem(@NotNull String itemId) {
|
||||
if (enabled) {
|
||||
if (isActive()) {
|
||||
CustomStack stack = CustomStack.getInstance(itemId);
|
||||
if (stack == null) return null;
|
||||
return stack.getItemStack().clone();
|
||||
@@ -43,10 +42,13 @@ public class HookItemAdder extends Hook {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onItemAdderDataLoad(ItemsAdderLoadDataEvent event) {
|
||||
HibiscusHookReload.ReloadType reloadType = enabled ? HibiscusHookReload.ReloadType.RELOAD : HibiscusHookReload.ReloadType.INITIAL;
|
||||
this.enabled = true;
|
||||
HibiscusHookReload newEvent = new HibiscusHookReload(this, reloadType);
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
HibiscusHookReload.ReloadType type = HibiscusHookReload.ReloadType.RELOAD;
|
||||
if (!isActive()) {
|
||||
type = HibiscusHookReload.ReloadType.INITIAL;
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new HibiscusHookReload(this, type));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
@@ -69,7 +71,14 @@ public class HookItemAdder extends Hook {
|
||||
return CustomStack.byItemStack(itemStack).getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if ItemsAdder hook is enabled
|
||||
* @return whether ItemsAdder hook is enabled or not
|
||||
* @deprecated as you can just check if the hook is active
|
||||
* by calling {@link #isActive()}
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getIAEnabled() {
|
||||
return enabled;
|
||||
return isActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class HookMMOItems extends Hook {
|
||||
public HookMMOItems() {
|
||||
super("MMOItems", HookFlag.ITEM_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,16 +9,17 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A hook that integrates the plugin {@link io.lumine.mythic.bukkit.MythicBukkit MythicBukkit} to provide custom items
|
||||
* A hook that integrates the plugin {@link MythicBukkit MythicBukkit} to provide custom items
|
||||
*/
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public class HookMythic extends Hook {
|
||||
public HookMythic() {
|
||||
super("mythicmobs", HookFlag.ITEM_SUPPORT, HookFlag.ENTITY_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a cosmetic {@link ItemStack} that is associated with the provided id from the plugin {@link io.lumine.mythic.bukkit.MythicBukkit MythicBukkit}
|
||||
* Gets a cosmetic {@link ItemStack} that is associated with the provided id from the plugin {@link MythicBukkit MythicBukkit}
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getItem(@NotNull String itemId) {
|
||||
|
||||
@@ -17,9 +17,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public class HookNexo extends Hook {
|
||||
private boolean enabled = false;
|
||||
|
||||
public HookNexo() {
|
||||
super("nexo", HookFlag.ITEM_SUPPORT);
|
||||
super("nexo", HookFlag.ITEM_SUPPORT, HookFlag.LATE_LOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ public class HookNexo extends Hook {
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getItem(@NotNull String itemId) {
|
||||
return NexoItems.optionalItemFromId(itemId).map(ItemBuilder::build).orElse(enabled ? new ItemStack(Material.AIR) : null);
|
||||
return NexoItems.optionalItemFromId(itemId).map(ItemBuilder::build).orElse(isActive() ? new ItemStack(Material.AIR) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,9 +39,12 @@ public class HookNexo extends Hook {
|
||||
|
||||
@EventHandler
|
||||
public void onLoadItems(NexoItemsLoadedEvent event) {
|
||||
HibiscusHookReload.ReloadType reloadType = enabled ? HibiscusHookReload.ReloadType.RELOAD : HibiscusHookReload.ReloadType.INITIAL;
|
||||
this.enabled = true;
|
||||
HibiscusHookReload newEvent = new HibiscusHookReload(this, reloadType);
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
HibiscusHookReload.ReloadType type = HibiscusHookReload.ReloadType.RELOAD;
|
||||
if (!isActive()) {
|
||||
type = HibiscusHookReload.ReloadType.INITIAL;
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new HibiscusHookReload(this, type));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class HookOraxen extends Hook {
|
||||
public HookOraxen() {
|
||||
super("oraxen", HookFlag.ITEM_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
package me.lojosho.hibiscuscommons.hooks.misc;
|
||||
|
||||
import com.Zrips.CMI.CMI;
|
||||
import com.Zrips.CMI.events.CMIPlayerUnVanishEvent;
|
||||
import com.Zrips.CMI.events.CMIPlayerVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerUnVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A hook that integrates the plugin {@link com.Zrips.CMI.CMI CMI}
|
||||
*/
|
||||
public class HookCMI extends Hook {
|
||||
public HookCMI() {
|
||||
super("CMI");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@@ -29,4 +34,11 @@ public class HookCMI extends Hook {
|
||||
HibiscusPlayerUnVanishEvent newEvent = new HibiscusPlayerUnVanishEvent(this, event.getPlayer());
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvisible(UUID uuid) {
|
||||
Player onlinePlayer = Bukkit.getPlayer(uuid);
|
||||
if (onlinePlayer == null) return false;
|
||||
return CMI.getInstance().getVanishManager().getAllVanished().contains(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ public class HookCustomFishing extends Hook {
|
||||
|
||||
public HookCustomFishing() {
|
||||
super("CustomFishing", HookFlag.ITEM_SUPPORT);
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ public class HookGSit extends Hook {
|
||||
|
||||
public HookGSit() {
|
||||
super("GSit");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
|
||||
|
||||
@@ -6,5 +6,6 @@ import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
public class HookHMCColor extends Hook {
|
||||
public HookHMCColor() {
|
||||
super("HMCColor");
|
||||
setActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.lojosho.hibiscuscommons.hooks.misc;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseAPI;
|
||||
import me.libraryaddict.disguise.events.DisguiseEvent;
|
||||
import me.libraryaddict.disguise.events.UndisguiseEvent;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerUnVanishEvent;
|
||||
@@ -11,9 +12,12 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class HookLibsDisguises extends Hook {
|
||||
public HookLibsDisguises() {
|
||||
super("LibsDisguises");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@@ -29,4 +33,11 @@ public class HookLibsDisguises extends Hook {
|
||||
HibiscusPlayerUnVanishEvent newEvent = new HibiscusPlayerUnVanishEvent(this, player);
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvisible(UUID uuid) {
|
||||
Player onlinePlayer = Bukkit.getPlayer(uuid);
|
||||
if (onlinePlayer == null) return false;
|
||||
return DisguiseAPI.isDisguised(onlinePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ public class HookModelEngine extends Hook {
|
||||
|
||||
public HookModelEngine() {
|
||||
super("ModelEngine");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,14 +2,19 @@ package me.lojosho.hibiscuscommons.hooks.misc;
|
||||
|
||||
import de.myzelyam.api.vanish.PlayerHideEvent;
|
||||
import de.myzelyam.api.vanish.PlayerShowEvent;
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerUnVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A hook that integrates the plugin {@link de.myzelyam.api.vanish.VanishAPI Supervanish}
|
||||
*
|
||||
@@ -18,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class HookPremiumVanish extends Hook {
|
||||
public HookPremiumVanish() {
|
||||
super("PremiumVanish");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@@ -31,4 +37,15 @@ public class HookPremiumVanish extends Hook {
|
||||
HibiscusPlayerUnVanishEvent newEvent = new HibiscusPlayerUnVanishEvent(this, event.getPlayer());
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvisible(UUID uuid) {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||
if (!player.isOnline()) {
|
||||
return VanishAPI.isInvisibleOffline(uuid);
|
||||
}
|
||||
Player onlinePlayer = player.getPlayer();
|
||||
if (onlinePlayer == null) return false;
|
||||
return VanishAPI.isInvisible(onlinePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,20 @@ package me.lojosho.hibiscuscommons.hooks.misc;
|
||||
|
||||
import de.myzelyam.api.vanish.PlayerHideEvent;
|
||||
import de.myzelyam.api.vanish.PlayerShowEvent;
|
||||
import de.myzelyam.api.vanish.VanishAPI;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerUnVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.api.events.HibiscusPlayerVanishEvent;
|
||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A hook that integrates the plugin {@link de.myzelyam.api.vanish.VanishAPI Supervanish}
|
||||
*
|
||||
@@ -18,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class HookSuperVanish extends Hook {
|
||||
public HookSuperVanish() {
|
||||
super("SuperVanish");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
@@ -31,4 +38,15 @@ public class HookSuperVanish extends Hook {
|
||||
HibiscusPlayerUnVanishEvent newEvent = new HibiscusPlayerUnVanishEvent(this, event.getPlayer());
|
||||
Bukkit.getPluginManager().callEvent(newEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvisible(UUID uuid) {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||
if (!player.isOnline()) {
|
||||
return VanishAPI.isInvisibleOffline(uuid);
|
||||
}
|
||||
Player onlinePlayer = player.getPlayer();
|
||||
if (onlinePlayer == null) return false;
|
||||
return VanishAPI.isInvisible(onlinePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class HookPlaceholderAPI extends Hook {
|
||||
|
||||
public HookPlaceholderAPI() {
|
||||
super("PlaceholderAPI");
|
||||
setActive(true);
|
||||
}
|
||||
|
||||
public void registerPlaceholder(PlaceholderExpansion placeholderExpansion) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class NMSHandlers {
|
||||
HibiscusCommonsPlugin.getInstance().getLogger().severe(" - " + supportedVersion);
|
||||
}
|
||||
HibiscusCommonsPlugin.getInstance().getLogger().severe(" ");
|
||||
HibiscusCommonsPlugin.getInstance().getLogger().severe("Please report this issue to the developer.");
|
||||
HibiscusCommonsPlugin.getInstance().getLogger().severe("Please update HibiscusCommons that supports this version.");
|
||||
throw new RuntimeException("Failed to detect the server version.");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.lojosho.hibiscuscommons.nms;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Display;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -74,4 +75,6 @@ public interface NMSPackets {
|
||||
int blockLight, int skyLight, float viewRange, float width, float height,
|
||||
ItemDisplay.ItemDisplayTransform transform, ItemStack itemStack,
|
||||
List<Player> sendTo);
|
||||
|
||||
void sendToastPacket(Player player, ItemStack icon, Component title, Component description);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,17 @@ package me.lojosho.hibiscuscommons.util;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import me.lojosho.hibiscuscommons.nms.NMSHandlers;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ServerUtils {
|
||||
|
||||
@@ -92,6 +97,22 @@ public class ServerUtils {
|
||||
return nextYaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the viewers of an entity (Players only) that can see the entity in the world.
|
||||
* This ignores config view distances and checks directly with the server.
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
@NotNull
|
||||
public static List<Player> getViewers(@NotNull Entity entity) {
|
||||
if (HibiscusCommonsPlugin.isOnPaper()) return List.copyOf(entity.getTrackedBy());
|
||||
ArrayList<Player> viewers = new ArrayList<>();
|
||||
for (Player player : entity.getLocation().getWorld().getPlayers()) {
|
||||
if (player.canSee(entity)) viewers.add(player);
|
||||
}
|
||||
return viewers;
|
||||
}
|
||||
|
||||
public static boolean hasClass(String className) {
|
||||
try {
|
||||
Class.forName(className);
|
||||
|
||||
@@ -1 +1 @@
|
||||
userdevVersion=2.0.0-beta.11
|
||||
userdevVersion=2.0.0-beta.14
|
||||
@@ -1,13 +1,23 @@
|
||||
package me.lojosho.hibiscuscommons.nms.v1_20_R3;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
@@ -26,6 +36,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -295,4 +306,9 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.
|
||||
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, dataValues);
|
||||
for (Player p : sendTo) sendPacket(p, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToastPacket(Player player, ItemStack icon, Component title, Component description) {
|
||||
throw new UnsupportedOperationException("Not implemented in this version.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
package me.lojosho.hibiscuscommons.nms.v1_20_R4;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
@@ -26,6 +35,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -293,4 +303,73 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.
|
||||
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, dataValues);
|
||||
for (Player p : sendTo) sendPacket(p, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToastPacket(Player player, ItemStack icon, Component title, Component description) {
|
||||
final var key = new ResourceLocation("hibiscuscommons", UUID.randomUUID().toString());
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
// Creating the "criteria" object
|
||||
JsonObject impossibleCriteria = new JsonObject();
|
||||
JsonObject impossible = new JsonObject();
|
||||
impossible.addProperty("trigger", "minecraft:impossible");
|
||||
impossibleCriteria.add("impossible", impossible);
|
||||
json.add("criteria", impossibleCriteria);
|
||||
|
||||
// Creating the "display" object
|
||||
JsonObject display = new JsonObject();
|
||||
JsonObject iconObj = new JsonObject();
|
||||
iconObj.addProperty("id", icon.getType().getKey().toString());
|
||||
|
||||
if (icon.hasItemMeta()) {
|
||||
ItemMeta meta = icon.getItemMeta();
|
||||
JsonObject components = new JsonObject();
|
||||
|
||||
if (!meta.getEnchants().isEmpty()) {
|
||||
components.addProperty("minecraft:enchantment_glint_override", true);
|
||||
}
|
||||
|
||||
if (meta.hasCustomModelData()) {
|
||||
components.addProperty("minecraft:custom_model_data", meta.getCustomModelData());
|
||||
}
|
||||
|
||||
iconObj.add("components", components);
|
||||
}
|
||||
|
||||
display.add("icon", iconObj);
|
||||
display.add("title", GsonComponentSerializer.gson().serializeToTree(title));
|
||||
display.add("description", GsonComponentSerializer.gson().serializeToTree(description));
|
||||
display.addProperty("description", "Toast Description");
|
||||
display.addProperty("frame", "task");
|
||||
display.addProperty("announce_to_chat", false);
|
||||
display.addProperty("show_toast", true);
|
||||
display.addProperty("hidden", true);
|
||||
|
||||
json.add("display", display);
|
||||
|
||||
final var advancement = Advancement.CODEC.parse(MinecraftServer.getServer().registryAccess().createSerializationContext(JsonOps.INSTANCE), json);
|
||||
final var advancementHolder = new AdvancementHolder(key, advancement.result().orElseThrow());
|
||||
|
||||
final var nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
final var progress = nmsPlayer.getAdvancements().getOrStartProgress(advancementHolder);
|
||||
MinecraftServer.getServer().getAdvancements().tree().addAll(Set.of(advancementHolder));
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().award(advancementHolder, criteria));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(HibiscusCommonsPlugin.getInstance(), () -> {
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().revoke(advancementHolder, criteria));
|
||||
MinecraftServer.getServer().getAdvancements().tree().remove(Set.of(key));
|
||||
|
||||
// Remove the advancement from the player's client to prevent it from being displayed again
|
||||
// Was not working without this?
|
||||
ClientboundUpdateAdvancementsPacket removePacket = new ClientboundUpdateAdvancementsPacket(
|
||||
false,
|
||||
Collections.emptyList(),
|
||||
Set.of(key),
|
||||
Map.of()
|
||||
);
|
||||
|
||||
sendPacket(player, removePacket);
|
||||
}, 2L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
package me.lojosho.hibiscuscommons.nms.v1_21_R1;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.kinds.Const;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
@@ -27,6 +36,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -302,4 +312,73 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.
|
||||
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, dataValues);
|
||||
for (Player p : sendTo) sendPacket(p, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToastPacket(Player player, ItemStack icon, Component title, Component description) {
|
||||
final var key = ResourceLocation.fromNamespaceAndPath("hibiscuscommons", UUID.randomUUID().toString());
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
// Creating the "criteria" object
|
||||
JsonObject impossibleCriteria = new JsonObject();
|
||||
JsonObject impossible = new JsonObject();
|
||||
impossible.addProperty("trigger", "minecraft:impossible");
|
||||
impossibleCriteria.add("impossible", impossible);
|
||||
json.add("criteria", impossibleCriteria);
|
||||
|
||||
// Creating the "display" object
|
||||
JsonObject display = new JsonObject();
|
||||
JsonObject iconObj = new JsonObject();
|
||||
iconObj.addProperty("id", icon.getType().getKey().toString());
|
||||
|
||||
if (icon.hasItemMeta()) {
|
||||
ItemMeta meta = icon.getItemMeta();
|
||||
JsonObject components = new JsonObject();
|
||||
|
||||
if (!meta.getEnchants().isEmpty()) {
|
||||
components.addProperty("minecraft:enchantment_glint_override", true);
|
||||
}
|
||||
|
||||
if (meta.hasCustomModelData()) {
|
||||
components.addProperty("minecraft:custom_model_data", meta.getCustomModelData());
|
||||
}
|
||||
|
||||
iconObj.add("components", components);
|
||||
}
|
||||
|
||||
display.add("icon", iconObj);
|
||||
display.add("title", GsonComponentSerializer.gson().serializeToTree(title));
|
||||
display.add("description", GsonComponentSerializer.gson().serializeToTree(description));
|
||||
display.addProperty("description", "Toast Description");
|
||||
display.addProperty("frame", "task");
|
||||
display.addProperty("announce_to_chat", false);
|
||||
display.addProperty("show_toast", true);
|
||||
display.addProperty("hidden", true);
|
||||
|
||||
json.add("display", display);
|
||||
|
||||
final var advancement = Advancement.CODEC.parse(MinecraftServer.getServer().registryAccess().createSerializationContext(JsonOps.INSTANCE), json);
|
||||
final var advancementHolder = new AdvancementHolder(key, advancement.result().orElseThrow());
|
||||
|
||||
final var nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
final var progress = nmsPlayer.getAdvancements().getOrStartProgress(advancementHolder);
|
||||
MinecraftServer.getServer().getAdvancements().tree().addAll(Set.of(advancementHolder));
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().award(advancementHolder, criteria));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(HibiscusCommonsPlugin.getInstance(), () -> {
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().revoke(advancementHolder, criteria));
|
||||
MinecraftServer.getServer().getAdvancements().tree().remove(Set.of(key));
|
||||
|
||||
// Remove the advancement from the player's client to prevent it from being displayed again
|
||||
// Was not working without this?
|
||||
ClientboundUpdateAdvancementsPacket removePacket = new ClientboundUpdateAdvancementsPacket(
|
||||
false,
|
||||
Collections.emptyList(),
|
||||
Set.of(key),
|
||||
Map.of()
|
||||
);
|
||||
|
||||
sendPacket(player, removePacket);
|
||||
}, 2L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
package me.lojosho.hibiscuscommons.nms.v1_21_R2;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.PositionMoveRotation;
|
||||
@@ -29,6 +38,7 @@ import org.bukkit.entity.ItemDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -281,4 +291,73 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.
|
||||
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, dataValues);
|
||||
for (Player p : sendTo) sendPacket(p, packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToastPacket(Player player, ItemStack icon, Component title, Component description) {
|
||||
final var key = ResourceLocation.fromNamespaceAndPath("hibiscuscommons", UUID.randomUUID().toString());
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
// Creating the "criteria" object
|
||||
JsonObject impossibleCriteria = new JsonObject();
|
||||
JsonObject impossible = new JsonObject();
|
||||
impossible.addProperty("trigger", "minecraft:impossible");
|
||||
impossibleCriteria.add("impossible", impossible);
|
||||
json.add("criteria", impossibleCriteria);
|
||||
|
||||
// Creating the "display" object
|
||||
JsonObject display = new JsonObject();
|
||||
JsonObject iconObj = new JsonObject();
|
||||
iconObj.addProperty("id", icon.getType().getKey().toString());
|
||||
|
||||
if (icon.hasItemMeta()) {
|
||||
ItemMeta meta = icon.getItemMeta();
|
||||
JsonObject components = new JsonObject();
|
||||
|
||||
if (!meta.getEnchants().isEmpty()) {
|
||||
components.addProperty("minecraft:enchantment_glint_override", true);
|
||||
}
|
||||
|
||||
if (meta.hasCustomModelData()) {
|
||||
components.addProperty("minecraft:custom_model_data", meta.getCustomModelData());
|
||||
}
|
||||
|
||||
iconObj.add("components", components);
|
||||
}
|
||||
|
||||
display.add("icon", iconObj);
|
||||
display.add("title", GsonComponentSerializer.gson().serializeToTree(title));
|
||||
display.add("description", GsonComponentSerializer.gson().serializeToTree(description));
|
||||
display.addProperty("description", "Toast Description");
|
||||
display.addProperty("frame", "task");
|
||||
display.addProperty("announce_to_chat", false);
|
||||
display.addProperty("show_toast", true);
|
||||
display.addProperty("hidden", true);
|
||||
|
||||
json.add("display", display);
|
||||
|
||||
final var advancement = Advancement.CODEC.parse(MinecraftServer.getServer().registryAccess().createSerializationContext(JsonOps.INSTANCE), json);
|
||||
final var advancementHolder = new AdvancementHolder(key, advancement.result().orElseThrow());
|
||||
|
||||
final var nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
final var progress = nmsPlayer.getAdvancements().getOrStartProgress(advancementHolder);
|
||||
MinecraftServer.getServer().getAdvancements().tree().addAll(Set.of(advancementHolder));
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().award(advancementHolder, criteria));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(HibiscusCommonsPlugin.getInstance(), () -> {
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().revoke(advancementHolder, criteria));
|
||||
MinecraftServer.getServer().getAdvancements().tree().remove(Set.of(key));
|
||||
|
||||
// Remove the advancement from the player's client to prevent it from being displayed again
|
||||
// Was not working without this?
|
||||
ClientboundUpdateAdvancementsPacket removePacket = new ClientboundUpdateAdvancementsPacket(
|
||||
false,
|
||||
Collections.emptyList(),
|
||||
Set.of(key),
|
||||
Map.of()
|
||||
);
|
||||
|
||||
sendPacket(player, removePacket);
|
||||
}, 2L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
package me.lojosho.hibiscuscommons.nms.v1_21_R3;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.lojosho.hibiscuscommons.HibiscusCommonsPlugin;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.json.JSONComponentSerializer;
|
||||
import net.minecraft.advancements.*;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.game.*;
|
||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.entity.PositionMoveRotation;
|
||||
@@ -29,6 +38,7 @@ import org.bukkit.entity.ItemDisplay;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -42,6 +52,7 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.
|
||||
static Constructor<ClientboundSetEntityLinkPacket> linkConstructor;
|
||||
static Constructor<ClientboundSetCameraPacket> cameraConstructor;
|
||||
static Constructor<ClientboundPlayerLookAtPacket> lookAtConstructor;
|
||||
|
||||
static {
|
||||
try {
|
||||
passengerConstructor = ClientboundSetPassengersPacket.class.getDeclaredConstructor(FriendlyByteBuf.class);
|
||||
@@ -281,4 +292,72 @@ public class NMSPackets extends NMSCommon implements me.lojosho.hibiscuscommons.
|
||||
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(entityId, dataValues);
|
||||
for (Player p : sendTo) sendPacket(p, packet);
|
||||
}
|
||||
|
||||
public void sendToastPacket(Player player, ItemStack icon, Component title, Component description) {
|
||||
final var key = ResourceLocation.fromNamespaceAndPath("hibiscuscommons", UUID.randomUUID().toString());
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
|
||||
// Creating the "criteria" object
|
||||
JsonObject impossibleCriteria = new JsonObject();
|
||||
JsonObject impossible = new JsonObject();
|
||||
impossible.addProperty("trigger", "minecraft:impossible");
|
||||
impossibleCriteria.add("impossible", impossible);
|
||||
json.add("criteria", impossibleCriteria);
|
||||
|
||||
// Creating the "display" object
|
||||
JsonObject display = new JsonObject();
|
||||
JsonObject iconObj = new JsonObject();
|
||||
iconObj.addProperty("id", icon.getType().getKey().toString());
|
||||
|
||||
if (icon.hasItemMeta()) {
|
||||
ItemMeta meta = icon.getItemMeta();
|
||||
JsonObject components = new JsonObject();
|
||||
|
||||
if (!meta.getEnchants().isEmpty()) {
|
||||
components.addProperty("minecraft:enchantment_glint_override", true);
|
||||
}
|
||||
|
||||
if (meta.hasCustomModelData()) {
|
||||
components.addProperty("minecraft:custom_model_data", meta.getCustomModelData());
|
||||
}
|
||||
|
||||
iconObj.add("components", components);
|
||||
}
|
||||
|
||||
display.add("icon", iconObj);
|
||||
display.add("title", GsonComponentSerializer.gson().serializeToTree(title));
|
||||
display.add("description", GsonComponentSerializer.gson().serializeToTree(description));
|
||||
display.addProperty("description", "Toast Description");
|
||||
display.addProperty("frame", "task");
|
||||
display.addProperty("announce_to_chat", false);
|
||||
display.addProperty("show_toast", true);
|
||||
display.addProperty("hidden", true);
|
||||
|
||||
json.add("display", display);
|
||||
|
||||
final var advancement = Advancement.CODEC.parse(MinecraftServer.getServer().registryAccess().createSerializationContext(JsonOps.INSTANCE), json);
|
||||
final var advancementHolder = new AdvancementHolder(key, advancement.result().orElseThrow());
|
||||
|
||||
final var nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
final var progress = nmsPlayer.getAdvancements().getOrStartProgress(advancementHolder);
|
||||
MinecraftServer.getServer().getAdvancements().tree().addAll(Set.of(advancementHolder));
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().award(advancementHolder, criteria));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(HibiscusCommonsPlugin.getInstance(), () -> {
|
||||
progress.getRemainingCriteria().forEach(criteria -> nmsPlayer.getAdvancements().revoke(advancementHolder, criteria));
|
||||
MinecraftServer.getServer().getAdvancements().tree().remove(Set.of(key));
|
||||
|
||||
// Remove the advancement from the player's client to prevent it from being displayed again
|
||||
// Was not working without this?
|
||||
ClientboundUpdateAdvancementsPacket removePacket = new ClientboundUpdateAdvancementsPacket(
|
||||
false,
|
||||
Collections.emptyList(),
|
||||
Set.of(key),
|
||||
Map.of()
|
||||
);
|
||||
|
||||
sendPacket(player, removePacket);
|
||||
}, 2L);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user