9
0
mirror of https://github.com/GeyserExtensionists/GeyserUtils.git synced 2025-12-19 15:09:24 +00:00

I did a whole lot, essentially added a whole property system. (sorry for not commiting, i forgot)

This commit is contained in:
OmeWillem
2024-07-04 02:46:23 +02:00
parent 427c4c3e89
commit 584e43b733
7 changed files with 194 additions and 11 deletions

View File

@@ -61,6 +61,10 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>opencollab-snapshot</id>
<url>https://repo.opencollab.dev/main/</url>
</repository>
</repositories>
<dependencies>

View File

@@ -7,6 +7,7 @@ import me.zimzaza4.geyserutils.common.packet.*;
import me.zimzaza4.geyserutils.common.particle.CustomParticle;
import me.zimzaza4.geyserutils.common.util.Pos;
import me.zimzaza4.geyserutils.spigot.GeyserUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@@ -88,4 +89,38 @@ public class PlayerUtils {
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
}
// (yes I'm aware it's "horrible" code, I'm just matching the energy of this plugin), also this aint player packets at all lmao
public static void registerProperty(Player player, Entity entity, String identifier, Class<?> type) {
EntityPropertyRegisterPacket packet = new EntityPropertyRegisterPacket();
packet.setEntityId(entity.getEntityId());
packet.setIdentifier(identifier);
packet.setType(type);
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
}
public static void sendBoolProperty(Player player, Entity entity, String identifier, Boolean value) {
EntityPropertyPacket<Boolean> packet = new EntityPropertyPacket<>();
packet.setEntityId(entity.getEntityId());
packet.setIdentifier(identifier);
packet.setValue(value);
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
}
public static void sendFloatProperty(Player player, Entity entity, String identifier, Float value) {
EntityPropertyPacket<Float> packet = new EntityPropertyPacket<>();
packet.setEntityId(entity.getEntityId());
packet.setIdentifier(identifier);
packet.setValue(value);
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
}
public static void sendIntProperty(Player player, Entity entity, String identifier, Integer value) {
EntityPropertyPacket<Integer> packet = new EntityPropertyPacket<>();
packet.setEntityId(entity.getEntityId());
packet.setIdentifier(identifier);
packet.setValue(value);
player.sendPluginMessage(GeyserUtils.getInstance(), GeyserUtilsChannels.MAIN, GeyserUtils.getPacketManager().encodePacket(packet));
}
}